1.0.2 • Published 7 years ago

react-native-loading-button v1.0.2

Weekly downloads
8
License
ISC
Repository
github
Last release
7 years ago

react-native-loading-button

React native button with activity indicator

Before Loading When loading

Install

npm install react-native-loading-button --save

Example

import LoadingButton from 'react-native-loading-button';

export default class example extends Component {

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

    onPressHandler(){
        this.setState({isLoading: true});
        setTimeout(()=>{
            this.setState({isLoading: false});
        }, 1000);
    }


    render() {
        return (
            <View style={styles.container}>
                <Text style={styles.welcome}>
                    Welcome to React Native!
                </Text>
                <LoadingButton
                    onPress={this.onPressHandler.bind(this)}
                    isLoading={this.state.isLoading}
                />
            </View>
        );
    }
}

Props

NameDetail & TypeDefault
onPressButton On press callback (function)alert('press')
isLoadingStart or stop animation booleanfalse
activityIndicatorColorActivity Indicator Color (string)'#FFF'
activityIndicatorSizeActivity Indicator Size (string)'small'
viewStyleMain View style (object)'small'
animationDelayHow manny time will tack to animate (number)200
whenAnimationViewWidthMain view size when animated40
enableWidthAnimationChange width when animationtrue
childViewInner child ComponentText Component (OK)