Files
react-native/ReactAndroid/src/main
Joshua Gross ac6d1982f4 Re-land: Pass in EventEmitter during View CREATE and Preallocation
Summary:
This is a re-land of D28810022 (https://github.com/facebook/react-native/commit/7e9c741146e1b3aa542ecfe138765e95ddddac3f), which was reverted due to T92179998. The fix is in D28938530. This issue could also be resolved by preventing more view preallocations (D28811419 (https://github.com/facebook/react-native/commit/8ca18f0b602a08cd9a5c9f6681bb5dc74e0d34f7)).

 ---

EventEmitter is not transmitted from C++ to Java until an UPDATE operation is enqueued.

Practically this usually happens "right away", but in the case of an Image component, especially, the EventEmitter could be missing while events are being fired from the native side (for example, loading events).

The fix is just to pass EventEmitter in sooner, in both Create and Preallocate. There should be no ill effect since EventEmitter is nullable anyway.

One potential side-effect: since Views can be PreAllocated and potentially never deallocated until StopSurface is called, this could result in more EventEmitter objects being leaked and retained from Java. I believe the fix is to remove PreAllocated Views more aggressively.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28938637

fbshipit-source-id: c9e290a24ed15c28881e3eead4a5f580f66b288f
2021-06-07 12:16:12 -07:00
..
2021-03-25 11:28:00 -07:00