react-native-horizontal-picker
v0.0.1
Published
<img src="./Screenshot.png" width="200" alt="Screenshot" />
Readme
react-native-horizontal-picker
Add it to your project
You can try linking the project automatically:
$ react-native link
or do it manually as described below:
iOS
- Run
npm install react-native-horizontal-picker --save
or:
Manually
- Open your project in XCode, right click on
Librariesand clickAdd Files to "Your Project Name"Look undernode_modules/react-native-horizontal-pickerand addRNTHorizontalPicker.xcodeproj. - Add
libRNTHorizontalPicker.atoBuild Phases -> Link Binary With Libraries - Click on
libRNTHorizontalPicker.xcodeprojinLibrariesand go theBuild Settingstab.
Then:
- Whenever you want to use it within React code now you can:
import HorizontalPicker from 'react-native-horizontal-picker';
Example
<HorizontalPicker
selectedIndex={0} //initial index can be set using this
style={{ width: 150, height: 100, marginBottom: 4 }} //styles usually given to View component
titles={[1, 2, 3, 4]} //can be an array of numbers or strings
onChange={(event: Event) => { console.log('index of selected value', event.nativeEvent.newIndex); }}
/>To-do list
- [ ] Add test cases
- [ ] More UI customization support
- [ ] Android support
- [ ] Support for images
Credit
This component is based on akkyie's component AKPickerView. License: https://github.com/Akkyie/AKPickerView/blob/master/LICENSE
License
MIT.
