react-native-wheel-pick 1.1.9 → 1.2.1

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 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
24
- npm install @react-native-community/datetimepicker --save
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,6 +52,10 @@ 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
 
@@ -73,7 +77,7 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
73
77
 
74
78
  ```
75
79
  ```jsx
76
- // pickerData also support array of object.
80
+ // pickerData also support array of object. (Optional)
77
81
 
78
82
  // Way 1
79
83
  <Picker
@@ -83,6 +87,8 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
83
87
  />
84
88
 
85
89
  // Optional Way 2
90
+ // `label` only use for show Text to UI.
91
+ // You cannot get `label` from onValueChange
86
92
  <Picker
87
93
  style={{ backgroundColor: 'white', width: 300, height: 215 }}
88
94
  selectedValue='5765387680'
@@ -95,7 +101,7 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
95
101
  { value : '5765387682', label : 'item6' },
96
102
  { value : '5765387683', label : 'item7' },
97
103
  ]}
98
- onValueChange={value => { console.log(value) }}
104
+ onValueChange={value => { console.log(value) }} // '5765387680'
99
105
  />
100
106
  ```
101
107
  ```jsx
@@ -121,9 +127,27 @@ import { Picker, DatePicker } from 'react-native-wheel-pick';
121
127
  order='D-M-Y' // Default is M-D-Y
122
128
  />
