React-Native进行时(四)--ListView navigator.push
发布时间:2020-12-15 04:46:39 所属栏目:百科 来源:网络整理
导读:React-Native进行时(四)--ListView navigator.push 1、使用Nav时必须添加 TouchableHighlight、 NavigatorIOS; var { AppRegistry,StyleSheet,Text,View,NavigatorIOS,TouchableHighlight,} = React; 使用时nav必须有个rootView,这点iOS基本一致 ,ios使
React-Native进行时(四)--ListView navigator.push 1、使用Nav时必须添加 TouchableHighlight、 NavigatorIOS; var { AppRegistry,StyleSheet,Text,View,NavigatorIOS,TouchableHighlight,} = React; 使用时nav必须有个rootView,这点iOS基本一致 ,ios使用如下: - (instancetype)initWithRootViewController:(UIViewController *)rootViewControllerreact-native使用如下: <NavigatorIOS style={Style.container} tintColor={'#333344'} initialRoute={{ title: '忽悠',component: require('./App/Views/Home/Home') }} itemWrapperStyle={Style.navigator} /> 2、push使用这点和iOS不太一样,iOS使用如下方法就可以实现: - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animatedreact-native必须使用TouchableHighlight配合,代码如下: <TouchableHighlight onPress={() => this.showDetail(rsustlBody)} > <View style={styles.container}> <Image source={{uri: rsustlBody.OtherInfo.ProductImg}} style={styles.thumbnail} /> <View style={styles.rightContainer}> <Text style={styles.title}>{rsustlBody.Name}</Text> <Text style={styles.year}>{rsustlBody.BrokerCommissionRate}</Text> </View> </View> </TouchableHighlight>使用TouchableHighlight时,里面必须要有View (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |