RN-Redux-Project-02(简单显示初步搭建的Project)
1.index.js
引入HomePage,渲染HomePage组件
RootContainer组件里承载HomePage, RootContainer在index.ioss
设置styles
import React,{Component} from 'react';
import {
View,
StyleSheet,
} from 'react-native';
import HomePage from './pages/HomePage'
export default class RootContainer extends Component{
render (){
return(
<View style = {styles.container}>
<HomePage />
</View>
);
}
}
const styles = StyleSheet.create({
container:
{
flex:1,
marginTop:20,
}
})
2.index.ios.js
引入,入口index.js里RootContainer
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import RootContainer from './src/index'
export default class RN_Redux_002 extends Component {
render() {
return (
<View style={styles.container}>
<RootContainer/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});
AppRegistry.registerComponent('RN_Redux_002', () => RN_Redux_002);
3.HomePage.js
import React, { Component } from 'react';
import {
View,
Text
} from 'react-native';
export default class HomePage extends Component {
constructor (props){
super(props);
}
render(){
return(
<View>
<Text>QQ:738816656</Text>
</View>
);
}
}
网友评论