mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b21a941923
Summary:
Because of the changes made in Fabric, the order of the execution of some methods in ViewManager has changed. In Paper the following order was guaranteed: `createViewInstance -> addEventEmitters -> updateProperties -> onAfterUpdateTransaction`. But in Fabric, the order is the following: `createViewInstance -> updateProperties -> onAfterUpdateTransaction -> addEventEmitters`. This change can actually break some existing view managers, because they rely on the fact that `addEventEmitters` will be called before `onAfterUpdateTransaction`. Check ReactVideoManager:
```
ReactModule(name = ReactVideoManager.REACT_CLASS)
public class ReactVideoManager extends SimpleViewManager<ReactVideoPlayer>
implements VideoManagerInterface<ReactVideoPlayer> {
...
Override
protected void onAfterUpdateTransaction(ReactVideoPlayer view) {
super.onAfterUpdateTransaction(view);
view.commitChanges();
}
Override
protected void addEventEmitters(
final ThemedReactContext reactContext, final ReactVideoPlayer view) {
view.setStateChangedListener(
new ReactVideoPlayer.PlayerStateChangedListener() {
...
}
```
As you can see there is a state change listener registered in `addEventEmitters` and `view.commitChanges()` can actually cause a state change. It means that if `onAfterUpdateTransaction` is executed before `addEventEmitters`, the state change listener will be added after a state change has happened and the event will be missed.
Reviewed By: JoshuaGross
Differential Revision: D17600308
fbshipit-source-id: 044e09e0d64973c8237876311d37c057a1ba384e
Building React Native for Android
See the docs on the website.
Running tests
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see Testing.