Skip to content

Commit ec38608

Browse files
authored
fix(#281): incompatibility with RN 0.65+ (#283)
1 parent 5a4ba06 commit ec38608

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

android/src/main/java/com/reactnativecommunity/picker/PickerBlurEvent.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@ public void dispatch(RCTEventEmitter rctEventEmitter) {
2121
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), getEventData());
2222
}
2323

24-
private WritableMap getEventData() {
24+
/**
25+
* In RN version 0.65+ getEventData method is introduced
26+
* https://github.com/facebook/react-native/commit/72d0ddc16f2f631003c3486e0a59e50c145ec613
27+
*
28+
* In order to keep compatibility with 0.65+ and not introduce breaking change for that lib,
29+
* the only change is changing access modifier from `private` to `protected` without using @override annotation
30+
* (idk if it will not bring any "method is hidden, but should overriden" warning, but for now it just works)
31+
*
32+
* In future versions, where `dispatch` method will be removed, there will be need to make a breaking change here
33+
*/
34+
protected WritableMap getEventData() {
2535
WritableMap eventData = Arguments.createMap();
2636
eventData.putInt("target", getViewTag());
2737
return eventData;

android/src/main/java/com/reactnativecommunity/picker/PickerFocusEvent.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@ public void dispatch(RCTEventEmitter rctEventEmitter) {
2121
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), getEventData());
2222
}
2323

24-
private WritableMap getEventData() {
24+
/**
25+
* In RN version 0.65+ getEventData method is introduced
26+
* https://github.com/facebook/react-native/commit/72d0ddc16f2f631003c3486e0a59e50c145ec613
27+
*
28+
* In order to keep compatibility with 0.65+ and not introduce breaking change for that lib,
29+
* the only change is changing access modifier from `private` to `protected` without using @override annotation
30+
* (idk if it will not bring any "method is hidden, but should overriden" warning, but for now it just works)
31+
*
32+
* In future versions, where `dispatch` method will be removed, there will be need to make a breaking change here
33+
*/
34+
protected WritableMap getEventData() {
2535
WritableMap eventData = Arguments.createMap();
2636
eventData.putInt("target", getViewTag());
2737
return eventData;

0 commit comments

Comments
 (0)