//3.style样式

import React,{useState} from 'react';

import {Text,StyleSheet,View} from 'react-native';

 

const StyleDemo=()=>{

    return(

        <View style={myStyles.container}>

            <Text style={myStyles.background}>hello background</Text>

            <Text style={myStyles.red}>hello red</Text>

            <Text style={myStyles.background}>hello background</Text>

        </View>

    );

}


 

const myStyles=StyleSheet.create(

    {

        container:{

            marginTop:50,

        },

        background:{

            backgroundColor:'green',

            color:'blue',

            fontSize:30

        },

        red:{

            color:'red'

        }

    }

);

 

export default StyleDemo;

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