React Native-7.React Native NavigatorIOS组件详解
发布时间:2020-12-15 04:40:51 所属栏目:百科 来源:网络整理
导读:老样子,先上图: 图也看了,先听老王给你讲讲政治课 NavigatorIOS 是RN中的一个组件 既然是一个组件,那么他就有一堆属性来完成不同的需求: 属性讲解 barTintColor : 导航条的背景颜色 initalRoute : 在RN 中导航名为“路由”(学过网络的应该明白这个词的
老样子,先上图: 图也看了,先听老王给你讲讲政治课NavigatorIOS 是RN中的一个组件既然是一个组件,那么他就有一堆属性来完成不同的需求: 属性讲解
废话少说。上干货'use strict';
var React = require('react-native');
var NextPage = require('./iOSFile/nextPage.js')
var {
AppRegistry,StyleSheet,Text,View,PixelRatio,NavigatorIOS,ScrollView,} = React;
var styles = StyleSheet.create({
flex: {
flex:1,},scrollViewTop : {
marginTop: 20,list_item: {
color: '#333',fontSize: 16,fontWeight: 'bold',marginLeft: 15,borderBottomWidth: 1,borderBottomColor: '#ddd',detail_text: {
textAlign: 'center',}
})
var List = React.createClass({
render:function(){
return(
<ScrollView style = {[styles.flex,styles.scrollViewTop]}>
<Text style = {styles.list_item} onPress = {this.goTo}>? 王学森,你妈喊你回家娶媳妇儿</Text>
<Text style = {styles.list_item} onPress = {this.goTo}>? 女子无才便是德</Text>
<Text style = {styles.list_item} onPress = {this.goTo}>? 过年逼婚,我草了!!</Text>
</ScrollView>
);
},goTo: function(){
this.props.navigator.push({
component:NextPage,title:'过年详情',rightButtonTitle:'全是教导',onRightButtonPress:function(){
alert('你妈催你找媳妇儿');
}
});
}
})
var Detail = React.createClass({
render:function(){
return(
<ScrollView style = {styles.scrollViewTop}>
<Text style = {styles.list_item,styles.detail_text}>详情页</Text>
<Text style = {styles.list_item}>测试页面</Text>
</ScrollView>
);
}
})
var wxsPrj = React.createClass({
render: function() {
return (
<NavigatorIOS style = {styles.flex} initialRoute = {{
component: List,title: '过年也不好',passProps:{},}}/>
);
}
})
AppRegistry.registerComponent('wxsPrj',() => wxsPrj);
nextPage 代码:var React = require('react-native')
var {
AppRegistry,}= React;
var NextPage = React.createClass({
render:function(){
return(
<ScrollView style= {styles.flex}>
<Text style = {styles.titleFont}>过年回家</Text>
<Text style = {styles.titleFont}>常回家看看</Text>
</ScrollView>
)
}
})
var styles = StyleSheet.create({
flex: {
flex:1,titleFont: {
fontSize: 20,color: '#ddd',textAlign: 'center',})
module.exports = NextPage;
<ScrollView style = {[styles.flex,styles.scrollViewTop]}>
<Text style = {styles.list_item} onPress = {this.goTo}>? 王学森,你妈喊你回家娶媳妇儿</Text>
<Text style = {styles.list_item} onPress = {this.goTo}>? 女子无才便是德</Text>
<Text style = {styles.list_item} onPress = {this.goTo}>? 过年逼婚,我草了!!</Text>
</ScrollView>
goTo: function(){
this.props.navigator.push({
component:NextPage,onRightButtonPress:function(){
alert('你妈催你找媳妇儿');
}
});
来看一下我们的爱情动作片: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |