A Native number picker for both Android & iOS.
iOS is using ActionSheetPicker-3.0
$ npm install react-native-number-picker-ultra --save
$ react-native link react-native-number-picker-ultra
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-number-picker-ultra
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
)<
- Open up
android/app/src/main/java/[...]/MainApplication.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-ultra' project(':react-native-number-picker-ultra').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-number-picker-ultra/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-number-picker-ultra')
import RNNumberPickerLibrary from "react-native-number-picker-ultra";
//Method createDialog(objectForConfig, callBackForDoneClick, callbackForCancelClick)
RNNumberPickerLibrary.createDialog(
{
minValue: 0,
maxValue: 100,
selectedValue: 10,
doneText: "Done",
doneTextColor: "#000000", // only for Android
cancelText: "Cancel",
cancelTextColor: "#000000" // only for Android
},
(error, data) => {
if (error) {
console.error(error);
} else {
console.log(data);
}
},
(error, data) => {
if (error) {
console.error(error);
} else {
console.log(data);
}
}
);