react-native-wheel-pick 1.2.2 → 1.2.3
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
|
@@ -24,6 +24,8 @@ npm install @react-native-picker/picker --save-dev --legacy-peer-deps
|
|
|
24
24
|
npm install @react-native-community/datetimepicker --save-dev --legacy-peer-deps
|
|
25
25
|
npx pod-install
|
|
26
26
|
|
|
27
|
+
npx react-native start --reset-cache // clear cache
|
|
28
|
+
|
|
27
29
|
npx react-native run-ios // re-build native-code
|
|
28
30
|
npx react-native run-android // re-build native-code for gradle
|
|
29
31
|
```
|
|
@@ -140,6 +142,15 @@ You can sponsor me
|
|
|
140
142
|
OR you can fork this project instead.
|
|
141
143
|
|
|
142
144
|
## Release Note
|
|
145
|
+
### 1.2.3 (Feb 15 2024)
|
|
146
|
+
- Fix state is not updating after onValueChange in Picker Component. Thanks to [@spasma
|
|
147
|
+
](https://github.com/TronNatthakorn/react-native-wheel-pick/issues/52)
|
|
148
|
+
- Test on React Native Version 0.77
|
|
149
|
+
|
|
150
|
+
[Android]
|
|
151
|
+
- Support [UIManager New Architecture of React Native](https://github.com/reactwg/react-native-new-architecture/discussions/201)
|
|
152
|
+
- Use Handler for fix 23 index problem. Thanks to [@mykhailoperemitko](https://github.com/TronNatthakorn/react-native-wheel-pick/issues/44) [@A-ANing](https://github.com/A-ANing)
|
|
153
|
+
|
|
143
154
|
### 1.2.2 (June 7 2023)
|
|
144
155
|
[iOS]
|
|
145
156
|
- 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)
|
package/android/build.gradle
CHANGED
|
@@ -6,9 +6,25 @@ buildscript {
|
|
|
6
6
|
|
|
7
7
|
apply plugin: 'com.android.library'
|
|
8
8
|
|
|
9
|
+
def isNewArchitectureEnabled() {
|
|
10
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (isNewArchitectureEnabled()) {
|
|
14
|
+
apply plugin: 'com.facebook.react'
|
|
15
|
+
}
|
|
16
|
+
|
|
9
17
|
android {
|
|
10
18
|
compileSdkVersion 33
|
|
11
19
|
namespace 'com.tron'
|
|
20
|
+
|
|
21
|
+
defaultConfig {
|
|
22
|
+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
buildFeatures {
|
|
26
|
+
buildConfig true
|
|
27
|
+
}
|
|
12
28
|
}
|
|
13
29
|
|
|
14
30
|
dependencies {
|
|
@@ -20,6 +20,11 @@ import com.facebook.react.uimanager.events.Event;
|
|
|
20
20
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
21
21
|
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
|
22
22
|
|
|
23
|
+
import com.facebook.react.uimanager.UIManagerHelper;
|
|
24
|
+
|
|
25
|
+
// UIManagerType;
|
|
26
|
+
import com.facebook.react.uimanager.common.UIManagerType;
|
|
27
|
+
|
|
23
28
|
import java.util.Date;
|
|
24
29
|
import java.util.List;
|
|
25
30
|
|
|
@@ -35,7 +40,13 @@ public class ReactWheelCurvedPicker extends WheelPicker {
|
|
|
35
40
|
|
|
36
41
|
public ReactWheelCurvedPicker(ReactContext reactContext) {
|
|
37
42
|
super(reactContext);
|
|
38
|
-
|
|
43
|
+
|
|
44
|
+
if(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
45
|
+
mEventDispatcher = (UIManagerHelper.getUIManager(reactContext, 1 /** UIManagerType */)).getEventDispatcher();
|
|
46
|
+
} else {
|
|
47
|
+
mEventDispatcher = reactContext.getNativeModule(UIManagerModule.class).getEventDispatcher();
|
|
48
|
+
}
|
|
49
|
+
|
|
39
50
|
setOnWheelChangeListener(new OnWheelChangeListener() {
|
|
40
51
|
@Override
|
|
41
52
|
public void onWheelScrolled(int offset) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.tron;
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color;
|
|
4
|
+
import android.os.Handler;
|
|
4
5
|
|
|
5
6
|
import com.aigestudio.wheelpicker.WheelPicker;
|
|
6
7
|
import com.facebook.react.bridge.ReadableArray;
|
|
@@ -84,8 +85,18 @@ public class ReactWheelCurvedPickerManager extends SimpleViewManager<ReactWheelC
|
|
|
84
85
|
//if (picker != null && picker.getState() == WheelPicker.SCROLL_STATE_IDLE) {
|
|
85
86
|
// Log.d("Index from React", index + "");
|
|
86
87
|
if (picker != null) {
|
|
87
|
-
picker.setSelectedItemPosition(index);
|
|
88
|
-
picker.invalidate();
|
|
88
|
+
// picker.setSelectedItemPosition(index);
|
|
89
|
+
// picker.invalidate();
|
|
90
|
+
|
|
91
|
+
final Handler handler = new Handler();
|
|
92
|
+
|
|
93
|
+
handler.post(new Runnable() {
|
|
94
|
+
@Override
|
|
95
|
+
public void run() {
|
|
96
|
+
picker.setSelectedItemPosition(index);
|
|
97
|
+
picker.invalidate();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
89
100
|
}
|
|
90
101
|
}
|
|
91
102
|
|
package/package.json
CHANGED
package/src/picker.js
CHANGED
|
@@ -45,6 +45,12 @@ export default class Picker extends Component {
|
|
|
45
45
|
this.props.onValueChange(selectedValue);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
componentDidUpdate(prevProps) {
|
|
49
|
+
if (prevProps.selectedValue !== this.props.selectedValue) {
|
|
50
|
+
this.setState({ selectedValue: this.props.selectedValue });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
validateDeprecateProps = (oldProp = 'curtain', newProp = '') => {
|
|
49
55
|
if(this.props){
|
|
50
56
|
if(typeof this.props[oldProp] !== 'undefined'){
|