123
129
  ```
130
+ ## FYI
131
+
132
+ I rarely check this lib. (6 Months - 3 Years). Up on my life's time.
133
+
134
+ If you want to pay me coffee for quickly check & merge your request.
135
+ You can sponsor me
136
+
137
+ [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/TronNatthakorn)
138
+
139
+ OR you can fork this project instead.
140
+
124
141
  ## Release Note
125
142
 
126
- ### 1.1.9 (July 3 2022)
143
+ ### 1.2.1 (June 4 2023)
144
+ - Fix typescript warning
145
+
146
+ [Android]
147
+ - Update compileSDK to version 33.
148
+
149
+ ### 1.2.0 (July 3 2022)
150
+ - Remove `deprecated-react-native-prop-types`
127
151
  - Support for peer dependencies React 18 by `--legacy-peer-deps`
128
152
 
129
153
  ### 1.1.7 (June 21 2022)
@@ -161,17 +185,6 @@ If you want it back pull request are welcome.
161
185
  [IOS]
162
186
  - Do not use PickerIOS and DatePickerIOS of 'react-native' anymore.
163
187
 
164
- ## FYI
165
-
166
- For version 1.1.3 - I update this library support for React Native Version 0.68.2 / Android 11 / iOS 15.2
167
-
168
- If you use React Native Version less than 0.68.2 / Android older than 11 / iOS older than 15.2.
169
- It is possible to have unexpected bug.
170
-
171
- I rarely check this lib. (6 Months - 3 Years). Up on my life's time.
172
-
173
- 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.
174
-
175
188
  ## Preview for version <= 1.12
176
189
 
177
190
  ![](https://preview.ibb.co/iUjDZo/screen1.png)
@@ -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 30
15
- /// buildToolsVersion '30.0.2'
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
- package="com.tron">
3
- </manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wheel-pick",
3
- "version": "1.1.9",
3
+ "version": "1.2.1",
4
4
  "description": "React native wheel picker iOS style with android.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -22,10 +22,12 @@
22
22
  "url": "https://github.com/TronNatthakorn/react-native-wheel-pick/issues"
23
23
  },
24
24
  "homepage": "https://github.com/TronNatthakorn/react-native-wheel-pick#readme",
25
+ "dependencies": {
26
+ "moment": "^2.19.1"
27
+ },
25
28
  "peerDependencies": {
26
29
  "moment": ">=2.0.0",
27
30
  "prop-types": "*",
28
- "deprecated-react-native-prop-types": ">=2.3.0",
29
31
  "@react-native-community/datetimepicker": ">=6.1.3",
30
32
  "@react-native-picker/picker": ">=2.4.1"
31
33
  }
@@ -1,9 +1,9 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { requireNativeComponent, View } from 'react-native';
3
- import { ColorPropType, ViewPropTypes as RNViewPropTypes, } from 'deprecated-react-native-prop-types'
3
+ // import { ColorPropType, ViewPropTypes as RNViewPropTypes, } from 'deprecated-react-native-prop-types'
4
4
  import PropTypes from 'prop-types';
5
5
 
6
- const ViewPropTypes = RNViewPropTypes || View.propTypes;
6
+ // const ViewPropTypes = RNViewPropTypes || View.propTypes;
7
7
  let firstTimeOnChange = true
8
8
 
9
9
  const stateFromProps = (props) => {
@@ -22,9 +22,9 @@ const stateFromProps = (props) => {
22
22
 
23
23
  class WheelCurvedPicker extends PureComponent {
24
24
  static propTypes = {
25
- ...ViewPropTypes,
25
+ // ...ViewPropTypes,
26
26
  data: PropTypes.array,
27
- textColor: ColorPropType,
27
+ // textColor: ColorPropType,
28
28
  textSize: PropTypes.number,
29
29
  onValueChange: PropTypes.func.isRequired,
30
30
  selectedValue: PropTypes.any,
@@ -1,11 +1,11 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
- import { ColorPropType, ViewPropTypes as RNViewPropTypes } from 'deprecated-react-native-prop-types'
3
+ // import { ColorPropType, ViewPropTypes as RNViewPropTypes } from 'deprecated-react-native-prop-types'
4
4
  import PropTypes from 'prop-types';
5
5
  import moment from 'moment';
6
6
  import Picker from './picker';
7
7
 
8
- const ViewPropTypes = RNViewPropTypes || View.propTypes;
8
+ // const ViewPropTypes = RNViewPropTypes || View.propTypes;
9
9
  const firstTimeOnChange = {
10
10
  year: true,
11
11
  month: true,
@@ -42,8 +42,8 @@ export default class DatePicker extends PureComponent {
42
42
  minimumDate: PropTypes.instanceOf(Date),
43
43
  mode: PropTypes.oneOf(['date', 'time', 'datetime']),
44
44
  onDateChange: PropTypes.func.isRequired,
45
- style: ViewPropTypes.style,
46
- textColor: ColorPropType,
45
+ // style: ViewPropTypes.style,
46
+ // textColor: ColorPropType,
47
47
  textSize: PropTypes.number,
48
48
  };
49
49
 
@@ -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
@@ -1,11 +1,10 @@
1
1
  import React, { Component } from 'react';
2
2
  import { StyleSheet, View, Text, Platform } from 'react-native';
3
- import { ColorPropType, ViewPropTypes as RNViewPropTypes, } from 'deprecated-react-native-prop-types'
3
+ // import { ColorPropType, ViewPropTypes as RNViewPropTypes, } from 'deprecated-react-native-prop-types'
4
4
  import PropTypes from 'prop-types';
5
5
  import WheelCurvedPicker from './WheelCurvedPicker';
6
6
 
7
- const ViewPropTypes = RNViewPropTypes || View.propTypes;
8
-
7
+ // const ViewPropTypes = RNViewPropTypes || View.propTypes;
9
8
  const PickerItem = WheelCurvedPicker.Item;
10
9
 
11
10
  const styles = StyleSheet.create({
@@ -18,12 +17,12 @@ const styles = StyleSheet.create({
18
17
 
19
18
  export default class Picker extends Component {
20
19
  static propTypes = {
21
- textColor: ColorPropType,
20
+ // textColor: ColorPropType,
22
21
  textSize: PropTypes.number,
23
- itemStyle: ViewPropTypes.style,
22
+ // itemStyle: ViewPropTypes.style,
24
23
  onValueChange: PropTypes.func.isRequired,
25
24
  pickerData: PropTypes.array.isRequired,
26
- style: ViewPropTypes.style,
25
+ // style: ViewPropTypes.style,
27
26
  selectedValue: PropTypes.any,
28
27
  };
29
28