React-Native基础_2.样式Style

来源:互联网 发布:java web start 编辑:程序博客网 时间:2024/05/09 15:49
2.样式Style基本使用方式1 直接在View 上面写style 内容       <View style={{                backgroundColor: '#07811d',                flex: 1            }}>                <Text>                    Welcome to React Native!                </Text>            </View>方式2 StyleSheet.create定义一个style 常量,然后直接使用常量中定义好的属性export default class Day0718 extends Component {    render() {        return (            <View style={styles.Container}>                <Text style={styles.Text}>                    Welcome to React Native!                </Text>            </View>        );    }}const styles = StyleSheet.create({    Container :{        borderWidth :1,        borderColor:'#c9382d',        borderRadius:15,        shadowColor:'#6435c9',        shadowOpacity:0.6,        shadowRadius:2,        shadowOffset:{            height:1,            width:0,        },        margin:10,        backgroundColor: '#c9382d',        flex: 1,    },    Text:{        color:'#6435c9',        fontSize: 26,        textAlign:'center',        fontStyle:'italic',        letterSpacing:2,        lineHeight:33,        fontFamily:'Helvetica Neue',        fontWeight:'300',        textDecorationLine:'underline',        textDecorationStyle:'dashed',    },});


---------------欢迎各位大神加群

----------------Android交流群:230274309

-----------------------------期待大神们的到来

------------------------一---起分享,一起进步!需要你们