Tag: react native

KeyboardAvoidingView + ListView

我有一个提交表单的界面,使用ListView组件,并且该行包含TextInput组件,我想用户使用KeyboardAvoidingView来避免键盘cover TextInput中的行,但是它不工作,行不向上移动。 我的代码: render() { return ( <KeyboardAvoidingView style={styles.container} behavior='padding'> <ListView dataSource = {this.state.dataSource} renderRow = {this._renderRow.bind(this)} onEndReachedThreshold = {0} overflow = 'hidden' keyboardDismissMode = 'on-drag' removeClippedSubviews = {true} /> </KeyboardAvoidingView> ); }

在设备上开发react-native时如何使用HMR?

我可以在模拟器上启动热模块更换 ,因为我可以直接在键盘上input。 但是我不知道如何在实际的设备上访问这些debugging选项( cmd+ctrl+z或windows中的等价物)。 否则,如果不使用HMR,你从Xcode重build? 任何其他方法来重新加载应用程序,而不是? 它可能很慢。 任何帮助?

React本地网格视图:Flexbox换行不起作用

React Native 0.32似乎有一个错误。 下面的代码在0.20和0.24中正常工作,你可以在RN Play链接中看到。 https://rnplay.org/apps/W5k6Xg 'use strict'; var React = require('react'); var ReactNative = require('react-native'); var { AppRegistry, ListView, StyleSheet, Text, View, Image } = ReactNative; var GridLayoutExample = React.createClass({ getInitialState: function() { var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); return { dataSource: ds.cloneWithRows([ { name: 'John', image: 'https://d30y9cdsu7xlg0.cloudfront.net/png/619232-84.png' }, […]

如何将裁剪图像集中在React Native中

根据文档 ,反应原生的Image组件支持以下resizeModes : 'cover','contain','stretch','repeat','center' 如果图像大于Image分量,则center模式通过对图像进行均匀缩放以使图像的center位于Image分量的center ,从而使图像适合图像。 我想知道是否有黑客或解决scheme,我们可以定义一个自定义点(如0,300)作为一个焦点,这是它的Image视图的中心。 我想实现的目标有点像fresco重点作物,但也应该适用于内部监督办公室。

如何在React Native的当前屏幕上显示时主动刷新FlatList?

我正在使用React Native创build一个实时聊天应用程序。 我在主屏幕上使用<FlatList>作为聊天频道列表,并使用StackNavigator在屏幕之间进行导航。 现在,我试图让<FlatList>从后端重新获取数据,并在用户导航回到主屏幕时重新提交数据。 一个例子是用户进入聊天频道,应用程序导航到聊天细节屏幕,用户在那里发送一些消息,当用户按下后退button并导航回到主聊天频道列表屏幕时, <FlatList>应该从后端重新展现,重新展现最新的数据。 (将最近的频道重新排列在最上面等等) 现在拉刷新实施,但问题是我怎么知道用户已导航回到主屏幕,以及如何积极调用刷新<FlatList>发生时。 这是我的一些代码: onRefresh = async () => { const { data } = this.props try { this.setState({ refreshing: true }) await data.refetch({ page: 1 }) } catch (e) { // todo } finally { this.setState({ refreshing: false, }) } } const NudgeList = ({ nudges, loading, refreshing, onRefresh, […]

反应本机ListView缓慢加载

我有一个简单的ListView似乎需要很长时间来加载它的项目。 我已经在发布模式下testing过,并且需要大约3秒来加载整个页面。 如果我设置了initialListSize={1}我可以看到它逐项build立列表项。 ListView JSX代码: <ListView dataSource={this.state.dataSource} renderRow={this.renderRow} renderSeparator={(sectionID, rowID) => <View key={`${sectionID}-${rowID}`} style={styles.separator} />} style={styles.listView} initialListSize={1} /> 和renderRow方法: renderRow(row) { // console.log ('rendering scale row: ' + row.numerator + ':' + row.denominator ); return ( <TouchableHighlight onPress={() => this.pressRow(row)} underlayColor="grey"> <View style={styles.rowContainer}> <Text style={styles.rowText}>{row.hasOwnProperty('label') ? row.label : row.numerator + ':' + row.denominator}</Text> <Text style={styles.rowText}>{row.hasOwnProperty('label') […]

ReactNative – 未处理的JSexception:SyntaxError

当我试图启动我的RN应用程序在iOS 8我得到这个奇怪的错误: Unhandled JS Exception: SyntaxError 而这一切,没有更多的信息更多。 有没有无意中发现这个问题? 在iOs 9+应用程序运行好,寿。 xCode版本:8.1。 来自xCode的日志: 2016-12-07 16:33:57.073 [info][tid:main][RCTBatchedBridge.m:73] Initializing <RCTBatchedBridge: 0x7fc36c72ae80> (parent: <RCTBridge: 0x7fc36c060920>, executor: RCTJSCExecutor) 2016-12-07 16:34:29.369 [warn][tid:com.facebook.react.JavaScript][RCTBatchedBridge.m:509] Failed to execute source code: Unhandled JS Exception: SyntaxError 2016-12-07 16:34:29.369 [fatal][tid:main] Unhandled JS Exception: SyntaxError 我的package.json: { "name": "…", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js […]

React-native pubnub WebRTC Video Chat

我正在开发一个移动应用程序(react-native + pubnub)来进行WebRTCvideo聊天。 我的问题是,pubnub没有react-native的特定SDK,我该如何解决这个问题?

React Native 31,New Appdelegate.m no localhost to change:networking请求失败

我刚刚升级到react-native的最新版本(31),我的应用程序正在工作,不再工作了。 每次我得到networking请求失败错误从提取。 AppDelegate.m被更改,没有本地主机或127.0.0.1更改。 它放在别的地方吗? AppDelegate.m: #import "AppDelegate.h" #import "RCTBundleURLProvider.h" #import "RCTRootView.h" @implementation AppDelegate – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSURL *jsCodeLocation; jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"OpenCampus" initialProperties:nil launchOptions:launchOptions]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; […]

IOS – React Native – 未处理的JSexception:SyntaxError

当我创build一个新的React Native项目时,我遇到了问题。 显示红色的屏幕,并在xcode控制台中得到以下错误消息。