|
| 1 | +# **React Native Number View** |
| 2 | + |
| 3 | +<img src="img/img1.png" alt="image1" style="" /> |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +<img src="img/img3.png" alt="image1" style="" /> |
| 8 | + |
| 9 | +This is a simple React Native number counter component. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +### Installation |
| 14 | + |
| 15 | +Add react-native-number-view to your project by executing |
| 16 | + |
| 17 | +``` |
| 18 | +$ npm install react-native-number-view |
| 19 | +or |
| 20 | +$ yarn add react-native-number-view |
| 21 | +``` |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +> and that's it, you're all good to go! |
| 26 | +
|
| 27 | + |
| 28 | + |
| 29 | +### Usage |
| 30 | + |
| 31 | +```javascript |
| 32 | +/** |
| 33 | + * Sample React Native App |
| 34 | + * https://github.com/facebook/react-native |
| 35 | + * |
| 36 | + * @format |
| 37 | + * @flow |
| 38 | + */ |
| 39 | + |
| 40 | +import React, {Component} from 'react'; |
| 41 | +import {View} from 'react-native'; |
| 42 | +import {NumberView} from 'react-native-number-view' |
| 43 | + |
| 44 | +type Props = {}; |
| 45 | +export default class App extends Component<Props> { |
| 46 | + render() { |
| 47 | + return ( |
| 48 | + <View style={styles.container}> |
| 49 | + <NumberView |
| 50 | + enableDefaultStyles={true} |
| 51 | + themeColor="#3F6D2A" |
| 52 | + leftContent={<Text>😔</Text>} |
| 53 | + rightContent={<Text>😃</Text>} |
| 54 | + onValueChange={(newVal)=>{alert(newVal)}} |
| 55 | + onDecrement={()=>{alert('decremented')}} |
| 56 | + onIncrement={()=>{alert('Incremented')}} |
| 57 | + /> |
| 58 | + </View> |
| 59 | + ); |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | +``` |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +## API's |
| 70 | + |
| 71 | +| Name | Use | Default Values | |
| 72 | +| ----------------------------- | ------------------------------------------ | -------------- | |
| 73 | +| leftContent | Content to be displayed on the left | None | |
| 74 | +| rightContent | Content to be displayed on the Right | None | |
| 75 | +| onValueChange | Callback which return new value | None | |
| 76 | +| onDecrement | callback each time value is decremented | None | |
| 77 | +| onIncrement | callback each time value is incremented | None | |
| 78 | +| themeColor | Use to set a theme color(only accepts HEX) | none | |
| 79 | +| enableDefaultStyles (boolean) | enable or disable preset styles | True | |
| 80 | +| initialValue | counters initial value | 0 | |
| 81 | +| | | | |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +## Contributions |
| 86 | + |
| 87 | +What to help make this package even more awesome? [Read how to contribute](https://github.com/react-native-nigeria/react-native-number-view/blob/master/contribution.md) |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +## Licensing |
| 92 | + |
| 93 | +This project is licensed under MIT license. |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +### Don't forget to star, like and share :) |
| 98 | + |
0 commit comments