button-with-spinner
v1.0.3
Published
This is a react native custom button component. During API call’s or any time consuming operation, user will be visually informed from the button itself. This custom button will display a spinner when it is clicked to inform user that some processing is
Downloads
14
Maintainers
Readme
button-with-spinner
This is a react native custom button component which supports in react native 0.60 and above. During API call’s or any time consuming operation, user will be visually informed from the button itself. This custom button will display a spinner when it is clicked to inform user that some processing is going and block the UI until processing is complete.
Getting started
$ npm install button-with-spinner --save
or
$ yarn add button-with-spinner
Mostly automatic installation
For react native version < 0.60, call react-native link before proceeding.
$ react-native link button-with-spinner
Follow the below steps, for all versions of react native that supports pod.
$ cd ios
$ pod install
Usage
import SaveButton from 'button-with-spinner';
// Add a state in constructor with name isLoading and update it based on the operation performed
<SaveButton
style={{marginTop: 16}}
buttonStyle={{backgroundColor:'blue'}}
title={"Save"}
isLoading={this.state.isLoading}
onButtonPress={(value) => {
console.log("Spinner started. It will stop when this.state.isLoading is set to false");
}}/>