2 |
3 | ## 💡 Props List
4 |
5 | | Property | Description | Type | Default | Note |
6 | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------- | ---------------- | ------------------------------------------------ |
7 | | `accelerationDelay` | Delay time before start the `onLongPress` event and increase or decrease and continually | Number | `750 ` | |
8 | | `activeOpacity` | Opacity on pressed button | Number | `0.85` | |
9 | | `append` | Custom element before right button | Component | | |
10 | | `arrows` | Labels on button will be arrows (< and >) instead of plus and minus | Boolean | `false` | |
11 | | `autoFocus` | If `true`, focuses the input on `componentDidMount`. | | `false` | |
12 | | `background` | Background color of number button | String | `transparent` | |
13 | | `buttonFontFamily` | Custom fontFamily of buttons of the Spinner | String | `System Default` | |
14 | | `buttonFontSize` | Custom fontSize of buttons of the Spinner | Number | `14` | |
15 | | `buttonLeftDisabled` | Disable left button | Boolean | `false` | |
16 | | `buttonLeftImage` | Custom element on the button left of the spinner | Component | | |
17 | | `buttonLeftText` | Custom text on the button left of the spinner | String | | |
18 | | `buttonPressLeftImage` | Custom element on the button left of the spinner on pressed state | Component | | |
19 | | `buttonPressRightImage` | Custom element on the button right of the spinner on pressed state | Component | | |
20 | | `buttonPressStyle` | Button Style on Pressed state (Plus and Minus buttons) | Object | | Could overwrite other props |
21 | | `buttonPressTextColor` | Custom color of the button of the Spinner on Pressed state | String | Auto | |
22 | | `buttonRightDisabled` | Disable right button | Boolean | `false` | |
23 | | `buttonRightImage` | Custom element on the button right of the spinner | Component | | |
24 | | `buttonRightText` | Custom text on the button right of the spinner | String | | |
25 | | `buttonStyle` | Button Style (Plus and Minus buttons) | Object | | Could overwrite other props |
26 | | `buttonTextColor` | Custom color of the button of the Spinner | String | Auto | |
27 | | `buttonPressTextStyle` | Button Style on Pressed state (Plus and Minus buttons) | Object | | Could overwrite other props |
28 | | `buttonTextStyle` | Button text Style state (Plus and Minus buttons) | Object | | Could overwrite other props |
29 | | `colorAsBackground` | Use color as background | Bool | `false` | |
30 | | `colorLeft` | Custom color of the Spinner left button | String | `#3E525F` | |
31 | | `colorMax` | Custom color of the Spinner when reach max value | String | | |
32 | | `colorMin` | Custom color of the Spinner when reach min value | String | | |
33 | | `colorPress` | Custom color of the Spinner button on touch press | String | `#3E525F` | |
34 | | `colorRight` | Custom color of the Spinner right button | String | `#3E525F` | |
35 | | `color` | Custom color of the Spinner | String | `#3E525F` | |
36 | | `continuity` | On min value is reached next decrease value will be the max value, if max is reached next increase value will be the min value | Boolean | `false` | |
37 | | `disabled` | Disable the Spinner or not | Boolean | `false` | |
38 | | `editable` | Set if input number field is editable or not | Boolean | `true` | |
39 | | `emptied` | Set if input can be empty | Boolean | `false` | |
40 | | `fontFamily` | Custom fontFamily of the text input of the Spinner | String | System Default | |
41 | | `fontSize` | Custom fontSize of the text input of the Spinner | Number | `14` | |
42 | | `formatter` | Custom formatting of the Spinner text | Function | `null` | `(value) => { ...; return formattedValue }`. `editable` must be `false` |
43 | | `height` | Custom height of the Spinner | Number | `50` | |
44 | | `initialValue` | Initial value of the Spinner | String
4 |
5 | ### If this project has helped you out, please support us with a star 🌟
6 |
7 |
|
|
65 |
66 | ### High customization
67 |
68 | | Skins | Customization |
69 | | ----------------------------------------- | -------------------------------------- |
70 | |
|
|
71 |
72 | ## ⚡️ Example
73 |
74 | ### Web
75 |
76 | [https://marcocesarato.github.io/react-native-input-spinner/](https://marcocesarato.github.io/react-native-input-spinner/)
77 |
78 | ### Expo
79 |
80 | Clone or download repo and after:
81 |
82 | ```shell
83 | cd Example
84 | yarn install # or npm install
85 | expo start
86 | ```
87 |
88 | Open Expo Client on your device. Use it to scan the QR code printed by `expo start`. You may have to wait a minute while your project bundles and loads for the first time.
89 |
90 | [Example App Screenshot](images/example_app.png)
91 |
92 | ## 💡 Props
93 |
94 | Check the "[Props List](PROPS.md)" file to have the complete list of component props ordered by name.
95 |
96 | ### Structure
97 |
98 |
99 |
100 | ### Handlers
101 |
102 | | Handler | Description | Func |
103 | | ----------------- | ----------------------------------------------------------------------------- | ---------------------- |
104 | | `onBlur` | Callback that is called when the text input is blurred. | (e) => { ... } |
105 | | `onChange` | Callback that is called when the number of the Spinner change. | (num) => { ... } |
106 | | `onDecrease` | Callback that is called when decrease button is clicked get value decreased. | (decreased) => { ... } |
107 | | `onFocus` | Callback that is called when the text input is focused. | (e) => { ... } |
108 | | `onIncrease` | Callback that is called when increase button is clicked get value increased . | (increased) => { ... } |
109 | | `onKeyPress` | Callback that is called when a key is pressed. | (e) => { ... } |
110 | | `onLongPress` | Callback that is called when holding the right or the left button | Function |
111 | | `onMax` | Callback that is called when max is reached get max number permitted. | (max) => { ... } |
112 | | `onMin` | Callback that is called when min is reached get min number permitted. | (min) => { ... } |
113 | | `onSubmitEditing` | Callback that is called when the text input's submit button is pressed | (e) => { ... } |
114 |
115 | ### Props
116 |
117 | | Property | Description | Type | Default | Note |
118 | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------- | ------- | --------------------------------- |
119 | | `accelerationDelay` | Delay time before start the `onLongPress` event and increase or decrease and continually | Number | `1000` | |
120 | | `append` | Custom element before right button | Component | | |
121 | | `autoFocus` | If `true`, focuses the input on `componentDidMount`. | | `false` | |
122 | | `continuity` | On min value is reached next decrease value will be the max value, if max is reached next increase value will be the min value | Boolean | `false` | |
123 | | `disabled` | Disable the Spinner or not | Boolean | `false` | |
124 | | `editable` | Set if input number field is editable or not | Boolean | `true` | |
125 | | `emptied` | Set if input can be empty | Boolean | `false` | |
126 | | `initialValue` | Initial value of the Spinner | String
153 |
154 | ##### Description
155 |
156 | - Top spinner with a child
157 | - Bottom spinner with `prepend` and `append`
158 |
159 | ### Props Styles
160 |
161 | | Property | Description | Type | Default | Note |
162 | | ------------------ | ----------------------------- | ------ | ------- | --------------------------------------------- |
163 | | `buttonPressStyle` | Button style on Pressed state | Object | | Could overwrite other props |
164 | | `buttonStyle` | Button style | Object | | Could overwrite other props |
165 | | `inputStyle` | Text Input style | Object | | Could overwrite other props |
166 | | `skin` | Skin layout | String | | `clean`, `modern`, `paper`, `round`, `square` |
167 | | `style` | Container style | Object | | Could overwrite other props |
168 |
169 | ### Props Colors
170 |
171 | | Property | Description | Type | Default | Note |
172 | | ---------------------- | ---------------------------------------------------------- | ------ | ------------- | ---- |
173 | | `background` | Custom input text background color | String | `transparent` |
174 | | `buttonPressTextColor` | Custom color of the button of the Spinner on Pressed state | String | Auto |
175 | | `buttonTextColor` | Custom color of the label's button of the Spinner | String | Auto |
176 | | `colorAsBackground` | Use color as background | Bool | `false` |
177 | | `colorLeft` | Custom color of the Spinner left button | String | `#3E525F` |
178 | | `colorMax` | Custom color of the Spinner when reach max value | String | |
179 | | `colorMin` | Custom color of the Spinner when reach min value | String | |
180 | | `colorPress` | Custom color of the Spinner button on touch press | String | `#3E525F` |
181 | | `colorRight` | Custom color of the Spinner right button | String | `#3E525F` |
182 | | `color` | Custom color of the Spinner | String | `#3E525F` |
183 | | `textColor` | Custom input text number color | String | Auto |
184 |
185 | #### Screenshots
186 |
187 |
188 |
189 | ##### Description
190 |
191 | - Spinner with `color`, `buttonTextColor`, `colorPress` and `buttonPressTextColor` custom colors
192 |
193 | ### Props Container Style
194 |
195 | | Property | Description | Type | Default | Note |
196 | | ------------ | ------------------------------------- | ------- | ------- | ------------------------------------------------ |
197 | | `height` | Custom height of the Spinner | Number | `50` |
198 | | `shadow` | Show container shadow | Boolean | `false` | Use with `background` like `background={"#FFF"}` |
199 | | `showBorder` | Show the border of the Spinner or not | Boolean | `false` | Use with `rounded={false}` |
200 | | `style` | Container style | Object | | Could overwrite other props |
201 | | `width` | Custom width of the Spinner | Number | `150` |
202 |
203 | ### Props Buttons Style
204 |
205 | | Property | Description | Type | Default | Note |
206 | | ----------------------- | ------------------------------------------------------------------ | --------- | -------------- | --------------------------- |
207 | | `activeOpacity` | Opacity of underlay on pressed button | Number | `0.85` |
208 | | `arrows` | Labels on button will be (< and >) instead of (+ and -) | Boolean | `false` |
209 | | `buttonFontFamily` | Custom fontFamily of buttons of the Spinner | String | System Default |
210 | | `buttonFontSize` | Custom fontSize of buttons of the Spinner | Number | `14` |
211 | | `buttonLeftDisabled` | Disable left button | Boolean | `false` | |
212 | | `buttonLeftImage` | Custom element on the button left of the spinner | Component | | Could overwrite other props |
213 | | `buttonLeftText` | Custom text on the button left of the spinner | String | |
214 | | `buttonPressLeftImage` | Custom element on the button left of the spinner on pressed state | Component | | Could overwrite other props |
215 | | `buttonPressRightImage` | Custom element on the button right of the spinner on pressed state | Component | | Could overwrite other props |
216 | | `buttonPressStyle` | Button Style on Pressed state (Plus and Minus buttons) | Object | |
217 | | `buttonPressTextColor` | Custom color of the button of the Spinner on Pressed state | String | `#FFFFFF` |
218 | | `buttonRightDisabled` | Disable right button | Boolean | `false` | |
219 | | `buttonRightImage` | Custom element on the button right of the spinner | Component | | Could overwrite other props |
220 | | `buttonRightText` | Custom text on the button right of the spinner | String | |
221 | | `buttonStyle` | Button Style (Plus and Minus buttons) | Object | |
222 | | `buttonTextColor` | Custom color of the labels's button of the Spinner | String | `#FFFFFF` |
223 | | `buttonPressTextStyle` | Button Style on Pressed state (Plus and Minus buttons) | Object | | Could overwrite other props |
224 | | `buttonTextStyle` | Button text Style state (Plus and Minus buttons) | Object | | Could overwrite other props |
225 | | `rounded` | Use circular button | Boolean | `true` |
226 |
227 | ### Props Text Input Style
228 |
229 | | Property | Description | Type | Default | Note |
230 | | ------------ | -------------------------------------------------- | ------ | -------------- | ------------------------- |
231 | | `background` | Custom input text background color | String | `transparent` |
232 | | `fontFamily` | Custom fontFamily of the text input of the Spinner | String | System Default |
233 | | `fontSize` | Custom fontSize of the text input of the Spinner | Number | `14` |
234 | | `inputStyle` | Text Input style | Object | | Can overwrite other props |
235 | | `textColor` | Custom input text number color | String | `#000000` |
236 |
237 | ## 🤔 How to contribute
238 |
239 | Have an idea? Found a bug? Please raise to [ISSUES](https://github.com/marcocesarato/react-native-input-spinner/issues).
240 | Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given.
241 |
242 |
243 |
244 |
245 |
246 |
247 |