rn 活动指示器--加载圆圈、按钮组件

活动指示器
	<ActivityIndicator />
		属性
			animating:{true/false} 是否显示
			size:''large/small" 圆圈大小
			color:'颜色'
			style:设置其他样式,其中{height和width为定位}

按钮
<Button title='设置按钮文本内容'></Button>

代码示例:

import React,{Component} from 'react'
import {ActivityIndicator,View,Text,TouchableOpacity,Button,StyleSheet} from 'react-native'

export default class Act extends Component{
    state={
        flag:true
    }
    close=function(){
        this.setState({
            flag:!this.state.flag
        })
    }
    componentDidMount=()=>this.close()
    render(){
        return(
            <>
                <ActivityIndicator 
                    animating={this.state.flag}
                    color='red'
                    //small
                    size='large'
                    style={style.act}

                />    
                <Button  onPress={this.close.bind(this)} title='开关'></Button>
            </>
        )
    }
}

const style=StyleSheet.create({
    act:{
        height:60,
        width:80
    }
})
发布了619 篇原创文章 · 获赞 3 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_43294560/article/details/105090702
RN