Skip to content

Commit

Permalink
fix(#281): incompatibility with RN 0.65+ (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz1913 authored Jun 25, 2021
1 parent 5a4ba06 commit ec38608
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ public void dispatch(RCTEventEmitter rctEventEmitter) {
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), getEventData());
}

private WritableMap getEventData() {
/**
* In RN version 0.65+ getEventData method is introduced
* https://github.com/facebook/react-native/commit/72d0ddc16f2f631003c3486e0a59e50c145ec613
*
* In order to keep compatibility with 0.65+ and not introduce breaking change for that lib,
* the only change is changing access modifier from `private` to `protected` without using @override annotation
* (idk if it will not bring any "method is hidden, but should overriden" warning, but for now it just works)
*
* In future versions, where `dispatch` method will be removed, there will be need to make a breaking change here
*/
protected WritableMap getEventData() {
WritableMap eventData = Arguments.createMap();
eventData.putInt("target", getViewTag());
return eventData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ public void dispatch(RCTEventEmitter rctEventEmitter) {
rctEventEmitter.receiveEvent(getViewTag(), getEventName(), getEventData());
}

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

0 comments on commit ec38608

Please sign in to comment.