Skip to content

Commit 7dcbc79

Browse files
cortinicofacebook-github-bot
authored andcommitted
Fix crash for setEventEmitterCallback NoSuchMethodError on API lvl 26 (facebook#48606)
Summary: Pull Request resolved: facebook#48606 Fixes facebook#48009 The app is currently crashing on Android API lvl 26 attempting to invoke the method `setEventEmitterCallback` which is defined inside BaseJavaModule. I'm not entirely sure why this is happening only for API lvl 26, but I've verified that by having the method protected, this doesn't happen anymore. The visibility is consistent with the field `mEventEmitterCallback` which is also protected and accessed to codegen. So let's keep them aligned for consistency. Changelog: [Android] [Fixed] - Fix crash for setEventEmitterCallback NoSuchMethodError on API lvl 26 Reviewed By: cipolleschi Differential Revision: D68018506 fbshipit-source-id: 87eda718c9774b584abdf771eaad5833d452a1ea
1 parent 4c7c836 commit 7dcbc79

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ public abstract class com/facebook/react/bridge/BaseJavaModule : com/facebook/re
608608
protected final fun getReactApplicationContextIfActiveOrWarn ()Lcom/facebook/react/bridge/ReactApplicationContext;
609609
public fun initialize ()V
610610
public fun invalidate ()V
611+
protected fun setEventEmitterCallback (Lcom/facebook/react/bridge/CxxCallbackImpl;)V
611612
}
612613

613614
public abstract interface class com/facebook/react/bridge/BridgeReactContext$RCTDeviceEventEmitter : com/facebook/react/bridge/JavaScriptModule {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ protected final ReactApplicationContext getReactApplicationContext() {
134134
}
135135

136136
@DoNotStrip
137-
private final void setEventEmitterCallback(CxxCallbackImpl eventEmitterCallback) {
137+
protected void setEventEmitterCallback(CxxCallbackImpl eventEmitterCallback) {
138138
mEventEmitterCallback = eventEmitterCallback;
139139
}
140140
}

0 commit comments

Comments
 (0)