react-native-wheel-pick 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -20
- package/android/build.gradle +2 -15
- package/android/src/main/AndroidManifest.xml +2 -3
- package/package.json +1 -1
- package/src/date-picker.android.js +1 -1
- package/src/index.d.ts +18 -0
- package/src/picker.js +1 -0
package/README.md
CHANGED
|
@@ -19,9 +19,9 @@ This is not original but inspired by [react-native-wheel-datepicker](https://git
|
|
|
19
19
|
|
|
20
20
|
React Native >= 0.60+
|
|
21
21
|
```
|
|
22
|
-
npm install react-native-wheel-pick --save --legacy-peer-deps
|
|
23
|
-
npm install @react-native-picker/picker --save --legacy-peer-deps
|
|
24
|
-
npm install @react-native-community/datetimepicker --save --legacy-peer-deps
|
|
22
|
+
npm install react-native-wheel-pick --save-dev --legacy-peer-deps
|
|
23
|
+
npm install @react-native-picker/picker --save-dev --legacy-peer-deps
|
|
24
|
+
npm install @react-native-community/datetimepicker --save-dev --legacy-peer-deps
|
|
25
25
|
npx pod-install
|
|
26
26
|
|
|
27
27
|
npx react-native run-ios // re-build native-code
|
|
@@ -52,10 +52,17 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
|
|
|
52
52
|
onDateChange={date => { console.log(date) }}
|
|
53
53
|
/>
|
|
54
54
|
|
|
55
|
+
// for TypeScript
|
|
56
|
+
onValueChange={(value: string) => { console.log(value) }}
|
|
57
|
+
onDateChange={(date: Date) => { console.log(date) }}
|
|
58
|
+
|
|
55
59
|
```
|
|
56
60
|
## More Example
|
|
57
61
|
|
|
58
62
|
```jsx
|
|
63
|
+
// Set Text Color
|
|
64
|
+
<Picker textColor="red" />
|
|
65
|
+
|
|
59
66
|
// DatePicker set default select date
|
|
60
67
|
<DatePicker
|
|
61
68
|
style={{ height: 215, width: 300 }}
|
|
@@ -73,18 +80,19 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
|
|
|
73
80
|
|
|
74
81
|
```
|
|
75
82
|
```jsx
|
|
76
|
-
// pickerData also support array of object.
|
|
83
|
+
// pickerData also support array of object. (Optional Way)
|
|
77
84
|
|
|
78
|
-
// Way
|
|
85
|
+
// Normal Way
|
|
79
86
|
<Picker
|
|
80
87
|
selectedValue='item4'
|
|
81
88
|
pickerData={['item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7']}
|
|
82
89
|
onValueChange={value => { console.log(value) }}
|
|
83
90
|
/>
|
|
84
91
|
|
|
85
|
-
// Optional Way
|
|
92
|
+
// Optional Way
|
|
93
|
+
// `label` only use for show Text to UI.
|
|
94
|
+
// You cannot get `label` from onValueChange
|
|
86
95
|
<Picker
|
|
87
|
-
style={{ backgroundColor: 'white', width: 300, height: 215 }}
|
|
88
96
|
selectedValue='5765387680'
|
|
89
97
|
pickerData={[
|
|
90
98
|
{ value : '5765387677', label : 'item1' },
|
|
@@ -95,7 +103,7 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
|
|
|
95
103
|
{ value : '5765387682', label : 'item6' },
|
|
96
104
|
{ value : '5765387683', label : 'item7' },
|
|
97
105
|
]}
|
|
98
|
-
onValueChange={value => { console.log(value) }}
|
|
106
|
+
onValueChange={value => { console.log(value) }} // '5765387680'
|
|
99
107
|
/>
|
|
100
108
|
```
|
|
101
109
|
```jsx
|
|
@@ -103,7 +111,6 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
|
|
|
103
111
|
// These is special props for Android. (iOS not work)
|
|
104
112
|
// You can also use these props for DatePicker, too.
|
|
105
113
|
<Picker
|
|
106
|
-
textColor='red'
|
|
107
114
|
textSize={20}
|
|
108
115
|
|
|
109
116
|
selectTextColor='green'
|
|
@@ -121,7 +128,27 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
|
|
|
121
128
|
order='D-M-Y' // Default is M-D-Y
|
|
122
129
|
/>
|
|
123
130
|
```
|
|
131
|
+
## FYI
|
|
132
|
+
|
|
133
|
+
I rarely check this lib. (6 Months - 3 Years). Up on my life's time.
|
|
134
|
+
|
|
135
|
+
If you want to pay me coffee for quickly check & merge your request.
|
|
136
|
+
You can sponsor me
|
|
137
|
+
|
|
138
|
+
[](https://github.com/sponsors/TronNatthakorn)
|
|
139
|
+
|
|
140
|
+
OR you can fork this project instead.
|
|
141
|
+
|
|
124
142
|
## Release Note
|
|
143
|
+
### 1.2.2 (June 7 2023)
|
|
144
|
+
[iOS]
|
|
145
|
+
- Now iOS can use `textColor`, too. [Add missing color option for iOS](https://github.com/TronNatthakorn/react-native-wheel-pick/pull/38) [@aurotones](https://github.com/aurotones)
|
|
146
|
+
|
|
147
|
+
### 1.2.1 (June 4 2023)
|
|
148
|
+
- Fix typescript warning
|
|
149
|
+
|
|
150
|
+
[Android]
|
|
151
|
+
- Update compileSDK to version 33.
|
|
125
152
|
|
|
126
153
|
### 1.2.0 (July 3 2022)
|
|
127
154
|
- Remove `deprecated-react-native-prop-types`
|
|
@@ -162,17 +189,6 @@ If you want it back pull request are welcome.
|
|
|
162
189
|
[IOS]
|
|
163
190
|
- Do not use PickerIOS and DatePickerIOS of 'react-native' anymore.
|
|
164
191
|
|
|
165
|
-
## FYI
|
|
166
|
-
|
|
167
|
-
For version 1.1.3 - I update this library support for React Native Version 0.68.2 / Android 11 / iOS 15.2
|
|
168
|
-
|
|
169
|
-
If you use React Native Version less than 0.68.2 / Android older than 11 / iOS older than 15.2.
|
|
170
|
-
It is possible to have unexpected bug.
|
|
171
|
-
|
|
172
|
-
I rarely check this lib. (6 Months - 3 Years). Up on my life's time.
|
|
173
|
-
|
|
174
|
-
If you want to pay me coffee for quickly check & merge your request. Please contact me directly [facebook.com/tron.natthakorn](https://facebook.com/tron.natthakorn) OR you can fork this project.
|
|
175
|
-
|
|
176
192
|
## Preview for version <= 1.12
|
|
177
193
|
|
|
178
194
|

|
package/android/build.gradle
CHANGED
|
@@ -6,22 +6,9 @@ buildscript {
|
|
|
6
6
|
|
|
7
7
|
apply plugin: 'com.android.library'
|
|
8
8
|
|
|
9
|
-
//def safeExtGet(prop, fallback) {
|
|
10
|
-
// rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
11
|
-
//}
|
|
12
|
-
|
|
13
9
|
android {
|
|
14
|
-
compileSdkVersion
|
|
15
|
-
|
|
16
|
-
defaultConfig {
|
|
17
|
-
minSdkVersion 16
|
|
18
|
-
targetSdkVersion 30
|
|
19
|
-
versionCode 1
|
|
20
|
-
versionName "1.0"
|
|
21
|
-
ndk {
|
|
22
|
-
abiFilters "armeabi-v7a", "x86"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
10
|
+
compileSdkVersion 33
|
|
11
|
+
namespace 'com.tron'
|
|
25
12
|
}
|
|
26
13
|
|
|
27
14
|
dependencies {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
|
|
3
|
-
</manifest>
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
</manifest>
|
package/package.json
CHANGED
|
@@ -320,7 +320,7 @@ export default class DatePicker extends PureComponent {
|
|
|
320
320
|
|
|
321
321
|
getValue() {
|
|
322
322
|
const { year, month, date, hour, minute } = this.newValue;
|
|
323
|
-
const nextDate = new Date(year, month, date, hour, minute);
|
|
323
|
+
const nextDate = new Date(Date.UTC(year, month, date, hour, minute));
|
|
324
324
|
|
|
325
325
|
if (nextDate < this.props.minimumDate) {
|
|
326
326
|
return this.props.minimumDate;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import Picker from './picker';
|
|
5
|
+
import DatePicker from './date-picker';
|
|
6
|
+
|
|
7
|
+
let DatePickerComponent = DatePicker;
|
|
8
|
+
|
|
9
|
+
export const registerCustomDatePickerIOS = (CustomDatePickerIOS) => {
|
|
10
|
+
if (Platform.OS === 'ios') {
|
|
11
|
+
DatePickerComponent = CustomDatePickerIOS;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return DatePickerComponent;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Picker;
|
|
18
|
+
export const DatePicker;
|
package/src/picker.js
CHANGED
|
@@ -88,6 +88,7 @@ export default class Picker extends Component {
|
|
|
88
88
|
key={index}
|
|
89
89
|
value={typeof data.value !== 'undefined' ? data.value : data.toString()}
|
|
90
90
|
label={typeof data.label !== 'undefined' ? data.label : data.toString()}
|
|
91
|
+
color={props.textColor}
|
|
91
92
|
/>
|
|
92
93
|
))}
|
|
93
94
|
</WheelCurvedPicker>
|