import React, { Component } from 'react'
import {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native'
class Goodmoring extends Component{ //定制化组件
static defaultProps={
name:"somebody",
};
render(){
return (
<View >
<Text style={styles.welcome} >
Good morning,Wang!{this.props.name}
</Text>
</View>
)
}
}
class App extends Component {
render() {
return (
//定制化组件使用
<View style={styles.container}>
<Goodmoring style={styles.welcome} name="哒哒" />
<Text style={styles.welcome}>
wanghuanlong
</Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 5,
textAlign: 'center',
margin: 10,
},
})
AppRegistry.registerComponent('App', () => App)