react-native/Libraries
Krzysztof Magiera c5cbd0f64a Fix native animated style and transform node to call __makeNative once all the children are converted to native nodes (#20658)
Summary:
This PR fixes an issue I have found while playing with native animated driver nodes.

I discovered the bug when using animated views that have both animated props and styles. See this snack to see an example: https://snack.expo.io/B17SFXy8Q

In that example we set `opacity` and `style` props which both contain animated props. This is not an usual way to do that, as normally you would place `opacity` inside the `styles` in which case the bug won't surface. But this is only done for demo purposes and in practice the problem will occur if you have a custom native view that exposes props that are not styles and can be animated.

In the above example you get this error:

> Invariant Violation: Attempt to get native tag from node not marked as "native"

When `opacity` is moved into `styles` container the problem no longer occurs.

The problem turned out to be related to the initialization code responsible for creating native animated nodes. In all subclasses of `AnimatedWithChildren` (like `AimatedAddition`) we only call `super.__makeNative` after we call `__makeNative` method on the child nodes. This order was reversed in `AnimatedStyle` and `AnimatedTransform`. As a result when `super.__makeNative` is called in `AnimatedStyle`, we try to call `__getNativeTag` on children nodes not yet marked as native which results in the error described above ("Attempt to get native tag...").

We should instead follow the order of calling `super.__makeNative` that is used in the remaining subclasses of `AnimatedWithChildren`. Such that all the children nodes are first converted to native prior to calling superclass method. This is what this PR is changing.
Pull Request resolved: https://github.com/facebook/react-native/pull/20658

Differential Revision: D9297191

Pulled By: hramos

fbshipit-source-id: f5e394fb259ff514c7c1433edcb5fc89203f55e2
2018-08-13 10:18:18 -07:00
..
ART RN: Move ART Canvas Workaround 2018-07-19 19:02:13 -07:00
ActionSheetIOS Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Alert Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Animated Fix native animated style and transform node to call __makeNative once all the children are converted to native nodes (#20658) 2018-08-13 10:18:18 -07:00
AppState Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
BatchedBridge Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Blob Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
BugReporting Flow strictify possible files in RN core 2018-06-20 00:47:21 -07:00
CameraRoll Fix for crash when height or width is nil (#20454) 2018-07-30 11:17:08 -07:00
Color Bump Prettier to 1.13.4 on xplat 2018-06-06 05:32:06 -07:00
Components Ensure WebViews render about:blank correctly 2018-08-13 10:18:17 -07:00
Core Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
EventEmitter Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Experimental Fix bug rows doesn't close on scroll in a SwipeableFlatList (#18001) 2018-08-10 14:02:10 -07:00
Geolocation Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Image Check return code from malloc (#20173) 2018-08-08 18:32:19 -07:00
Inspector Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Interaction Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
JSInspector Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
LayoutAnimation Remove @providesModule from all modules 2018-04-25 07:37:10 -07:00
Linking Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
LinkingIOS Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Lists Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Modal Switch to Platform.isTV to pass Android Flow 2018-06-10 13:45:57 -07:00
NativeAnimation Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
Network Check return code from malloc (#20173) 2018-08-08 18:32:19 -07:00
Performance Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
PermissionsAndroid Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
PushNotificationIOS Update Xcode projects (#19574) 2018-06-19 23:48:12 -07:00
RCTTest iOS: prevent nativemodule access from JS if bridge is no longer valid 2018-08-09 12:17:07 -07:00
ReactNative Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Renderer Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Sample Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Settings Replace '@flow strict(-local)' with '@flow' in .android.js files 2018-08-08 10:48:19 -07:00
Share Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
Storage Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
StyleSheet Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
SurfaceBackedComponent Fabric: `bridge` prop was removed from RCTSurface interface 2018-08-01 15:32:01 -07:00
SurfaceHostingComponent Update license headers for MIT license 2018-02-16 18:31:53 -08:00
Text Exposed scrollEnabled on TextInput (#19330) 2018-08-08 18:46:53 -07:00
Types RN: Revamp Switch Component 2018-07-31 21:01:41 -07:00
Utilities Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
Vibration Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
WebSocket - Correct fishhook import in RCTReconnectingWebSocket Fixes #16039 (#16271) 2018-06-28 11:49:32 -07:00
Wrapper Update additional license headers 2018-03-08 12:10:14 -08:00
YellowBox Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
fishhook Merge fishhook.xcodeproj in RCTWebSocket 2017-08-09 07:48:09 -07:00
polyfills fix missing prettier file (#20001) 2018-07-02 10:48:06 -07:00
react-native Flow strictify possible files in RN core 2018-06-20 00:47:21 -07:00
vendor Add flow strict typing to isEmpty 2018-08-09 10:47:58 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Prettier React Native Libraries 2018-05-10 19:10:38 -07:00
UTFSequence.js Adding flow strict local to remaining possible files in xplat/JS 2018-08-09 08:54:44 -07:00
promiseRejectionIsError.js Prettier React Native Libraries 2018-05-10 19:10:38 -07:00