你好,我正在尝试用 React Native 设计一个屏幕。如果您看到下面的屏幕截图,则存在三个视图。a) 图像 b) 出现文本的中心视图 c) 圆形视图
我想扩大中心视图宽度,使其覆盖完整的可用空间。我尝试使用 flex 属性但无法成功。有谁知道该怎么做?
<View style={{ flexDirection: "column" }}>
<View style={{ flexDirection: "row" }}>
<Icon name="user" size={30} />
<Text
style={{
textAlignVertical: "center",
marginLeft: 20
}}
>
Ajay Saini
</Text>
</View>
<Text style={{ marginLeft: 50 }}>Hello</Text>
</View>
<View style={{ flexDirection: "row", width: "100%" }}>
<Icon name="user" size={30} />
<View
style={{
flex: 1,
flexDirection: "column",
marginLeft: 20
}}
>
<Text>Williams</Text>
<Text>
{item.text}jhfjks ahfdkjsdh fjkshfjksaddhfjksdahfjkds
ahajkdhfjksahdf
</Text>
</View>
<View
style={{
flex: 1,
flexDirection: "row",
justifyContent: …Run Code Online (Sandbox Code Playgroud) 这是针对使用react-native 创建的iOS 应用程序。我正在使用KeyboardAvoidingView包含一些字段的表单TextInput。TextInput我观察到,当选择屏幕底部的字段时,视图移动的高度不足以容纳键盘。
我创建了一种小吃来演示这种行为(下面的链接)。我还观察到,在某些情况下,一台 iPhone 上的视图移动得足够高,但另一台 iPhone 上却没有。最初,该问题是针对 iPhone 6S Plus 报告的,用户报告说视图没有移动到足够高以容纳键盘,在这种情况下,他们无法看到他们在输入框中键入的内容。当我尝试制作一个零食来重现该问题时,我发现即使在 iPhone 5s 上也能重现该问题。
https://snack.expo.io/ry15dng2-
在上面的小吃中,如果单击带有TextInputvalue 的框jug,您应该看到键盘与输入框重叠并且不清晰可见。我对零食的质量感到抱歉。我只是尝试创建一个最小的示例来重现该问题。
我该如何解决这个问题?
从与 iOS 的链接启动时,会不断返回以下内容,但 Android 工作正常。
{"+is_first_session":false,"+clicked_branch_link":false,"+non_branch_link":" https://yourapp.app.link/?someparam=123 "}
我刚刚开始使用 React Native Branch,我已经到了我的 Android 应用程序通过提供的链接打开的程度,并且正在成功订阅并通过传入的参数识别分支链接,但是当涉及到 iOS 应用程序时该应用程序按照链接成功打开,并订阅,它似乎没有识别分支链接,也没有在传入参数时识别。
我AppDelegate.m按照要求修改了:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
NSURL *jsCodeLocation;
Run Code Online (Sandbox Code Playgroud)
添加了打开 URL(已有 FBSDKApplicationDelegate)
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
if (![RNBranch.branch application:application openURL:url options:options]) {
// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
}
return YES;
// Add any custom logic here.
return …Run Code Online (Sandbox Code Playgroud) 我使用 Expo 工具构建了一个应用程序..但现在我要在没有 expo 的情况下移动到 React Native ..我尝试在 React Native 中创建一个新项目,然后传输我编写的代码并安装我在其中使用的组件我的应用程序。
带有 Expo 的应用程序按预期工作,并移动到本地反应,而没有 Expo 的应用程序会意外工作并崩溃。
有没有办法将文本输入限制在最小长度和最大长度之间。假设我想将文本输入长度限制在 5 到 15 之间,我该怎么做?
我正在使用react-native run-is命令通过终端运行React-native项目。我想在模拟器中运行它。首先我运行 npm install ,然后运行 react-native run-ios 。它显示错误
错误:找不到模块“metro-config”需要堆栈: - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/util/Config.js - /Users/tribond/Projects/JustHelper/ justhelper2/node_modules/react-native/local-cli/core/index.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/local-cli/cliEntry.js - /Users/tribond/Projects/ JustHelper/justhelper2/node_modules/react-native/local-cli/cli.js - /Users/tribond/Projects/JustHelper/justhelper2/node_modules/react-native/cli.js - /usr/local/lib/node_modules/react-本机-cli/index.js
将 RN 从 RN0.60 升级到 RN0.61。由于以下问题,iOS 构建失败:
/react-native/React/Base/RCTBridgeModule.h:10:9: 'React/RCTDefines.h' file not found
Run Code Online (Sandbox Code Playgroud)
我知道这一重大变化。(不推荐使用 React.xcodeproj)
尝试一些事情
这是我的 podfile 的样子。
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' …Run Code Online (Sandbox Code Playgroud) 我正在使用react-native-qr-code-scanner在我的应用程序中添加 QR 扫描仪功能。我遵循了所有的 instaruction 并且在 android 上一切正常,但是当我在 ios 上构建我的应用程序时,应用程序无法找到该RNPermissions库,因此我按照自述文件中的建议手动链接它。链接错误现在消失了,我得到了 Invali RMPermission ios.PERMISSION.CAMERA should be one of()。该错误在react-native-permissions README PAGE的 github 页面和解决它的步骤中有所描述。它说
检查您是否链接了至少一个权限处理程序。
我无法将那里描述的权限处理程序添加到 Podfile,因为它会React(0.11.0)自动安装版本(但这不是必需的),因为我已经有了最新的反应。解决这个问题的方法是什么?
[!]
pod install添加后运行时
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
Run Code Online (Sandbox Code Playgroud)
我明白了
Unable to find a specification for `RNPermissions` depended upon by `Permission-Camera`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or …Run Code Online (Sandbox Code Playgroud) 我想知道如何在react-native-google-places-autocomplete中设置左侧的搜索图像图标。
我想要在下面的屏幕中输出这样的输出。所以请帮助我。
这是 DiscoveryLocation.js 文件的代码。
import React, { Component } from 'react'
import { Text, View, TouchableOpacity, TextInput, StyleSheet, Image } from 'react-native'
import { heightPercentageToDP as hp, widthPercentageToDP as wp } from 'react-native-responsive-screen';
import { RFPercentage, RFValue } from "react-native-responsive-fontsize";
import MapView, { PROVIDER_GOOGLE, Marker } from 'react-native-maps';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
console.disableYellowBox = true;
export default class DiscoveryLocation extends Component {
render() {
return (
<View style={styles.container}>
<View style={styles.vwheader} >
<TouchableOpacity
onPress={() => { …Run Code Online (Sandbox Code Playgroud) google-maps react-native react-native-ios google-places-autocomplete
我正在使用 React-native-dropdown-picker,但是我无法从下拉列表中选择任何项目,这些项目被下面的视图重叠。我试过添加 position:'absolute, zIndex:2 但仍然是 itemlist 重叠如下:

我已经编写了下拉组件的代码如下
return (
<View>
<View style={styles.container}>
{console.log('new array', dateArr)}
{console.log('arr', arr)}
<Icon
name="arrow-left"
size={20}
color="#fff"
style={{marginTop: 12}}
/>
{console.log('----------date', dateArr)}
{dateArr != null && (
<DropDownPicker
onValueChange={(value) => onValSelect(value)}
items={dateArr}
itemStyle={{
// justifyContent: 'flex-start',
flexDirection:'row'
}}
containerStyle={{height: 40,width:'80%',zIndex:2}}
/>
)}
</View>
<DaysInAWeek daysInAWeek={daysInAWeek} />
</View>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#FE017E',
// height: 56,
width: '100%',
flexDirection: 'row',
padding: 10,
},
});
Run Code Online (Sandbox Code Playgroud)
onValSelect() 如下:
function onValSelect(val) {
if (val.length …Run Code Online (Sandbox Code Playgroud) react-native ×10
react-native-ios ×10
android ×1
branch.io ×1
deep-linking ×1
expo ×1
google-maps ×1
ios ×1
reactjs ×1