-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
Description
If you haven't already, check out our contributing guidelines and patch guidelines for information on how to manage patches.
Patch Information
Library Name: ract-native-performance
Library Version: 5.1.4
Patch Number: 001
Patch Description: fix-soft-crash-by-checking-for-active-react-instance
Full Patch Filename: react-native-performance+5.1.4+001+fix-soft-crash-by-checking-for-active-react-instance.patch
Patch Details
Reason for Patch
react-native-performance
emits some events using RCTDeviceEventEmitter
on Android. Emitter should be used only after react instance has been created.
Otherwise, soft exception is thrown:
```
raiseSoftException(callWithExistingReactInstance(callFunctionOnModule("RCTDeviceEventEmitter", "emit"))): Execute: reactInstance is null. Dropping work.
```
Changes Made
I wrapped code emitting events ⬇️
getReactApplicationContext()
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("mark", params);
with a check for react instance
if (getReactApplicationContext().hasActiveReactInstance()) {
...
}
Upstream Status
Upstream PR/Issue: oblador/react-native-performance#117
Related Information
PR Introducing Patch: #66230
Additional Notes
Checklist
- Patch file is correctly named and placed in the appropriate directory
- Patch is documented in the corresponding
details.md
file - This issue is linked in the
details.md
file - Upstream PR/issue has been created (if applicable)