代码示例:
import React,{Component} from 'react'
import{
View,
Text,
StyleSheet
} from 'react-native'
const App=()=>{
return(
<View style={style.container}>
<Text style={style.s}>
<Text style={style.s1}>
jeff
</Text>
<Text>
<Text style={style.s2}>jeff帅</Text>
</Text>
<Text>
<Text style={style.s3}>jeff帅帅</Text>
</Text>
<Text>
<Text style={style.s4}>jeff帅帅帅</Text>
</Text>
<Text>
<Text style={style.s5}>jeff帅帅帅帅</Text>
</Text>
</Text>
</View>
)
}
const style=StyleSheet.create({
container:{
alignItems:'center',
marginTop:100,
padding:20
},
s1:{
color:'red'
},
s2:{
color:'blue',
fontSize:20
},
s3:{
fontWeight:'bold',
color:'orange'
},
s4:{
fontStyle:'italic',
color:'green'
},
s5:{
textShadowColor:'purple',
textShadowOffset:{width:2,height:2},
textShadowRadius:1
}
})
export default App;