react-native-number-picker-library
v1.0.8
Published
A Native number picker for both Android & iOS
Downloads
12
Maintainers
Readme
react-native-number-picker-library
A Native number picker for both Android & iOS
Getting started
$ npm install react-native-number-picker-library --save
Mostly automatic installation
$ react-native link react-native-number-picker-library
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-number-picker-library
and addRNNumberPickerLibrary.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNNumberPickerLibrary.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNNumberPickerLibraryPackage;
to the imports at the top of the file - Add
new RNNumberPickerLibraryPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-number-picker-library' project(':react-native-number-picker-library').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-number-picker-library/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-number-picker-library')
Usage
import RNNumberPickerLibrary from 'react-native-number-picker-library';
//Method createDialog(objectForConfig, callBackForDoneClick, callbackForCancelClick)
RNNumberPickerLibrary.createDialog(
{
minValue: 0,
maxValue: 100,
selectedValue: 10,
doneText: 'Done', // only for Android
doneTextColor: '#000000', // only for Android
cancelText: 'Cancel', // only for Android
cancelTextColor: '#000000' // only for Android
},
(error, data) => {
if (error) {
console.error(error);
} else {
console.log(events);
}
},
(error, data) => {
if (error) {
console.error(error);
} else {
console.log(events);
}
}
);