1.0.1 • Published 6 years ago

react-native-lindf-loading v1.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

Loading

npm install react-native-lindf-loading --save

or

yarn add react-native-lindf-loading

Usage

import React,{Component} from 'react';
import { View, Button } from 'react-native';
import Loading from 'react-native-lindf-loading';

constructor(props) {
	super(props);
    this.state = {
        isModal: false
    };
}

// 显示Loading
_showModal() {
    this.setState({
        isModal: true
    })

    setTimeout(() => {
        this.setState({
            isModal: false
        });
    }, 2000)
}

// android返回键触发
_onRequestClose() {
    this.setState({
        isModal: false
    });
}

render() {
	return (
		<View>
			<Loading 
                visible={this.state.isModal} 
                onRequestClose={this._onRequestClose.bind(this)}
            />
            <Button
				title="show Loading",
				onPress={()=>this._showModal().bind(this)}
            />
		</View>
	);
}