Skip to content

Commit

Permalink
Fix crash for setEventEmitterCallback NoSuchMethodError on API lvl 26
Browse files Browse the repository at this point in the history
Summary:
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

Differential Revision: D68018506
  • Loading branch information
cortinico authored and facebook-github-bot committed Jan 10, 2025
1 parent fd0894b commit 31fdba7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ public abstract class com/facebook/react/bridge/BaseJavaModule : com/facebook/re
protected final fun getReactApplicationContextIfActiveOrWarn ()Lcom/facebook/react/bridge/ReactApplicationContext;
public fun initialize ()V
public fun invalidate ()V
protected fun setEventEmitterCallback (Lcom/facebook/react/bridge/CxxCallbackImpl;)V
}

public abstract interface class com/facebook/react/bridge/BridgeReactContext$RCTDeviceEventEmitter : com/facebook/react/bridge/JavaScriptModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected final ReactApplicationContext getReactApplicationContext() {
}

@DoNotStrip
private final void setEventEmitterCallback(CxxCallbackImpl eventEmitterCallback) {
protected void setEventEmitterCallback(CxxCallbackImpl eventEmitterCallback) {
mEventEmitterCallback = eventEmitterCallback;
}
}

0 comments on commit 31fdba7

Please sign in to comment.