A custom field component for RPE and Time.
This package is hosted on GitHub not NPM, so make sure your npmrc file is set up.
- Using Yarn:
yarn add @mypthub/react-native-picker-custom - Using NPM:
npm i @mypthub/react-native-picker-custom
The Picker needs to be initialised before use. A table of parameters it can be set up with is described in the API section.
For example:
import Picker from '@mypthub/react-native-picker-custom';
let data = [];
for(var i=0;i<100;i++){
data.push(i);
}
Picker.init({
pickerData: data,
selectedValue: [59],
onPickerConfirm: data => {
console.log(data);
},
onPickerCancel: data => {
console.log(data);
},
onPickerSelect: data => {
console.log(data);
}
});
Picker.show();For more information on different modes of operation, see the original docs.
The available methods on the Picker class are detailed below.
| Name | Description | Type | Default |
|---|---|---|---|
| init | init and pass parameters to picker | see below | |
| toggle | show or hide picker | ||
| show | show picker | ||
| hide | hide picker | ||
| select | select a row | array | |
| isPickerShow | get status of picker, return a boolean |
These are the parameters you can pass to the init method:
| Key | Description | Type | Default |
|---|---|---|---|
| pickerConfirmBtnText | string | confirm | |
| pickerCancelBtnText | string | cancel | |
| pickerTitleText | string | please select | |
| pickerConfirmBtnColor | array | [1, 186, 245, 1] | |
| pickerCancelBtnColor | array | [1, 186, 245, 1] | |
| pickerTitleColor | array | [20, 20, 20, 1]) | |
| pickerToolBarBg | array | [232, 232, 232, 1] | |
| pickerBg | array | [196, 199, 206, 1] | |
| pickerToolBarFontSize | number | 16 | |
| pickerFontSize | number | 16 | |
| pickerFontColor | array | [31, 31, 31, 1] | |
| pickerData | array | ||
| selectedValue | string | ||
| onPickerConfirm | function | ||
| onPickerCancel | function | ||
| onPickerSelect | function | ||
| isShowLongTime | boolean | false | |
| pickerLongTimeText | string | ||
| pickerLongTimeBg | array | [255, 255, 255, 1] | |
| pickerLongTimeFontColor | array | [51, 51, 51, 1] | |
| pickerLongTimeFontSize | number | 16 |