react-native 0.0.0-263478b91 → 0.0.0-268efb102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (866) hide show
  1. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +14 -1
  2. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +2 -0
  3. package/Libraries/Animated/AnimatedEvent.js +23 -4
  4. package/Libraries/Animated/AnimatedMock.js +1 -7
  5. package/Libraries/Animated/NativeAnimatedHelper.js +3 -3
  6. package/Libraries/Animated/animations/Animation.js +1 -0
  7. package/Libraries/Animated/animations/DecayAnimation.js +2 -0
  8. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  9. package/Libraries/Animated/animations/TimingAnimation.js +3 -0
  10. package/Libraries/Animated/createAnimatedComponent.js +5 -1
  11. package/Libraries/Animated/createAnimatedComponentInjection.js +48 -0
  12. package/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +48 -0
  13. package/Libraries/Animated/nodes/AnimatedValue.js +6 -0
  14. package/Libraries/Animated/nodes/AnimatedWithChildren.js +1 -0
  15. package/Libraries/Animated/useAnimatedProps.js +211 -0
  16. package/Libraries/BatchedBridge/MessageQueue.js +15 -10
  17. package/Libraries/BatchedBridge/NativeModules.js +5 -1
  18. package/Libraries/Blob/FileReader.js +1 -1
  19. package/Libraries/Blob/RCTBlobManager.h +2 -1
  20. package/Libraries/Blob/RCTBlobManager.mm +1 -3
  21. package/Libraries/Blob/React-RCTBlob.podspec +1 -1
  22. package/Libraries/Blob/URL.js +1 -1
  23. package/Libraries/BugReporting/BugReporting.js +2 -0
  24. package/Libraries/BugReporting/getReactData.js +1 -1
  25. package/Libraries/Components/Button.js +18 -2
  26. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +3 -6
  27. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -7
  28. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +1 -1
  29. package/Libraries/Components/Pressable/useAndroidRippleForView.js +18 -15
  30. package/Libraries/Components/ScrollView/ScrollView.js +22 -5
  31. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +1 -0
  32. package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +2 -0
  33. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +268 -252
  34. package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +2 -0
  35. package/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +14 -6
  36. package/Libraries/Components/Slider/Slider.js +13 -1
  37. package/Libraries/Components/StatusBar/StatusBar.js +6 -14
  38. package/Libraries/Components/Switch/Switch.js +18 -6
  39. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +4 -4
  40. package/Libraries/Components/TextInput/AndroidTextInputViewConfig.js +1 -0
  41. package/Libraries/Components/TextInput/TextInput.js +32 -4
  42. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  43. package/Libraries/Components/Touchable/Touchable.js +14 -0
  44. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  45. package/Libraries/Components/Touchable/TouchableOpacity.js +11 -2
  46. package/Libraries/Components/View/ReactNativeStyleAttributes.js +131 -64
  47. package/Libraries/Components/View/ViewAccessibility.js +2 -0
  48. package/Libraries/Components/View/ViewNativeComponent.js +0 -10
  49. package/Libraries/Core/Devtools/parseErrorStack.js +0 -10
  50. package/Libraries/Core/Devtools/parseHermesStack.js +1 -1
  51. package/Libraries/Core/ExceptionsManager.js +49 -39
  52. package/Libraries/{Components/View/ViewInjection.js → Core/ExtendedError.js} +8 -2
  53. package/Libraries/Core/ReactFiberErrorDialog.js +44 -34
  54. package/Libraries/Core/ReactNativeVersion.js +1 -1
  55. package/Libraries/Core/Timers/JSTimers.js +37 -28
  56. package/Libraries/Core/Timers/immediateShim.js +67 -0
  57. package/Libraries/Core/Timers/queueMicrotask.js +41 -0
  58. package/Libraries/Core/polyfillPromise.js +1 -1
  59. package/Libraries/Core/setUpBatchedBridge.js +1 -1
  60. package/Libraries/Core/setUpGlobals.js +2 -0
  61. package/Libraries/Core/setUpRegeneratorRuntime.js +25 -8
  62. package/Libraries/Core/setUpTimers.js +65 -6
  63. package/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js +131 -0
  64. package/Libraries/DeprecatedPropTypes/{DeprecatedImagePropType.js → DeprecatedImagePropType.ios.js} +0 -0
  65. package/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js +5 -5
  66. package/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js +1 -0
  67. package/Libraries/EventEmitter/NativeEventEmitter.js +2 -0
  68. package/Libraries/Image/Image.android.js +20 -130
  69. package/Libraries/Image/Image.ios.js +12 -7
  70. package/Libraries/Image/ImageBackground.js +10 -8
  71. package/Libraries/Image/ImageInjection.js +28 -0
  72. package/Libraries/Image/ImageProps.js +28 -0
  73. package/Libraries/Image/ImageSource.js +108 -65
  74. package/Libraries/Image/React-RCTImage.podspec +1 -1
  75. package/Libraries/Inspector/Inspector.js +6 -0
  76. package/Libraries/Interaction/InteractionManager.js +3 -0
  77. package/Libraries/Interaction/PanResponder.js +1 -1
  78. package/Libraries/LinkingIOS/React-RCTLinking.podspec +1 -1
  79. package/Libraries/Lists/CellRenderMask.js +145 -0
  80. package/Libraries/Lists/FlatList.js +43 -26
  81. package/Libraries/Lists/VirtualizedList.js +3 -1
  82. package/Libraries/Lists/VirtualizedSectionList.js +3 -0
  83. package/Libraries/Lists/__flowtests__/SectionList-flowtest.js +4 -4
  84. package/Libraries/LogBox/Data/LogBoxData.js +21 -19
  85. package/Libraries/LogBox/UI/LogBoxImages/alert-triangle.png +0 -0
  86. package/Libraries/LogBox/UI/LogBoxImages/chevron-left.png +0 -0
  87. package/Libraries/LogBox/UI/LogBoxImages/chevron-right.png +0 -0
  88. package/Libraries/LogBox/UI/LogBoxImages/close.png +0 -0
  89. package/Libraries/LogBox/UI/LogBoxImages/loader.png +0 -0
  90. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +1 -0
  91. package/Libraries/Modal/Modal.js +1 -0
  92. package/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m +0 -3
  93. package/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm +6 -3
  94. package/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h +1 -1
  95. package/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m +1 -1
  96. package/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm +32 -28
  97. package/Libraries/NativeAnimation/React-RCTAnimation.podspec +1 -1
  98. package/Libraries/Network/RCTHTTPRequestHandler.h +5 -0
  99. package/Libraries/Network/RCTHTTPRequestHandler.mm +19 -7
  100. package/Libraries/Network/React-RCTNetwork.podspec +1 -1
  101. package/Libraries/Network/XMLHttpRequest.js +4 -1
  102. package/Libraries/NewAppScreen/components/Header.js +1 -0
  103. package/Libraries/NewAppScreen/components/logo.png +0 -0
  104. package/Libraries/Performance/QuickPerformanceLogger.js +3 -1
  105. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +4 -1
  106. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +6 -0
  107. package/Libraries/Pressability/Pressability.js +1 -0
  108. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -0
  109. package/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +0 -1
  110. package/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +1 -1
  111. package/Libraries/ReactNative/AppContainer.js +1 -0
  112. package/Libraries/ReactNative/AppRegistry.js +3 -1
  113. package/Libraries/ReactNative/I18nManager.js +12 -3
  114. package/Libraries/ReactNative/PaperUIManager.js +1 -0
  115. package/Libraries/ReactNative/renderApplication.js +8 -3
  116. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +2 -3
  117. package/Libraries/Reliability/UserFlow.js +7 -0
  118. package/Libraries/Renderer/REVISION +1 -1
  119. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +5686 -4572
  120. package/Libraries/Renderer/implementations/ReactFabric-dev.js +4324 -3826
  121. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +2196 -1859
  122. package/Libraries/Renderer/implementations/ReactFabric-prod.js +196 -210
  123. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +2694 -2070
  124. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +647 -375
  125. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +5474 -4460
  126. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4109 -3636
  127. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +1375 -1166
  128. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +162 -193
  129. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +2197 -1708
  130. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +618 -364
  131. package/Libraries/Renderer/shims/ReactFabric.js +5 -4
  132. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
  133. package/Libraries/Renderer/shims/ReactNative.js +3 -1
  134. package/Libraries/Renderer/shims/ReactNativeTypes.js +7 -4
  135. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  136. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
  137. package/Libraries/Settings/React-RCTSettings.podspec +1 -1
  138. package/Libraries/Settings/Settings.ios.js +4 -0
  139. package/Libraries/Storage/AsyncStorage.js +1 -0
  140. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +16 -1
  141. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +8 -1
  142. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +2 -0
  143. package/Libraries/StyleSheet/StyleSheet.js +3 -5
  144. package/Libraries/StyleSheet/normalizeColor.js +2 -2
  145. package/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.mm +1 -1
  146. package/Libraries/Text/Text.js +11 -0
  147. package/Libraries/Text/TextInput/RCTBaseTextInputView.m +10 -12
  148. package/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m +4 -11
  149. package/Libraries/Text/TextProps.js +5 -7
  150. package/Libraries/TurboModule/TurboModuleRegistry.js +1 -10
  151. package/Libraries/TypeSafety/RCTTypeSafety.podspec +1 -1
  152. package/Libraries/UTFSequence.js +1 -1
  153. package/Libraries/Utilities/Dimensions.js +9 -14
  154. package/Libraries/Utilities/FeatureDetection.js +31 -0
  155. package/Libraries/Utilities/HMRClient.js +13 -6
  156. package/Libraries/Utilities/MatrixMath.js +1 -1
  157. package/Libraries/Utilities/NativeDeviceInfo.js +1 -1
  158. package/Libraries/Utilities/PerformanceLoggerContext.js +1 -1
  159. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +1 -0
  160. package/Libraries/Utilities/deprecatedPropType.js +2 -2
  161. package/Libraries/Utilities/useMergeRefs.js +44 -0
  162. package/Libraries/Utilities/useRefEffect.js +45 -0
  163. package/Libraries/Utilities/useWindowDimensions.js +7 -2
  164. package/Libraries/Vibration/React-RCTVibration.podspec +1 -1
  165. package/Libraries/YellowBox/YellowBoxDeprecated.js +1 -0
  166. package/Libraries/promiseRejectionTrackingOptions.js +2 -0
  167. package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +1 -1
  168. package/README.md +5 -5
  169. package/React/Base/RCTAssert.h +11 -11
  170. package/React/Base/RCTBridge+Private.h +8 -2
  171. package/React/Base/RCTBridge.h +12 -3
  172. package/React/Base/RCTBridge.m +24 -12
  173. package/React/Base/RCTBridgeModule.h +36 -12
  174. package/React/Base/RCTBundleURLProvider.h +26 -1
  175. package/React/Base/RCTBundleURLProvider.mm +79 -15
  176. package/React/Base/RCTCallableJSModules.m +47 -0
  177. package/React/Base/RCTConstants.h +6 -7
  178. package/React/Base/RCTConstants.m +12 -12
  179. package/React/Base/RCTConvert.h +1 -1
  180. package/React/Base/RCTConvert.m +31 -7
  181. package/React/Base/RCTCxxConvert.h +1 -1
  182. package/React/Base/RCTDefines.h +12 -3
  183. package/React/Base/RCTEventDispatcherProtocol.h +3 -2
  184. package/React/{Views/RCTPickerManager.h → Base/RCTInitializing.h} +4 -2
  185. package/React/Base/RCTJSThread.h +29 -0
  186. package/React/Base/RCTJSThread.m +19 -0
  187. package/React/Base/RCTModuleData.h +7 -3
  188. package/React/Base/RCTModuleData.mm +41 -1
  189. package/React/Base/RCTMultipartStreamReader.m +0 -2
  190. package/React/Base/RCTRootView.h +15 -0
  191. package/React/Base/RCTRootView.m +15 -0
  192. package/React/Base/RCTTouchHandler.m +4 -9
  193. package/React/Base/RCTUtils.h +3 -0
  194. package/React/Base/RCTUtils.m +14 -7
  195. package/React/Base/RCTVersion.m +1 -1
  196. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h +12 -0
  197. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +45 -1
  198. package/React/CoreModules/BUCK +4 -3
  199. package/React/CoreModules/RCTAccessibilityManager.mm +1 -1
  200. package/React/CoreModules/RCTActionSheetManager.mm +14 -5
  201. package/React/CoreModules/RCTAsyncLocalStorage.mm +4 -0
  202. package/React/CoreModules/RCTDevLoadingView.mm +6 -21
  203. package/React/CoreModules/RCTDevMenu.mm +8 -11
  204. package/React/CoreModules/RCTDevSettings.h +2 -1
  205. package/React/CoreModules/RCTDevSettings.mm +63 -53
  206. package/React/CoreModules/RCTDevSplitBundleLoader.mm +1 -6
  207. package/React/CoreModules/RCTDeviceInfo.mm +4 -4
  208. package/React/CoreModules/RCTEventDispatcher.h +2 -1
  209. package/React/CoreModules/RCTEventDispatcher.mm +17 -28
  210. package/React/CoreModules/RCTKeyboardObserver.mm +1 -1
  211. package/React/CoreModules/RCTLogBox.mm +14 -10
  212. package/React/CoreModules/RCTPerfMonitor.mm +9 -4
  213. package/React/CoreModules/RCTRedBox.mm +1 -5
  214. package/React/CoreModules/RCTTiming.h +2 -1
  215. package/React/CoreModules/RCTTiming.mm +1 -3
  216. package/React/CoreModules/React-CoreModules.podspec +1 -1
  217. package/React/CxxBridge/RCTCxxBridge.mm +49 -12
  218. package/React/DevSupport/RCTPackagerConnection.h +3 -0
  219. package/React/DevSupport/RCTPackagerConnection.mm +19 -8
  220. package/React/FBReactNativeSpec/FBReactNativeSpec.podspec +12 -4
  221. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +1 -2
  222. package/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h +0 -1
  223. package/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm +0 -1
  224. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +97 -85
  225. package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +1 -0
  226. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +45 -17
  227. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +6 -0
  228. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +109 -5
  229. package/React/Fabric/Mounting/RCTComponentViewFactory.mm +1 -0
  230. package/React/Fabric/Mounting/RCTMountingManager.h +3 -0
  231. package/React/Fabric/Mounting/RCTMountingManager.mm +22 -3
  232. package/React/Fabric/Mounting/UIView+ComponentViewProtocol.h +2 -0
  233. package/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +12 -0
  234. package/React/Fabric/RCTConversions.h +3 -0
  235. package/React/Fabric/RCTScheduler.mm +23 -7
  236. package/React/Fabric/RCTSurfacePresenter.mm +28 -37
  237. package/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +4 -2
  238. package/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm +1 -1
  239. package/React/Fabric/RCTSurfaceRegistry.h +1 -1
  240. package/React/Fabric/RCTSurfaceTouchHandler.mm +6 -20
  241. package/React/Fabric/Surface/RCTFabricSurface.mm +3 -0
  242. package/React/Modules/RCTEventEmitter.h +1 -2
  243. package/React/Modules/RCTEventEmitter.m +8 -11
  244. package/React/Modules/RCTI18nUtil.h +14 -6
  245. package/React/Modules/RCTI18nUtil.m +1 -47
  246. package/React/Profiler/RCTProfileTrampoline-arm.S +1 -1
  247. package/React/Profiler/RCTProfileTrampoline-arm64.S +2 -2
  248. package/React/React-RCTFabric.podspec +3 -3
  249. package/React/Views/RCTFont.mm +54 -38
  250. package/React/Views/RCTModalHostView.h +1 -1
  251. package/React/Views/RCTModalHostView.m +16 -0
  252. package/React/Views/RCTModalHostViewManager.m +1 -0
  253. package/React/Views/RCTView.h +7 -7
  254. package/React/Views/RCTView.m +32 -49
  255. package/React/Views/RCTViewManager.m +14 -4
  256. package/React/Views/SafeAreaView/RCTSafeAreaView.m +1 -5
  257. package/React/Views/ScrollView/RCTScrollView.h +1 -0
  258. package/React/Views/ScrollView/RCTScrollView.m +123 -36
  259. package/React/Views/ScrollView/RCTScrollViewManager.m +4 -7
  260. package/React/Views/UIView+React.m +2 -11
  261. package/React/third-party.xcconfig +1 -1
  262. package/React-Core.podspec +2 -2
  263. package/ReactAndroid/Android-prebuilt.mk +8 -0
  264. package/ReactAndroid/README.md +1 -1
  265. package/ReactAndroid/build.gradle +82 -18
  266. package/ReactAndroid/gradle.properties +5 -5
  267. package/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK +1 -1
  268. package/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java +1 -1
  269. package/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/BUCK +1 -1
  270. package/ReactAndroid/src/androidTest/java/com/facebook/react/testing/rule/BUCK +5 -5
  271. package/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK +0 -2
  272. package/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/BUCK +5 -5
  273. package/ReactAndroid/src/androidTest/js/BUCK +26 -0
  274. package/ReactAndroid/src/androidTest/js/TestBundle.js +0 -12
  275. package/ReactAndroid/src/main/java/com/facebook/hermes/instrumentation/Android.mk +2 -2
  276. package/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/Android.mk +4 -4
  277. package/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.java +1 -1
  278. package/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/RuntimeConfig.java +0 -6
  279. package/ReactAndroid/src/main/java/com/facebook/proguard/annotations/BUCK +2 -2
  280. package/ReactAndroid/src/main/java/com/facebook/react/BUCK +1 -0
  281. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +1 -0
  282. package/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.java +5 -0
  283. package/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.java +6 -2
  284. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +123 -64
  285. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +28 -0
  286. package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +13 -0
  287. package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +25 -3
  288. package/ReactAndroid/src/main/java/com/facebook/react/animated/BUCK +1 -1
  289. package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +2 -2
  290. package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java +5 -5
  291. package/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java +3 -2
  292. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +4 -0
  293. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +11 -5
  294. package/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java +37 -0
  295. package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.java +22 -0
  296. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +3 -6
  297. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java +1 -1
  298. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCxxErrorHandler.java +39 -0
  299. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java +3 -1
  300. package/ReactAndroid/src/main/java/com/facebook/react/bridge/{ReactSoftException.java → ReactSoftExceptionLogger.java} +8 -3
  301. package/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeScheduler.java +21 -0
  302. package/ReactAndroid/src/main/java/com/facebook/react/bridge/SoftAssertions.java +8 -7
  303. package/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java +10 -0
  304. package/ReactAndroid/src/main/java/com/facebook/react/common/BUCK +2 -2
  305. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/BUCK +3 -0
  306. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.java +1 -2
  307. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBufferSoLoader.java +33 -0
  308. package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/BUCK +1 -1
  309. package/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +40 -36
  310. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BUCK +1 -1
  311. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java +275 -0
  312. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.java +97 -0
  313. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java +9 -58
  314. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +163 -328
  315. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java +3 -72
  316. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.java +100 -0
  317. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java +1 -1
  318. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java +1 -1
  319. package/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java +10 -0
  320. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricComponents.java +4 -3
  321. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java +6 -67
  322. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +154 -74
  323. package/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.java +36 -1
  324. package/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.java +14 -2
  325. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk +2 -2
  326. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK +1 -2
  327. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +129 -40
  328. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +18 -2
  329. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp +0 -6
  330. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp +22 -2
  331. package/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h +4 -0
  332. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java +53 -7
  333. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +27 -7
  334. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +136 -35
  335. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java +2 -1
  336. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java +5 -5
  337. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.java +2 -2
  338. package/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk +2 -2
  339. package/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java +2 -2
  340. package/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/BUCK +1 -1
  341. package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/BUCK +1 -1
  342. package/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/BUCK +1 -1
  343. package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BUCK +1 -1
  344. package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobProvider.java +35 -7
  345. package/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/Android.mk +2 -2
  346. package/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/BUCK +1 -1
  347. package/ReactAndroid/src/main/java/com/facebook/react/modules/camera/BUCK +1 -1
  348. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/BUCK +1 -1
  349. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/{JavaScriptTimerManager.java → JavaScriptTimerExecutor.java} +1 -1
  350. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java +7 -7
  351. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java +2 -2
  352. package/ReactAndroid/src/main/java/com/facebook/react/modules/debug/BUCK +1 -1
  353. package/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/BUCK +1 -1
  354. package/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java +10 -6
  355. package/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/BUCK +1 -1
  356. package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/BUCK +1 -1
  357. package/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.java +7 -1
  358. package/ReactAndroid/src/main/java/com/facebook/react/modules/image/BUCK +1 -1
  359. package/ReactAndroid/src/main/java/com/facebook/react/modules/intent/BUCK +1 -1
  360. package/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java +23 -19
  361. package/ReactAndroid/src/main/java/com/facebook/react/modules/network/BUCK +1 -1
  362. package/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java +1 -4
  363. package/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/BUCK +1 -1
  364. package/ReactAndroid/src/main/java/com/facebook/react/modules/share/BUCK +1 -1
  365. package/ReactAndroid/src/main/java/com/facebook/react/modules/sound/BUCK +1 -1
  366. package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/BUCK +1 -1
  367. package/ReactAndroid/src/main/java/com/facebook/react/modules/storage/BUCK +1 -1
  368. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/BUCK +2 -2
  369. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  370. package/ReactAndroid/src/main/java/com/facebook/react/modules/toast/BUCK +1 -1
  371. package/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/BUCK +1 -1
  372. package/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/BUCK +1 -1
  373. package/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/ReconnectingWebSocket.java +11 -9
  374. package/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK +0 -2
  375. package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +0 -9
  376. package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java +4 -2
  377. package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp +39 -11
  378. package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h +9 -2
  379. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java +7 -28
  380. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java +14 -5
  381. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java +10 -13
  382. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/PixelUtil.java +1 -6
  383. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java +5 -6
  384. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingProhibitedView.java +26 -0
  385. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowView.java +25 -0
  386. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java +162 -66
  387. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +1 -4
  388. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java +9 -9
  389. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +10 -1
  390. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +6 -5
  391. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java +16 -1
  392. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java +53 -19
  393. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java +236 -0
  394. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTModernEventEmitter.java +8 -0
  395. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ReactEventEmitter.java +20 -6
  396. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java +34 -5
  397. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchesHelper.java +1 -1
  398. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewProps.java +9 -4
  399. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/BUCK +1 -1
  400. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.cpp +2 -1
  401. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.h +10 -15
  402. package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/BUCK +1 -1
  403. package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerClosedEvent.java +0 -6
  404. package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerOpenedEvent.java +0 -6
  405. package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerSlideEvent.java +0 -6
  406. package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerStateChangedEvent.java +0 -6
  407. package/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java +5 -5
  408. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/BUCK +1 -1
  409. package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java +7 -11
  410. package/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/BUCK +1 -1
  411. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/BUCK +1 -0
  412. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +15 -1
  413. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java +5 -0
  414. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +42 -5
  415. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.java +18 -3
  416. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java +5 -0
  417. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.java +9 -7
  418. package/ReactAndroid/src/main/java/com/facebook/react/views/slider/BUCK +1 -1
  419. package/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderEvent.java +0 -5
  420. package/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderManager.java +4 -7
  421. package/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlidingCompleteEvent.java +0 -5
  422. package/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/BUCK +1 -1
  423. package/ReactAndroid/src/main/java/com/facebook/react/views/switchview/BUCK +1 -1
  424. package/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchEvent.java +0 -6
  425. package/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java +6 -8
  426. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.java +59 -44
  427. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java +0 -4
  428. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +23 -2
  429. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +19 -0
  430. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java +41 -59
  431. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +20 -51
  432. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +31 -12
  433. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +31 -11
  434. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TypefaceStyle.java +72 -0
  435. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/BUCK +1 -0
  436. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +16 -6
  437. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.java +3 -0
  438. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +117 -62
  439. package/ReactAndroid/src/main/java/com/facebook/react/views/view/CanvasUtil.java +92 -0
  440. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +39 -8
  441. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +49 -2
  442. package/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp +2 -7
  443. package/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJTypesVanilla.h +8 -4
  444. package/ReactAndroid/src/main/jni/react/jni/Android.mk +5 -3
  445. package/ReactAndroid/src/main/jni/react/jni/BUCK +5 -2
  446. package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +64 -3
  447. package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h +9 -2
  448. package/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.cpp +18 -0
  449. package/{ReactCommon/react/renderer/components/picker/iospicker/primitives.h → ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h} +6 -10
  450. package/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.cpp +21 -0
  451. package/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.h +28 -0
  452. package/{ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerComponentDescriptor.h → ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.cpp} +8 -7
  453. package/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.h +30 -0
  454. package/ReactAndroid/src/main/jni/react/jni/JSLoader.cpp +1 -1
  455. package/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h +1 -0
  456. package/ReactAndroid/src/main/jni/third-party/folly/Android.mk +3 -1
  457. package/ReactAndroid/src/main/jni/third-party/libevent/Android.mk +0 -1
  458. package/ReactAndroid/src/main/libraries/fresco/fresco-react-native/BUCK +26 -26
  459. package/ReactAndroid/src/main/libraries/soloader/java/com/facebook/soloader/BUCK +5 -5
  460. package/ReactAndroid/src/main/res/devsupport/values/strings.xml +2 -1
  461. package/ReactAndroid/src/main/res/views/uimanager/values/strings_unlocalized.xml +0 -12
  462. package/ReactAndroid/src/main/third-party/android/androidx/BUCK +63 -2
  463. package/ReactAndroid/src/main/third-party/java/infer-annotations/BUCK +2 -2
  464. package/ReactAndroid/src/main/third-party/java/okhttp/BUCK +4 -4
  465. package/ReactAndroid/src/main/third-party/java/okio/BUCK +2 -2
  466. package/ReactAndroid/src/main/third-party/java/robolectric/{4.4/BUCK → BUCK} +0 -0
  467. package/ReactAndroid/src/main/third-party/java/testing-support-lib/BUCK +0 -31
  468. package/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java +2 -2
  469. package/ReactAndroid/src/test/java/com/facebook/react/bridge/BUCK +1 -1
  470. package/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java +1 -0
  471. package/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK +1 -0
  472. package/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java +168 -0
  473. package/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.java +4 -0
  474. package/ReactCommon/React-Fabric.podspec +11 -11
  475. package/ReactCommon/ReactCommon.podspec +3 -2
  476. package/ReactCommon/callinvoker/BUCK +2 -2
  477. package/ReactCommon/callinvoker/React-callinvoker.podspec +1 -1
  478. package/ReactCommon/cxxreact/Android.mk +2 -1
  479. package/ReactCommon/cxxreact/BUCK +1 -3
  480. package/ReactCommon/cxxreact/CxxNativeModule.cpp +28 -0
  481. package/ReactCommon/cxxreact/CxxNativeModule.h +9 -0
  482. package/ReactCommon/cxxreact/Instance.cpp +5 -8
  483. package/ReactCommon/cxxreact/Instance.h +1 -1
  484. package/ReactCommon/cxxreact/React-cxxreact.podspec +4 -3
  485. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  486. package/ReactCommon/hermes/React-hermes.podspec +2 -2
  487. package/ReactCommon/hermes/executor/Android.mk +4 -4
  488. package/ReactCommon/hermes/inspector/Android.mk +1 -2
  489. package/ReactCommon/hermes/inspector/tools/msggen/package.json +7 -4
  490. package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +13 -10
  491. package/ReactCommon/jsi/Android.mk +1 -1
  492. package/ReactCommon/jsi/BUCK +0 -2
  493. package/ReactCommon/jsi/React-jsi.podspec +3 -3
  494. package/ReactCommon/jsi/jsi/jsilib-posix.cpp +1 -11
  495. package/ReactCommon/jsiexecutor/Android.mk +2 -2
  496. package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +2 -2
  497. package/ReactCommon/logger/Android.mk +23 -0
  498. package/ReactCommon/logger/BUCK +43 -0
  499. package/ReactCommon/logger/React-logger.podspec +40 -0
  500. package/ReactCommon/logger/react_native_log.cpp +52 -0
  501. package/ReactCommon/logger/react_native_log.h +33 -0
  502. package/ReactCommon/react/nativemodule/core/Android.mk +2 -2
  503. package/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.cpp +1 -0
  504. package/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.h +3 -2
  505. package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp +46 -1
  506. package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h +10 -0
  507. package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +37 -1
  508. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +24 -22
  509. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h +11 -8
  510. package/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.h +7 -5
  511. package/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm +61 -42
  512. package/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm +55 -35
  513. package/ReactCommon/react/nativemodule/samples/BUCK +2 -2
  514. package/ReactCommon/react/nativemodule/samples/platform/android/Android.mk +1 -1
  515. package/ReactCommon/react/renderer/animations/BUCK +1 -0
  516. package/ReactCommon/react/renderer/animations/LayoutAnimationCallbackWrapper.h +34 -0
  517. package/ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp +5 -27
  518. package/ReactCommon/react/renderer/animations/LayoutAnimationDriver.h +8 -14
  519. package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +920 -1127
  520. package/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h +80 -245
  521. package/ReactCommon/react/renderer/animations/conversions.h +212 -0
  522. package/ReactCommon/react/renderer/animations/primitives.h +104 -0
  523. package/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp +18 -10
  524. package/ReactCommon/react/renderer/animations/utils.cpp +71 -0
  525. package/ReactCommon/react/renderer/animations/utils.h +80 -0
  526. package/ReactCommon/react/renderer/attributedstring/AttributedString.h +0 -1
  527. package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp +7 -3
  528. package/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +12 -2
  529. package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +7 -2
  530. package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +3 -1
  531. package/ReactCommon/react/renderer/attributedstring/conversions.h +162 -11
  532. package/ReactCommon/react/renderer/attributedstring/primitives.h +34 -1
  533. package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp +2 -2
  534. package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h +1 -0
  535. package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +12 -6
  536. package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h +4 -1
  537. package/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp +2 -1
  538. package/ReactCommon/react/renderer/components/image/Android.mk +1 -1
  539. package/ReactCommon/react/renderer/components/image/ImageProps.cpp +28 -9
  540. package/ReactCommon/react/renderer/components/image/ImageProps.h +5 -1
  541. package/ReactCommon/react/renderer/components/image/conversions.h +9 -2
  542. package/ReactCommon/react/renderer/components/inputaccessory/BUCK +1 -1
  543. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/BUCK +1 -1
  544. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +0 -1
  545. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp +2 -1
  546. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h +2 -0
  547. package/ReactCommon/react/renderer/components/root/BUCK +1 -0
  548. package/ReactCommon/react/renderer/components/root/RootProps.cpp +12 -2
  549. package/ReactCommon/react/renderer/components/root/RootProps.h +6 -1
  550. package/ReactCommon/react/renderer/components/root/RootShadowNode.cpp +2 -1
  551. package/ReactCommon/react/renderer/components/root/RootShadowNode.h +2 -0
  552. package/ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp +35 -3
  553. package/ReactCommon/react/renderer/components/safeareaview/BUCK +1 -1
  554. package/ReactCommon/react/renderer/components/scrollview/Android.mk +1 -1
  555. package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp +54 -4
  556. package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h +10 -5
  557. package/ReactCommon/react/renderer/components/scrollview/conversions.h +5 -0
  558. package/ReactCommon/react/renderer/components/text/Android.mk +1 -1
  559. package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +32 -0
  560. package/ReactCommon/react/renderer/components/text/BaseTextProps.h +5 -1
  561. package/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp +2 -3
  562. package/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h +1 -16
  563. package/ReactCommon/react/renderer/components/text/ParagraphProps.cpp +10 -4
  564. package/ReactCommon/react/renderer/components/text/ParagraphProps.h +5 -1
  565. package/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp +3 -3
  566. package/ReactCommon/react/renderer/components/text/RawTextProps.cpp +3 -2
  567. package/ReactCommon/react/renderer/components/text/RawTextProps.h +5 -1
  568. package/ReactCommon/react/renderer/components/text/RawTextShadowNode.h +36 -2
  569. package/ReactCommon/react/renderer/components/text/TextProps.cpp +6 -3
  570. package/ReactCommon/react/renderer/components/text/TextProps.h +5 -1
  571. package/ReactCommon/react/renderer/components/text/TextShadowNode.h +23 -0
  572. package/ReactCommon/react/renderer/components/textinput/Android.mk +1 -1
  573. package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +58 -91
  574. package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h +10 -6
  575. package/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp +46 -22
  576. package/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h +6 -5
  577. package/ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h +19 -7
  578. package/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h +6 -0
  579. package/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h +63 -2
  580. package/ReactCommon/react/renderer/components/unimplementedview/Android.mk +1 -1
  581. package/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp +4 -2
  582. package/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h +5 -2
  583. package/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h +1 -0
  584. package/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h +28 -0
  585. package/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +24 -1
  586. package/ReactCommon/react/renderer/components/view/AccessibilityProps.h +4 -1
  587. package/ReactCommon/react/renderer/components/view/Android.mk +3 -2
  588. package/ReactCommon/react/renderer/components/view/BUCK +1 -0
  589. package/ReactCommon/react/renderer/components/view/Touch.h +1 -32
  590. package/ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp +19 -5
  591. package/ReactCommon/react/renderer/components/view/TouchEventEmitter.h +2 -1
  592. package/ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h +0 -22
  593. package/ReactCommon/react/renderer/components/view/ViewEventEmitter.cpp +1 -1
  594. package/ReactCommon/react/renderer/components/view/ViewProps.cpp +62 -14
  595. package/ReactCommon/react/renderer/components/view/ViewProps.h +7 -1
  596. package/ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h +5 -10
  597. package/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +5 -12
  598. package/ReactCommon/react/renderer/components/view/ViewShadowNode.h +1 -1
  599. package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +58 -33
  600. package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h +2 -8
  601. package/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +3 -2
  602. package/ReactCommon/react/renderer/components/view/YogaStylableProps.h +2 -0
  603. package/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h +77 -6
  604. package/ReactCommon/react/renderer/components/view/conversions.h +57 -14
  605. package/ReactCommon/react/renderer/components/view/primitives.h +5 -4
  606. package/ReactCommon/react/renderer/components/view/propsConversions.h +163 -28
  607. package/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp +7 -2
  608. package/ReactCommon/react/renderer/core/Android.mk +1 -1
  609. package/ReactCommon/react/renderer/core/BUCK +1 -0
  610. package/ReactCommon/react/renderer/core/BatchedEventQueue.cpp +2 -34
  611. package/ReactCommon/react/renderer/core/BatchedEventQueue.h +2 -9
  612. package/ReactCommon/react/renderer/core/ComponentDescriptor.h +5 -2
  613. package/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +19 -21
  614. package/ReactCommon/react/renderer/core/ConcreteShadowNode.h +4 -0
  615. package/ReactCommon/react/renderer/core/EventDispatcher.cpp +5 -10
  616. package/ReactCommon/react/renderer/core/EventDispatcher.h +3 -8
  617. package/ReactCommon/react/renderer/core/EventEmitter.cpp +21 -11
  618. package/ReactCommon/react/renderer/core/EventEmitter.h +6 -1
  619. package/ReactCommon/react/renderer/core/EventPipe.h +2 -0
  620. package/ReactCommon/react/renderer/core/EventQueue.cpp +35 -32
  621. package/ReactCommon/react/renderer/core/EventQueue.h +12 -6
  622. package/ReactCommon/react/renderer/core/EventQueueProcessor.cpp +82 -0
  623. package/ReactCommon/react/renderer/core/EventQueueProcessor.h +36 -0
  624. package/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +1 -1
  625. package/ReactCommon/react/renderer/core/LayoutableShadowNode.h +0 -6
  626. package/ReactCommon/react/renderer/core/Props.cpp +10 -2
  627. package/ReactCommon/react/renderer/core/Props.h +6 -1
  628. package/ReactCommon/react/renderer/core/PropsParserContext.h +29 -0
  629. package/ReactCommon/react/renderer/core/RawEvent.cpp +4 -2
  630. package/ReactCommon/react/renderer/core/RawEvent.h +40 -3
  631. package/ReactCommon/react/renderer/core/RawProps.cpp +2 -1
  632. package/ReactCommon/react/renderer/core/RawProps.h +3 -1
  633. package/ReactCommon/react/renderer/core/RawPropsKey.cpp +10 -2
  634. package/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +1 -1
  635. package/ReactCommon/react/renderer/core/RawPropsParser.cpp +1 -1
  636. package/ReactCommon/react/renderer/core/RawPropsParser.h +11 -2
  637. package/ReactCommon/react/renderer/core/ReactEventPriority.h +43 -0
  638. package/ReactCommon/react/renderer/core/ReactPrimitives.h +0 -2
  639. package/ReactCommon/react/renderer/core/ShadowNode.cpp +9 -12
  640. package/ReactCommon/react/renderer/core/ShadowNode.h +4 -0
  641. package/ReactCommon/react/renderer/core/ShadowNodeFamily.h +1 -0
  642. package/ReactCommon/react/renderer/core/ShadowNodeTraits.h +17 -1
  643. package/ReactCommon/react/renderer/core/propsConversions.h +19 -9
  644. package/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp +16 -4
  645. package/ReactCommon/react/renderer/core/tests/EventQueueProcessorTest.cpp +134 -0
  646. package/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp +97 -29
  647. package/ReactCommon/react/renderer/core/tests/TestComponent.h +6 -2
  648. package/ReactCommon/react/renderer/core/tests/traitCastTest.cpp +31 -0
  649. package/ReactCommon/react/renderer/debug/DebugStringConvertible.h +9 -9
  650. package/ReactCommon/react/renderer/graphics/Android.mk +5 -2
  651. package/ReactCommon/react/renderer/graphics/BUCK +12 -1
  652. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +3 -2
  653. package/ReactCommon/react/renderer/graphics/Transform.cpp +2 -2
  654. package/ReactCommon/react/renderer/graphics/Transform.h +1 -1
  655. package/ReactCommon/react/renderer/graphics/conversions.h +34 -19
  656. package/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h +67 -0
  657. package/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp +8 -0
  658. package/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h +1 -0
  659. package/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/PlatformColorParser.h +29 -0
  660. package/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp +8 -0
  661. package/ReactCommon/react/renderer/graphics/platform/ios/Color.h +43 -1
  662. package/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h +34 -0
  663. package/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.h +12 -0
  664. package/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +206 -0
  665. package/ReactCommon/react/renderer/imagemanager/BUCK +1 -1
  666. package/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm +1 -1
  667. package/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp +6 -9
  668. package/ReactCommon/react/renderer/leakchecker/LeakChecker.h +1 -4
  669. package/ReactCommon/react/renderer/mapbuffer/BUCK +2 -2
  670. package/ReactCommon/react/renderer/mounting/Android.mk +2 -1
  671. package/ReactCommon/react/renderer/mounting/Differentiator.cpp +3 -10
  672. package/ReactCommon/react/renderer/mounting/Differentiator.h +1 -2
  673. package/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp +1 -7
  674. package/ReactCommon/react/renderer/mounting/MountingCoordinator.h +0 -4
  675. package/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h +1 -1
  676. package/ReactCommon/react/renderer/mounting/ShadowTree.cpp +7 -5
  677. package/ReactCommon/react/renderer/mounting/ShadowTree.h +2 -1
  678. package/ReactCommon/react/renderer/mounting/ShadowView.cpp +2 -0
  679. package/ReactCommon/react/renderer/mounting/ShadowView.h +1 -0
  680. package/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp +12 -0
  681. package/ReactCommon/react/renderer/mounting/ShadowViewMutation.h +10 -1
  682. package/ReactCommon/react/renderer/mounting/StubViewTree.cpp +10 -3
  683. package/ReactCommon/react/renderer/mounting/TelemetryController.cpp +1 -1
  684. package/ReactCommon/react/renderer/mounting/stubs.cpp +3 -3
  685. package/ReactCommon/react/renderer/mounting/tests/MountingTest.cpp +22 -21
  686. package/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp +12 -5
  687. package/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp +2 -2
  688. package/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +6 -3
  689. package/ReactCommon/react/renderer/runtimescheduler/Android.mk +2 -1
  690. package/ReactCommon/react/renderer/runtimescheduler/BUCK +1 -0
  691. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +75 -33
  692. package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +54 -10
  693. package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp +8 -7
  694. package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h +8 -5
  695. package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp +30 -0
  696. package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h +34 -0
  697. package/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerClock.h +4 -2
  698. package/ReactCommon/react/renderer/runtimescheduler/SchedulerPriority.h +4 -2
  699. package/ReactCommon/react/renderer/runtimescheduler/Task.cpp +11 -5
  700. package/ReactCommon/react/renderer/runtimescheduler/Task.h +5 -3
  701. package/ReactCommon/react/renderer/runtimescheduler/primitives.h +4 -2
  702. package/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +157 -0
  703. package/ReactCommon/react/renderer/runtimescheduler/tests/StubQueue.h +6 -0
  704. package/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.cpp +13 -12
  705. package/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h +4 -4
  706. package/ReactCommon/react/renderer/{components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.cpp → scheduler/InspectorData.h} +10 -2
  707. package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +64 -37
  708. package/ReactCommon/react/renderer/scheduler/Scheduler.h +18 -3
  709. package/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h +9 -1
  710. package/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h +1 -6
  711. package/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +49 -35
  712. package/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +12 -12
  713. package/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp +1 -0
  714. package/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp +11 -4
  715. package/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h +4 -1
  716. package/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp +5 -5
  717. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +2 -0
  718. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +22 -0
  719. package/ReactCommon/react/renderer/timeline/BUCK +6 -6
  720. package/ReactCommon/react/renderer/uimanager/UIManager.cpp +29 -16
  721. package/ReactCommon/react/renderer/uimanager/UIManager.h +3 -1
  722. package/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h +1 -1
  723. package/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +61 -2
  724. package/ReactCommon/react/renderer/uimanager/UIManagerBinding.h +13 -1
  725. package/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +10 -2
  726. package/ReactCommon/react/test_utils/BUCK +3 -0
  727. package/ReactCommon/react/{renderer/core/Constants.h → test_utils/MockSurfaceHandler.h} +9 -7
  728. package/ReactCommon/react/test_utils/shadowTreeGeneration.h +18 -4
  729. package/ReactCommon/react/utils/Android.mk +3 -1
  730. package/ReactCommon/react/utils/BUCK +1 -0
  731. package/ReactCommon/react/utils/ContextContainer.h +0 -27
  732. package/ReactCommon/reactperflogger/React-perflogger.podspec +1 -1
  733. package/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +1 -1
  734. package/ReactCommon/runtimeexecutor/ReactCommon/RuntimeExecutor.h +12 -0
  735. package/ReactCommon/yoga/yoga/Yoga.cpp +2 -6
  736. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.aar +0 -0
  737. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.aar.md5 +1 -0
  738. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.aar.sha1 +1 -0
  739. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.aar.sha256 +1 -0
  740. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.aar.sha512 +1 -0
  741. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.module +272 -0
  742. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.module.md5 +1 -0
  743. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.module.sha1 +1 -0
  744. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.module.sha256 +1 -0
  745. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.module.sha512 +1 -0
  746. package/android/com/facebook/react/react-native/{0.0.0-263478b91/react-native-0.0.0-263478b91.pom → 0.0.0-268efb102/react-native-0.0.0-268efb102.pom} +22 -11
  747. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.pom.md5 +1 -0
  748. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.pom.sha1 +1 -0
  749. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.pom.sha256 +1 -0
  750. package/android/com/facebook/react/react-native/0.0.0-268efb102/react-native-0.0.0-268efb102.pom.sha512 +1 -0
  751. package/android/com/facebook/react/react-native/maven-metadata.xml +4 -3
  752. package/android/com/facebook/react/react-native/maven-metadata.xml.md5 +1 -1
  753. package/android/com/facebook/react/react-native/maven-metadata.xml.sha1 +1 -1
  754. package/android/com/facebook/react/react-native/maven-metadata.xml.sha256 +1 -0
  755. package/android/com/facebook/react/react-native/maven-metadata.xml.sha512 +1 -0
  756. package/flow/HermesInternalType.js +114 -0
  757. package/flow/global.js +68 -0
  758. package/flow-typed/npm/react-test-renderer_v16.x.x.js +79 -0
  759. package/index.js +65 -40
  760. package/jest/preprocessor.js +75 -7
  761. package/jest/renderer.js +3 -7
  762. package/jest/setup.js +2 -1
  763. package/package.json +58 -19
  764. package/react.gradle +47 -25
  765. package/scripts/find-node.sh +6 -0
  766. package/scripts/generate-specs-cli.js +20 -2
  767. package/scripts/ios-configure-glog.sh +4 -0
  768. package/scripts/react-native-xcode.sh +5 -1
  769. package/scripts/react_native_pods.rb +213 -43
  770. package/template/_flowconfig +1 -1
  771. package/template/_gitignore +1 -0
  772. package/template/android/app/build.gradle +12 -7
  773. package/template/android/app/src/main/res/values/styles.xml +0 -1
  774. package/template/android/build.gradle +5 -6
  775. package/template/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  776. package/template/android/gradle.properties +1 -1
  777. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +2 -0
  778. package/template/ios/Podfile +1 -0
  779. package/template/package.json +3 -4
  780. package/third-party-podspecs/RCT-Folly.podspec +14 -10
  781. package/third-party-podspecs/boost.podspec +23 -0
  782. package/Libraries/BUCK +0 -24
  783. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -87
  784. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
  785. package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
  786. package/Libraries/Components/Picker/AndroidDialogPickerNativeComponent.js +0 -83
  787. package/Libraries/Components/Picker/AndroidDropdownPickerNativeComponent.js +0 -82
  788. package/Libraries/Components/Picker/Picker.js +0 -168
  789. package/Libraries/Components/Picker/PickerAndroid.android.js +0 -143
  790. package/Libraries/Components/Picker/PickerAndroid.ios.js +0 -12
  791. package/Libraries/Components/Picker/PickerIOS.android.js +0 -14
  792. package/Libraries/Components/Picker/PickerIOS.ios.js +0 -163
  793. package/Libraries/Components/Picker/RCTPickerNativeComponent.js +0 -86
  794. package/Libraries/Components/StaticContainer.react.js +0 -51
  795. package/Libraries/Components/StatusBar/StatusBarIOS.js +0 -38
  796. package/Libraries/Components/Touchable/ensurePositiveDelayProps.js +0 -25
  797. package/Libraries/Interaction/InteractionMixin.js +0 -53
  798. package/Libraries/ReactNative/queryLayoutByID.js +0 -58
  799. package/Libraries/StyleSheet/StyleSheetValidation.js +0 -100
  800. package/Libraries/Text/TextInjection.js +0 -15
  801. package/React/Base/RCTJSInvokerModule.h +0 -17
  802. package/React/Fabric/Mounting/ComponentViews/Picker/RCTPickerComponentView.h +0 -19
  803. package/React/Fabric/Mounting/ComponentViews/Picker/RCTPickerComponentView.mm +0 -206
  804. package/React/Views/RCTPicker.h +0 -23
  805. package/React/Views/RCTPicker.m +0 -122
  806. package/React/Views/RCTPickerManager.m +0 -59
  807. package/ReactAndroid/release.gradle +0 -87
  808. package/ReactAndroid/src/androidTest/java/com/facebook/react/tests/DatePickerDialogTestCase.java +0 -172
  809. package/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactPickerTestCase.java +0 -196
  810. package/ReactAndroid/src/androidTest/js/DatePickerDialogTestModule.js +0 -45
  811. package/ReactAndroid/src/androidTest/js/PickerAndroidTestModule.js +0 -89
  812. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerImpl.java +0 -82
  813. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/BUCK +0 -27
  814. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DatePickerDialogFragment.java +0 -137
  815. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DatePickerDialogModule.java +0 -153
  816. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DatePickerMode.java +0 -15
  817. package/ReactAndroid/src/main/java/com/facebook/react/modules/datepicker/DismissableDatePickerDialog.java +0 -117
  818. package/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerDelegate.java +0 -48
  819. package/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerInterface.java +0 -23
  820. package/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerDelegate.java +0 -48
  821. package/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerInterface.java +0 -22
  822. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/BUCK +0 -30
  823. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDialogPickerManager.java +0 -51
  824. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDropdownPickerManager.java +0 -50
  825. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPicker.java +0 -196
  826. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerAdapter.java +0 -95
  827. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerItem.java +0 -43
  828. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerManager.java +0 -99
  829. package/ReactAndroid/src/main/java/com/facebook/react/views/picker/events/PickerItemSelectEvent.java +0 -42
  830. package/ReactCommon/react/renderer/components/picker/Android.mk +0 -37
  831. package/ReactCommon/react/renderer/components/picker/BUCK +0 -98
  832. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.cpp +0 -23
  833. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.h +0 -27
  834. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.cpp +0 -28
  835. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.h +0 -77
  836. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.h +0 -29
  837. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerComponentDescriptor.h +0 -21
  838. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.cpp +0 -23
  839. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.h +0 -27
  840. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.cpp +0 -28
  841. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.h +0 -77
  842. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.cpp +0 -17
  843. package/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.h +0 -29
  844. package/ReactCommon/react/renderer/components/picker/iospicker/BUCK +0 -59
  845. package/ReactCommon/react/renderer/components/picker/iospicker/PickerComponentDescriptor.h +0 -26
  846. package/ReactCommon/react/renderer/components/picker/iospicker/PickerEventEmitter.cpp +0 -23
  847. package/ReactCommon/react/renderer/components/picker/iospicker/PickerEventEmitter.h +0 -28
  848. package/ReactCommon/react/renderer/components/picker/iospicker/PickerProps.cpp +0 -46
  849. package/ReactCommon/react/renderer/components/picker/iospicker/PickerProps.h +0 -36
  850. package/ReactCommon/react/renderer/components/picker/iospicker/PickerShadowNode.cpp +0 -16
  851. package/ReactCommon/react/renderer/components/picker/iospicker/PickerShadowNode.h +0 -33
  852. package/ReactCommon/react/renderer/components/picker/iospicker/PickerState.h +0 -19
  853. package/ReactCommon/react/renderer/components/picker/iospicker/conversions.h +0 -48
  854. package/ReactCommon/react/renderer/core/Constants.cpp +0 -24
  855. package/ReactCommon/react/renderer/mounting/DifferentiatorFlatteningClassic.cpp +0 -1564
  856. package/ReactCommon/react/renderer/mounting/DifferentiatorFlatteningClassic.h +0 -45
  857. package/ReactCommon/react/renderer/scheduler/AsynchronousEventBeatV2.cpp +0 -58
  858. package/ReactCommon/react/renderer/scheduler/AsynchronousEventBeatV2.h +0 -41
  859. package/android/com/facebook/react/react-native/0.0.0-263478b91/react-native-0.0.0-263478b91.aar +0 -0
  860. package/android/com/facebook/react/react-native/0.0.0-263478b91/react-native-0.0.0-263478b91.aar.md5 +0 -1
  861. package/android/com/facebook/react/react-native/0.0.0-263478b91/react-native-0.0.0-263478b91.aar.sha1 +0 -1
  862. package/android/com/facebook/react/react-native/0.0.0-263478b91/react-native-0.0.0-263478b91.pom.md5 +0 -1
  863. package/android/com/facebook/react/react-native/0.0.0-263478b91/react-native-0.0.0-263478b91.pom.sha1 +0 -1
  864. package/scripts/generate-specs.sh +0 -100
  865. package/template/_editorconfig +0 -3
  866. package/template/_gitattributes +0 -3
@@ -8,25 +8,24 @@
8
8
  #include "LayoutAnimationKeyFrameManager.h"
9
9
 
10
10
  #include <algorithm>
11
- #include <chrono>
12
11
 
13
12
  #include <react/debug/flags.h>
14
13
  #include <react/debug/react_native_assert.h>
15
14
 
15
+ #include <logger/react_native_log.h>
16
+ #include <react/renderer/animations/conversions.h>
17
+ #include <react/renderer/animations/utils.h>
16
18
  #include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
17
- #include <react/renderer/components/root/RootShadowNode.h>
19
+ #include <react/renderer/components/image/ImageProps.h>
18
20
  #include <react/renderer/components/view/ViewProps.h>
19
21
  #include <react/renderer/core/ComponentDescriptor.h>
20
22
  #include <react/renderer/core/LayoutMetrics.h>
21
- #include <react/renderer/core/LayoutableShadowNode.h>
22
23
  #include <react/renderer/core/Props.h>
24
+ #include <react/renderer/core/PropsParserContext.h>
23
25
  #include <react/renderer/core/RawValue.h>
24
26
  #include <react/renderer/mounting/MountingCoordinator.h>
25
- #include <react/renderer/mounting/ShadowViewMutation.h>
26
-
27
- #include <react/renderer/mounting/Differentiator.h>
28
- #include <react/renderer/mounting/ShadowTreeRevision.h>
29
27
  #include <react/renderer/mounting/ShadowView.h>
28
+ #include <react/renderer/mounting/ShadowViewMutation.h>
30
29
 
31
30
  #include <glog/logging.h>
32
31
 
@@ -74,6 +73,7 @@ void PrintMutationInstruction(
74
73
  return stream;
75
74
  }(LOG(ERROR));
76
75
  }
76
+
77
77
  void PrintMutationInstructionRelative(
78
78
  std::string message,
79
79
  ShadowViewMutation const &mutation,
@@ -85,199 +85,27 @@ void PrintMutationInstructionRelative(
85
85
  }
86
86
  #endif
87
87
 
88
- static better::optional<AnimationType> parseAnimationType(std::string param) {
89
- if (param == "spring") {
90
- return AnimationType::Spring;
91
- }
92
- if (param == "linear") {
93
- return AnimationType::Linear;
94
- }
95
- if (param == "easeInEaseOut") {
96
- return AnimationType::EaseInEaseOut;
97
- }
98
- if (param == "easeIn") {
99
- return AnimationType::EaseIn;
100
- }
101
- if (param == "easeOut") {
102
- return AnimationType::EaseOut;
103
- }
104
- if (param == "keyboard") {
105
- return AnimationType::Keyboard;
106
- }
107
-
108
- LOG(ERROR) << "Error parsing animation type: " << param;
109
- return {};
110
- }
111
-
112
- static better::optional<AnimationProperty> parseAnimationProperty(
113
- std::string param) {
114
- if (param == "opacity") {
115
- return AnimationProperty::Opacity;
116
- }
117
- if (param == "scaleX") {
118
- return AnimationProperty::ScaleX;
119
- }
120
- if (param == "scaleY") {
121
- return AnimationProperty::ScaleY;
122
- }
123
- if (param == "scaleXY") {
124
- return AnimationProperty::ScaleXY;
125
- }
126
-
127
- LOG(ERROR) << "Error parsing animation property: " << param;
128
- return {};
129
- }
130
-
131
- static better::optional<AnimationConfig> parseAnimationConfig(
132
- folly::dynamic const &config,
133
- double defaultDuration,
134
- bool parsePropertyType) {
135
- if (config.empty() || !config.isObject()) {
136
- return AnimationConfig{
137
- AnimationType::Linear,
138
- AnimationProperty::NotApplicable,
139
- defaultDuration,
140
- 0,
141
- 0,
142
- 0};
143
- }
144
-
145
- auto const typeIt = config.find("type");
146
- if (typeIt == config.items().end()) {
147
- LOG(ERROR) << "Error parsing animation config: could not find field `type`";
148
- return {};
149
- }
150
- auto const animationTypeParam = typeIt->second;
151
- if (animationTypeParam.empty() || !animationTypeParam.isString()) {
152
- LOG(ERROR)
153
- << "Error parsing animation config: could not unwrap field `type`";
154
- return {};
155
- }
156
- const auto animationType = parseAnimationType(animationTypeParam.asString());
157
- if (!animationType) {
158
- LOG(ERROR)
159
- << "Error parsing animation config: could not parse field `type`";
160
- return {};
161
- }
162
-
163
- AnimationProperty animationProperty = AnimationProperty::NotApplicable;
164
- if (parsePropertyType) {
165
- auto const propertyIt = config.find("property");
166
- if (propertyIt == config.items().end()) {
167
- LOG(ERROR)
168
- << "Error parsing animation config: could not find field `property`";
169
- return {};
170
- }
171
- auto const animationPropertyParam = propertyIt->second;
172
- if (animationPropertyParam.empty() || !animationPropertyParam.isString()) {
173
- LOG(ERROR)
174
- << "Error parsing animation config: could not unwrap field `property`";
175
- return {};
176
- }
177
- const auto animationPropertyParsed =
178
- parseAnimationProperty(animationPropertyParam.asString());
179
- if (!animationPropertyParsed) {
180
- LOG(ERROR)
181
- << "Error parsing animation config: could not parse field `property`";
182
- return {};
183
- }
184
- animationProperty = *animationPropertyParsed;
185
- }
186
-
187
- double duration = defaultDuration;
188
- double delay = 0;
189
- double springDamping = 0.5;
190
- double initialVelocity = 0;
191
-
192
- auto const durationIt = config.find("duration");
193
- if (durationIt != config.items().end()) {
194
- if (durationIt->second.isDouble()) {
195
- duration = durationIt->second.asDouble();
196
- } else {
197
- LOG(ERROR)
198
- << "Error parsing animation config: field `duration` must be a number";
199
- return {};
200
- }
201
- }
202
-
203
- auto const delayIt = config.find("delay");
204
- if (delayIt != config.items().end()) {
205
- if (delayIt->second.isDouble()) {
206
- delay = delayIt->second.asDouble();
207
- } else {
208
- LOG(ERROR)
209
- << "Error parsing animation config: field `delay` must be a number";
210
- return {};
211
- }
212
- }
213
-
214
- auto const springDampingIt = config.find("springDamping");
215
- if (springDampingIt != config.items().end() &&
216
- springDampingIt->second.isDouble()) {
217
- if (springDampingIt->second.isDouble()) {
218
- springDamping = springDampingIt->second.asDouble();
219
- } else {
220
- LOG(ERROR)
221
- << "Error parsing animation config: field `springDamping` must be a number";
222
- return {};
223
- }
224
- }
225
-
226
- auto const initialVelocityIt = config.find("initialVelocity");
227
- if (initialVelocityIt != config.items().end()) {
228
- if (initialVelocityIt->second.isDouble()) {
229
- initialVelocity = initialVelocityIt->second.asDouble();
230
- } else {
231
- LOG(ERROR)
232
- << "Error parsing animation config: field `initialVelocity` must be a number";
233
- return {};
234
- }
235
- }
236
-
237
- return better::optional<AnimationConfig>(AnimationConfig{
238
- *animationType,
239
- animationProperty,
240
- duration,
241
- delay,
242
- springDamping,
243
- initialVelocity});
88
+ static inline float
89
+ interpolateFloats(float coefficient, float oldValue, float newValue) {
90
+ return oldValue + (newValue - oldValue) * coefficient;
244
91
  }
245
92
 
246
- // Parse animation config from JS
247
- static better::optional<LayoutAnimationConfig> parseLayoutAnimationConfig(
248
- folly::dynamic const &config) {
249
- if (config.empty() || !config.isObject()) {
250
- return {};
251
- }
252
-
253
- const auto durationIt = config.find("duration");
254
- if (durationIt == config.items().end() || !durationIt->second.isDouble()) {
255
- return {};
256
- }
257
- const double duration = durationIt->second.asDouble();
258
-
259
- const auto createConfigIt = config.find("create");
260
- const auto createConfig = createConfigIt == config.items().end()
261
- ? better::optional<AnimationConfig>(AnimationConfig{})
262
- : parseAnimationConfig(createConfigIt->second, duration, true);
263
-
264
- const auto updateConfigIt = config.find("update");
265
- const auto updateConfig = updateConfigIt == config.items().end()
266
- ? better::optional<AnimationConfig>(AnimationConfig{})
267
- : parseAnimationConfig(updateConfigIt->second, duration, false);
93
+ #pragma mark -
268
94
 
269
- const auto deleteConfigIt = config.find("delete");
270
- const auto deleteConfig = deleteConfigIt == config.items().end()
271
- ? better::optional<AnimationConfig>(AnimationConfig{})
272
- : parseAnimationConfig(deleteConfigIt->second, duration, true);
95
+ LayoutAnimationKeyFrameManager::LayoutAnimationKeyFrameManager(
96
+ RuntimeExecutor runtimeExecutor,
97
+ ContextContainer::Shared &contextContainer,
98
+ LayoutAnimationStatusDelegate *delegate)
99
+ : runtimeExecutor_(runtimeExecutor),
100
+ contextContainer_(contextContainer),
101
+ layoutAnimationStatusDelegate_(delegate),
102
+ now_([]() {
103
+ return std::chrono::duration_cast<std::chrono::milliseconds>(
104
+ std::chrono::high_resolution_clock::now().time_since_epoch())
105
+ .count();
106
+ }) {}
273
107
 
274
- if (!createConfig || !updateConfig || !deleteConfig) {
275
- return {};
276
- }
277
-
278
- return better::optional<LayoutAnimationConfig>(LayoutAnimationConfig{
279
- duration, *createConfig, *updateConfig, *deleteConfig});
280
- }
108
+ #pragma mark UIManagerAnimationDelegate methods
281
109
 
282
110
  /**
283
111
  * Globally configure next LayoutAnimation.
@@ -323,24 +151,9 @@ void LayoutAnimationKeyFrameManager::uiManagerDidConfigureNextLayoutAnimation(
323
151
  }
324
152
  }
325
153
 
326
- void LayoutAnimationKeyFrameManager::uiManagerDidConfigureNextLayoutAnimation(
327
- LayoutAnimation layoutAnimation) const {
328
- currentAnimation_ = better::optional<LayoutAnimation>{layoutAnimation};
329
- }
330
-
331
- void LayoutAnimationKeyFrameManager::setLayoutAnimationStatusDelegate(
332
- LayoutAnimationStatusDelegate *delegate) const {
333
- std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
334
- layoutAnimationStatusDelegate_ = delegate;
335
- }
336
-
337
- bool LayoutAnimationKeyFrameManager::shouldOverridePullTransaction() const {
338
- return shouldAnimateFrame();
339
- }
340
-
341
- void LayoutAnimationKeyFrameManager::stopSurface(SurfaceId surfaceId) {
342
- std::lock_guard<std::mutex> lock(surfaceIdsToStopMutex_);
343
- surfaceIdsToStop_.push_back(surfaceId);
154
+ void LayoutAnimationKeyFrameManager::setComponentDescriptorRegistry(
155
+ const SharedComponentDescriptorRegistry &componentDescriptorRegistry) {
156
+ componentDescriptorRegistry_ = componentDescriptorRegistry;
344
157
  }
345
158
 
346
159
  bool LayoutAnimationKeyFrameManager::shouldAnimateFrame() const {
@@ -348,592 +161,182 @@ bool LayoutAnimationKeyFrameManager::shouldAnimateFrame() const {
348
161
  return currentAnimation_ || !inflightAnimations_.empty();
349
162
  }
350
163
 
351
- static inline const float
352
- interpolateFloats(float coefficient, float oldValue, float newValue) {
353
- return oldValue + (newValue - oldValue) * coefficient;
164
+ void LayoutAnimationKeyFrameManager::stopSurface(SurfaceId surfaceId) {
165
+ std::lock_guard<std::mutex> lock(surfaceIdsToStopMutex_);
166
+ surfaceIdsToStop_.insert(surfaceId);
354
167
  }
355
168
 
356
- std::pair<double, double>
357
- LayoutAnimationKeyFrameManager::calculateAnimationProgress(
358
- uint64_t now,
359
- const LayoutAnimation &animation,
360
- const AnimationConfig &mutationConfig) const {
361
- if (mutationConfig.animationType == AnimationType::None) {
362
- return {1, 1};
363
- }
364
-
365
- uint64_t startTime = animation.startTime;
366
- uint64_t delay = mutationConfig.delay;
367
- uint64_t endTime = startTime + delay + mutationConfig.duration;
368
-
369
- static const float PI = 3.14159265358979323846;
370
-
371
- if (now >= endTime) {
372
- return {1, 1};
373
- }
374
- if (now < startTime + delay) {
375
- return {0, 0};
376
- }
169
+ #pragma mark - MountingOverrideDelegate methods
377
170
 
378
- double linearTimeProgression = 1 -
379
- (double)(endTime - delay - now) / (double)(endTime - animation.startTime);
380
-
381
- if (mutationConfig.animationType == AnimationType::Linear) {
382
- return {linearTimeProgression, linearTimeProgression};
383
- } else if (mutationConfig.animationType == AnimationType::EaseIn) {
384
- // This is an accelerator-style interpolator.
385
- // In the future, this parameter (2.0) could be adjusted. This has been the
386
- // default for Classic RN forever.
387
- return {linearTimeProgression, pow(linearTimeProgression, 2.0)};
388
- } else if (mutationConfig.animationType == AnimationType::EaseOut) {
389
- // This is an decelerator-style interpolator.
390
- // In the future, this parameter (2.0) could be adjusted. This has been the
391
- // default for Classic RN forever.
392
- return {linearTimeProgression, 1.0 - pow(1 - linearTimeProgression, 2.0)};
393
- } else if (mutationConfig.animationType == AnimationType::EaseInEaseOut) {
394
- // This is a combination of accelerate+decelerate.
395
- // The animation starts and ends slowly, and speeds up in the middle.
396
- return {
397
- linearTimeProgression,
398
- cos((linearTimeProgression + 1.0) * PI) / 2 + 0.5};
399
- } else if (mutationConfig.animationType == AnimationType::Spring) {
400
- // Using mSpringDamping in this equation is not really the exact
401
- // mathematical springDamping, but a good approximation We need to replace
402
- // this equation with the right Factor that accounts for damping and
403
- // friction
404
- double damping = mutationConfig.springDamping;
405
- return {
406
- linearTimeProgression,
407
- (1 +
408
- pow(2, -10 * linearTimeProgression) *
409
- sin((linearTimeProgression - damping / 4) * PI * 2 / damping))};
410
- } else {
411
- return {linearTimeProgression, linearTimeProgression};
412
- }
171
+ bool LayoutAnimationKeyFrameManager::shouldOverridePullTransaction() const {
172
+ return shouldAnimateFrame();
413
173
  }
414
174
 
415
- void LayoutAnimationKeyFrameManager::
416
- adjustImmediateMutationIndicesForDelayedMutations(
417
- SurfaceId surfaceId,
418
- ShadowViewMutation &mutation,
419
- bool skipLastAnimation,
420
- bool lastAnimationOnly) const {
421
- bool isRemoveMutation = mutation.type == ShadowViewMutation::Type::Remove;
422
- react_native_assert(
423
- isRemoveMutation || mutation.type == ShadowViewMutation::Type::Insert);
424
-
425
- // TODO: turn all of this into a lambda and share code?
426
- if (mutation.mutatedViewIsVirtual()) {
427
- PrintMutationInstruction(
428
- "[IndexAdjustment] Not calling adjustImmediateMutationIndicesForDelayedMutations, is virtual, for:",
429
- mutation);
430
- return;
431
- }
432
-
433
- PrintMutationInstruction(
434
- "[IndexAdjustment] Calling adjustImmediateMutationIndicesForDelayedMutations for:",
435
- mutation);
436
-
437
- // First, collect all final mutations that could impact this immediate
438
- // mutation.
439
- std::vector<ShadowViewMutation *> candidateMutations{};
440
-
441
- for (auto inflightAnimationIt =
442
- inflightAnimations_.rbegin() + (skipLastAnimation ? 1 : 0);
443
- inflightAnimationIt != inflightAnimations_.rend();
444
- inflightAnimationIt++) {
445
- auto &inflightAnimation = *inflightAnimationIt;
446
- if (inflightAnimation.surfaceId != surfaceId) {
447
- continue;
448
- }
449
- if (inflightAnimation.completed) {
450
- continue;
451
- }
175
+ better::optional<MountingTransaction>
176
+ LayoutAnimationKeyFrameManager::pullTransaction(
177
+ SurfaceId surfaceId,
178
+ MountingTransaction::Number transactionNumber,
179
+ TransactionTelemetry const &telemetry,
180
+ ShadowViewMutationList mutations) const {
181
+ simulateImagePropsMemoryAccess(mutations);
182
+ // Current time in milliseconds
183
+ uint64_t now = now_();
452
184
 
453
- for (auto it = inflightAnimation.keyFrames.begin();
454
- it != inflightAnimation.keyFrames.end();
455
- it++) {
456
- auto &animatedKeyFrame = *it;
185
+ bool inflightAnimationsExistInitially = !inflightAnimations_.empty();
186
+ deleteAnimationsForStoppedSurfaces();
457
187
 
458
- if (animatedKeyFrame.invalidated) {
459
- continue;
188
+ if (!mutations.empty()) {
189
+ #ifdef RN_SHADOW_TREE_INTROSPECTION
190
+ {
191
+ std::stringstream ss(getDebugDescription(mutations, {}));
192
+ std::string to;
193
+ while (std::getline(ss, to, '\n')) {
194
+ LOG(ERROR)
195
+ << "LayoutAnimationKeyFrameManager.cpp: got mutation list: Line: "
196
+ << to;
460
197
  }
198
+ };
199
+ #endif
461
200
 
462
- // Detect if they're in the same view hierarchy, but not equivalent
463
- // We've already detected direct conflicts and removed them.
464
- if (animatedKeyFrame.parentView.tag != mutation.parentShadowView.tag) {
201
+ // DEBUG ONLY: list existing inflight animations
202
+ #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
203
+ LOG(ERROR) << "BEGINNING DISPLAYING ONGOING inflightAnimations_!";
204
+ int i = 0;
205
+ int j = 0;
206
+ for (auto const &inflightAnimation : inflightAnimations_) {
207
+ i++;
208
+ j = 0;
209
+ if (inflightAnimation.completed) {
465
210
  continue;
466
211
  }
467
-
468
- for (auto &delayedMutation : animatedKeyFrame.finalMutationsForKeyFrame) {
469
- if (delayedMutation.type != ShadowViewMutation::Type::Remove) {
470
- continue;
471
- }
472
- if (delayedMutation.mutatedViewIsVirtual()) {
212
+ for (auto &keyframe : inflightAnimation.keyFrames) {
213
+ j++;
214
+ if (keyframe.invalidated) {
473
215
  continue;
474
216
  }
475
- if (delayedMutation.oldChildShadowView.tag ==
476
- (isRemoveMutation ? mutation.oldChildShadowView.tag
477
- : mutation.newChildShadowView.tag)) {
478
- continue;
217
+ for (const auto &finalMutationForKeyFrame :
218
+ keyframe.finalMutationsForKeyFrame) {
219
+ if (finalMutationForKeyFrame.mutatedViewIsVirtual()) {
220
+ std::string msg = "Animation " + std::to_string(i) + " keyframe " +
221
+ std::to_string(j) + ": Final Animation";
222
+ PrintMutationInstruction(msg, finalMutationForKeyFrame);
223
+ } else {
224
+ LOG(ERROR) << "Animation " << i << " keyframe " << j
225
+ << ": on tag: [" << keyframe.viewStart.tag << "]";
226
+ }
479
227
  }
480
-
481
- PrintMutationInstructionRelative(
482
- "[IndexAdjustment] adjustImmediateMutationIndicesForDelayedMutations CANDIDATE for:",
483
- mutation,
484
- delayedMutation);
485
- candidateMutations.push_back(&delayedMutation);
486
228
  }
487
229
  }
230
+ LOG(ERROR) << "BEGINNING DONE DISPLAYING ONGOING inflightAnimations_!";
231
+ #endif
488
232
 
489
- if (lastAnimationOnly) {
490
- break;
233
+ PropsParserContext propsParserContext{surfaceId, *contextContainer_};
234
+
235
+ // What to do if we detect a conflict? Get current value and make
236
+ // that the baseline of the next animation. Scale the remaining time
237
+ // in the animation
238
+ // Types of conflicts and how we handle them:
239
+ // Update -> update: remove the previous update, make it the baseline of the
240
+ // next update (with current progress) Update -> remove: same, with final
241
+ // mutation being a remove Insert -> update: treat as update->update Insert
242
+ // -> remove: same, as update->remove Remove -> update/insert: not possible
243
+ // We just collect pairs here of <Mutation, AnimationConfig> and delete them
244
+ // from active animations. If another animation is queued up from the
245
+ // current mutations then these deleted mutations will serve as the baseline
246
+ // for the next animation. If not, the current mutations are executed
247
+ // immediately without issues.
248
+ std::vector<AnimationKeyFrame> conflictingAnimations{};
249
+ getAndEraseConflictingAnimations(
250
+ surfaceId, mutations, conflictingAnimations);
251
+
252
+ // Are we animating this list of mutations?
253
+ better::optional<LayoutAnimation> currentAnimation{};
254
+ {
255
+ std::lock_guard<std::mutex> lock(currentAnimationMutex_);
256
+ if (currentAnimation_) {
257
+ currentAnimation = std::move(currentAnimation_);
258
+ currentAnimation_.reset();
259
+ }
491
260
  }
492
- }
493
261
 
494
- // While the mutation keeps being affected, keep checking. We use the vector
495
- // so we only perform one adjustment per delayed mutation. See comments at
496
- // bottom of adjustDelayedMutationIndicesForMutation for further explanation.
497
- bool changed = true;
498
- int adjustedDelta = 0;
499
- while (changed) {
500
- changed = false;
501
- candidateMutations.erase(
502
- std::remove_if(
503
- candidateMutations.begin(),
504
- candidateMutations.end(),
505
- [&changed, &mutation, &adjustedDelta, &isRemoveMutation](
506
- ShadowViewMutation *candidateMutation) {
507
- bool indexConflicts =
508
- (candidateMutation->index < mutation.index ||
509
- (isRemoveMutation &&
510
- candidateMutation->index == mutation.index));
511
- if (indexConflicts) {
512
- mutation.index++;
513
- adjustedDelta++;
514
- changed = true;
515
- PrintMutationInstructionRelative(
516
- "[IndexAdjustment] adjustImmediateMutationIndicesForDelayedMutations: Adjusting mutation UPWARD",
517
- mutation,
518
- *candidateMutation);
519
- return true;
520
- }
521
- return false;
522
- }),
523
- candidateMutations.end());
524
- }
525
- }
526
-
527
- void LayoutAnimationKeyFrameManager::adjustDelayedMutationIndicesForMutation(
528
- SurfaceId surfaceId,
529
- ShadowViewMutation const &mutation,
530
- bool skipLastAnimation) const {
531
- bool isRemoveMutation = mutation.type == ShadowViewMutation::Type::Remove;
532
- bool isInsertMutation = mutation.type == ShadowViewMutation::Type::Insert;
533
- auto tag = isRemoveMutation ? mutation.oldChildShadowView.tag
534
- : mutation.newChildShadowView.tag;
535
- react_native_assert(isRemoveMutation || isInsertMutation);
536
-
537
- if (mutation.mutatedViewIsVirtual()) {
538
- PrintMutationInstruction(
539
- "[IndexAdjustment] Not calling adjustDelayedMutationIndicesForMutation, is virtual, for:",
540
- mutation);
541
- return;
542
- }
543
-
544
- // First, collect all final mutations that could impact this immediate
545
- // mutation.
546
- std::vector<ShadowViewMutation *> candidateMutations{};
547
-
548
- for (auto inflightAnimationIt =
549
- inflightAnimations_.rbegin() + (skipLastAnimation ? 1 : 0);
550
- inflightAnimationIt != inflightAnimations_.rend();
551
- inflightAnimationIt++) {
552
- auto &inflightAnimation = *inflightAnimationIt;
553
-
554
- if (inflightAnimation.surfaceId != surfaceId) {
555
- continue;
556
- }
557
- if (inflightAnimation.completed) {
558
- continue;
559
- }
560
-
561
- for (auto it = inflightAnimation.keyFrames.begin();
562
- it != inflightAnimation.keyFrames.end();
563
- it++) {
564
- auto &animatedKeyFrame = *it;
565
-
566
- if (animatedKeyFrame.invalidated) {
567
- continue;
568
- }
569
-
570
- // Detect if they're in the same view hierarchy, but not equivalent
571
- // (We've already detected direct conflicts and handled them above)
572
- if (animatedKeyFrame.parentView.tag != mutation.parentShadowView.tag) {
573
- continue;
574
- }
262
+ if (currentAnimation.hasValue()) {
263
+ LayoutAnimation animation = std::move(currentAnimation).value();
264
+ animation.surfaceId = surfaceId;
265
+ animation.startTime = now;
575
266
 
576
- for (auto &finalAnimationMutation :
577
- animatedKeyFrame.finalMutationsForKeyFrame) {
578
- if (finalAnimationMutation.oldChildShadowView.tag == tag) {
579
- continue;
267
+ // Pre-process list to:
268
+ // Catch remove+reinsert (reorders)
269
+ // Catch delete+create (reparenting) (this should be optimized away at
270
+ // the diffing level eventually?)
271
+ // TODO: to prevent this step we could tag Remove/Insert mutations as
272
+ // being moves on the Differ level, since we know that there? We could use
273
+ // TinyMap here, but it's not exposed by Differentiator (yet).
274
+ better::set<Tag> insertedTags;
275
+ better::set<Tag> deletedTags;
276
+ better::set<Tag> reparentedTags; // tags that are deleted and recreated
277
+ std::unordered_map<Tag, ShadowViewMutation> movedTags;
278
+ for (const auto &mutation : mutations) {
279
+ if (mutation.type == ShadowViewMutation::Type::Insert) {
280
+ insertedTags.insert(mutation.newChildShadowView.tag);
580
281
  }
581
-
582
- if (finalAnimationMutation.type != ShadowViewMutation::Type::Remove) {
583
- continue;
282
+ if (mutation.type == ShadowViewMutation::Type::Delete) {
283
+ deletedTags.insert(mutation.oldChildShadowView.tag);
584
284
  }
585
- if (finalAnimationMutation.mutatedViewIsVirtual()) {
586
- continue;
285
+ if (mutation.type == ShadowViewMutation::Type::Create) {
286
+ if (deletedTags.find(mutation.newChildShadowView.tag) !=
287
+ deletedTags.end()) {
288
+ reparentedTags.insert(mutation.newChildShadowView.tag);
289
+ }
587
290
  }
588
-
589
- PrintMutationInstructionRelative(
590
- "[IndexAdjustment] adjustDelayedMutationIndicesForMutation: CANDIDATE:",
591
- mutation,
592
- finalAnimationMutation);
593
- candidateMutations.push_back(&finalAnimationMutation);
594
291
  }
595
- }
596
- }
597
-
598
- // Because the finalAnimations are not sorted in any way, it is possible to
599
- // have some sequence like:
600
- // * DELAYED REMOVE 10 from {TAG}
601
- // * DELAYED REMOVE 9 from {TAG}
602
- // * ...
603
- // * DELAYED REMOVE 5 from {TAG}
604
- // with mutation: INSERT 6/REMOVE 6. This would cause the first few mutations
605
- // to *not* be adjusted, even though they would be impacted by mutation or
606
- // vice-versa after later adjustments are applied. Therefore, we just keep
607
- // recursing while there are any changes. This isn't great, but is good enough
608
- // for now until we change these data-structures.
609
- bool changed = true;
610
- while (changed) {
611
- changed = false;
612
- candidateMutations.erase(
613
- std::remove_if(
614
- candidateMutations.begin(),
615
- candidateMutations.end(),
616
- [&mutation, &isRemoveMutation, &isInsertMutation, &changed](
617
- ShadowViewMutation *candidateMutation) {
618
- if (isRemoveMutation &&
619
- mutation.index <= candidateMutation->index) {
620
- candidateMutation->index--;
621
- changed = true;
622
- PrintMutationInstructionRelative(
623
- "[IndexAdjustment] adjustDelayedMutationIndicesForMutation: Adjusting mutation DOWNWARD",
624
- mutation,
625
- *candidateMutation);
626
- return true;
627
- } else if (
628
- isInsertMutation &&
629
- mutation.index <= candidateMutation->index) {
630
- candidateMutation->index++;
631
- changed = true;
632
- PrintMutationInstructionRelative(
633
- "[IndexAdjustment] adjustDelayedMutationIndicesForMutation: Adjusting mutation UPWARD",
634
- mutation,
635
- *candidateMutation);
636
- return true;
637
- }
638
- return false;
639
- }),
640
- candidateMutations.end());
641
- }
642
- }
643
-
644
- void LayoutAnimationKeyFrameManager::getAndEraseConflictingAnimations(
645
- SurfaceId surfaceId,
646
- ShadowViewMutationList const &mutations,
647
- std::vector<AnimationKeyFrame> &conflictingAnimations) const {
648
- ShadowViewMutationList localConflictingMutations{};
649
- for (auto const &mutation : mutations) {
650
- bool mutationIsCreateOrDelete =
651
- mutation.type == ShadowViewMutation::Type::Create ||
652
- mutation.type == ShadowViewMutation::Type::Delete;
653
- auto const &baselineShadowView =
654
- (mutation.type == ShadowViewMutation::Type::Insert ||
655
- mutation.type == ShadowViewMutation::Type::Create)
656
- ? mutation.newChildShadowView
657
- : mutation.oldChildShadowView;
658
- auto baselineTag = baselineShadowView.tag;
659
292
 
660
- for (auto &inflightAnimation : inflightAnimations_) {
661
- if (inflightAnimation.surfaceId != surfaceId) {
662
- continue;
663
- }
664
- if (inflightAnimation.completed) {
665
- continue;
666
- }
293
+ // Process mutations list into operations that can be sent to platform
294
+ // immediately, and those that need to be animated Deletions, removals,
295
+ // updates are delayed and animated. Creations and insertions are sent to
296
+ // platform and then "animated in" with opacity updates. Upon completion,
297
+ // removals and deletions are sent to platform
298
+ ShadowViewMutation::List immediateMutations;
667
299
 
668
- for (auto it = inflightAnimation.keyFrames.begin();
669
- it != inflightAnimation.keyFrames.end();) {
670
- auto &animatedKeyFrame = *it;
300
+ // Remove operations that are actually moves should be copied to
301
+ // "immediate mutations". The corresponding "insert" will also be executed
302
+ // immediately and animated as an update.
303
+ std::vector<AnimationKeyFrame> keyFramesToAnimate;
304
+ auto const layoutAnimationConfig = animation.layoutAnimationConfig;
305
+ for (auto const &mutation : mutations) {
306
+ ShadowView baselineShadowView =
307
+ (mutation.type == ShadowViewMutation::Type::Delete ||
308
+ mutation.type == ShadowViewMutation::Type::Remove ||
309
+ mutation.type == ShadowViewMutation::Type::Update
310
+ ? mutation.oldChildShadowView
311
+ : mutation.newChildShadowView);
312
+ react_native_assert(baselineShadowView.tag > 0);
313
+ bool haveComponentDescriptor =
314
+ hasComponentDescriptorForShadowView(baselineShadowView);
671
315
 
672
- if (animatedKeyFrame.invalidated) {
316
+ // Immediately execute any mutations on a root node
317
+ if (baselineShadowView.traits.check(
318
+ ShadowNodeTraits::Trait::RootNodeKind)) {
319
+ immediateMutations.push_back(mutation);
673
320
  continue;
674
321
  }
675
322
 
676
- // A conflict is when either: the animated node itself is mutated
677
- // directly; or, the parent of the node is created or deleted. In cases
678
- // of reparenting - say, the parent is deleted but the node was moved to
679
- // a different parent first - the reparenting (remove/insert) conflict
680
- // will be detected before we process the parent DELETE.
681
- // Parent deletion is important because deleting a parent recursively
682
- // deletes all children. If we previously deferred deletion of a child,
683
- // we need to force deletion/removal to happen immediately.
684
- bool conflicting = animatedKeyFrame.tag == baselineTag ||
685
- (mutationIsCreateOrDelete &&
686
- animatedKeyFrame.parentView.tag == baselineTag &&
687
- animatedKeyFrame.parentView.tag != 0);
688
-
689
- // Conflicting animation detected: if we're mutating a tag under
690
- // animation, or deleting the parent of a tag under animation, or
691
- // reparenting.
692
- if (conflicting) {
693
- animatedKeyFrame.invalidated = true;
694
-
695
- // We construct a list of all conflicting animations, whether or not
696
- // they have a "final mutation" to execute. This is important with,
697
- // for example, "insert" mutations where the final update needs to set
698
- // opacity to "1", even if there's no final ShadowNode update.
699
- // TODO: don't animate virtual views in the first place?
700
- bool isVirtual = false;
701
- for (const auto &finalMutationForKeyFrame :
702
- animatedKeyFrame.finalMutationsForKeyFrame) {
703
- isVirtual =
704
- isVirtual || finalMutationForKeyFrame.mutatedViewIsVirtual();
323
+ better::optional<ShadowViewMutation> executeMutationImmediately{};
705
324
 
706
- #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
707
- PrintMutationInstructionRelative(
708
- "Found mutation that conflicts with existing in-flight animation:",
709
- mutation,
710
- finalMutationForKeyFrame);
711
- #endif
712
- }
325
+ bool isRemoveReinserted =
326
+ mutation.type == ShadowViewMutation::Type::Remove &&
327
+ insertedTags.find(mutation.oldChildShadowView.tag) !=
328
+ insertedTags.end();
713
329
 
714
- conflictingAnimations.push_back(animatedKeyFrame);
715
- for (const auto &finalMutationForKeyFrame :
716
- animatedKeyFrame.finalMutationsForKeyFrame) {
717
- if (!isVirtual ||
718
- finalMutationForKeyFrame.type ==
719
- ShadowViewMutation::Type::Delete) {
720
- localConflictingMutations.push_back(finalMutationForKeyFrame);
721
- }
722
- }
330
+ // Reparenting can result in a node being removed, inserted (moved) and
331
+ // also deleted and created in the same frame, with the same props etc.
332
+ // This should eventually be optimized out of the diffing algorithm, but
333
+ // for now we detect reparenting and prevent the corresponding
334
+ // Delete/Create instructions from being animated.
335
+ bool isReparented =
336
+ reparentedTags.find(baselineShadowView.tag) != reparentedTags.end();
723
337
 
724
- // Delete from existing animation
725
- it = inflightAnimation.keyFrames.erase(it);
726
- } else {
727
- it++;
728
- }
729
- }
730
- }
731
- }
732
-
733
- // Recurse, in case conflicting mutations conflict with other existing
734
- // animations
735
- if (!localConflictingMutations.empty()) {
736
- getAndEraseConflictingAnimations(
737
- surfaceId, localConflictingMutations, conflictingAnimations);
738
- }
739
- }
740
-
741
- void LayoutAnimationKeyFrameManager::setClockNow(
742
- std::function<uint64_t()> now) {
743
- now_ = now;
744
- }
745
-
746
- better::optional<MountingTransaction>
747
- LayoutAnimationKeyFrameManager::pullTransaction(
748
- SurfaceId surfaceId,
749
- MountingTransaction::Number transactionNumber,
750
- TransactionTelemetry const &telemetry,
751
- ShadowViewMutationList mutations) const {
752
- // Current time in milliseconds
753
- uint64_t now = now_();
754
-
755
- bool inflightAnimationsExistInitially = !inflightAnimations_.empty();
756
-
757
- // Execute stopSurface on any ongoing animations
758
- if (inflightAnimationsExistInitially) {
759
- std::vector<SurfaceId> surfaceIdsToStop{};
760
- {
761
- std::lock_guard<std::mutex> lock(surfaceIdsToStopMutex_);
762
- surfaceIdsToStop = surfaceIdsToStop_;
763
- surfaceIdsToStop_ = {};
764
- }
765
-
766
- for (auto it = inflightAnimations_.begin();
767
- it != inflightAnimations_.end();) {
768
- const auto &animation = *it;
769
-
770
- if (std::find(
771
- surfaceIdsToStop.begin(),
772
- surfaceIdsToStop.end(),
773
- animation.surfaceId) != surfaceIdsToStop.end()) {
774
- #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
775
- LOG(ERROR)
776
- << "LayoutAnimations: stopping animation due to stopSurface on "
777
- << surfaceId;
778
- #endif
779
- it = inflightAnimations_.erase(it);
780
- } else {
781
- it++;
782
- }
783
- }
784
- }
785
-
786
- if (!mutations.empty()) {
787
- #ifdef RN_SHADOW_TREE_INTROSPECTION
788
- {
789
- std::stringstream ss(getDebugDescription(mutations, {}));
790
- std::string to;
791
- while (std::getline(ss, to, '\n')) {
792
- LOG(ERROR)
793
- << "LayoutAnimationKeyFrameManager.cpp: got mutation list: Line: "
794
- << to;
795
- }
796
- };
797
- #endif
798
-
799
- // DEBUG ONLY: list existing inflight animations
800
- #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
801
- LOG(ERROR) << "BEGINNING DISPLAYING ONGOING inflightAnimations_!";
802
- int i = 0;
803
- int j = 0;
804
- for (auto const &inflightAnimation : inflightAnimations_) {
805
- i++;
806
- j = 0;
807
- if (inflightAnimation.completed) {
808
- continue;
809
- }
810
- for (auto &keyframe : inflightAnimation.keyFrames) {
811
- j++;
812
- if (keyframe.invalidated) {
813
- continue;
814
- }
815
- for (const auto &finalMutationForKeyFrame :
816
- keyframe.finalMutationsForKeyFrame) {
817
- if (finalMutationForKeyFrame.mutatedViewIsVirtual()) {
818
- std::string msg = "Animation " + std::to_string(i) + " keyframe " +
819
- std::to_string(j) + ": Final Animation";
820
- PrintMutationInstruction(msg, finalMutationForKeyFrame);
821
- } else {
822
- LOG(ERROR) << "Animation " << i << " keyframe " << j
823
- << ": on tag: [" << keyframe.viewStart.tag << "]";
824
- }
825
- }
826
- }
827
- }
828
- LOG(ERROR) << "BEGINNING DONE DISPLAYING ONGOING inflightAnimations_!";
829
- #endif
830
-
831
- // What to do if we detect a conflict? Get current value and make
832
- // that the baseline of the next animation. Scale the remaining time
833
- // in the animation
834
- // Types of conflicts and how we handle them:
835
- // Update -> update: remove the previous update, make it the baseline of the
836
- // next update (with current progress) Update -> remove: same, with final
837
- // mutation being a remove Insert -> update: treat as update->update Insert
838
- // -> remove: same, as update->remove Remove -> update/insert: not possible
839
- // We just collect pairs here of <Mutation, AnimationConfig> and delete them
840
- // from active animations. If another animation is queued up from the
841
- // current mutations then these deleted mutations will serve as the baseline
842
- // for the next animation. If not, the current mutations are executed
843
- // immediately without issues.
844
- std::vector<AnimationKeyFrame> conflictingAnimations{};
845
- getAndEraseConflictingAnimations(
846
- surfaceId, mutations, conflictingAnimations);
847
-
848
- // Are we animating this list of mutations?
849
- better::optional<LayoutAnimation> currentAnimation{};
850
- {
851
- std::lock_guard<std::mutex> lock(currentAnimationMutex_);
852
- if (currentAnimation_) {
853
- currentAnimation = std::move(currentAnimation_);
854
- currentAnimation_ = {};
855
- }
856
- }
857
-
858
- if (currentAnimation) {
859
- LayoutAnimation animation = std::move(currentAnimation.value());
860
- currentAnimation = {};
861
- animation.surfaceId = surfaceId;
862
- animation.startTime = now;
863
-
864
- // Pre-process list to:
865
- // Catch remove+reinsert (reorders)
866
- // Catch delete+create (reparenting) (this should be optimized away at
867
- // the diffing level eventually?)
868
- // TODO: to prevent this step we could tag Remove/Insert mutations as
869
- // being moves on the Differ level, since we know that there? We could use
870
- // TinyMap here, but it's not exposed by Differentiator (yet).
871
- std::vector<Tag> insertedTags;
872
- std::vector<Tag> deletedTags;
873
- std::vector<Tag> reparentedTags; // tags that are deleted and recreated
874
- std::unordered_map<Tag, ShadowViewMutation> movedTags;
875
- for (const auto &mutation : mutations) {
876
- if (mutation.type == ShadowViewMutation::Type::Insert) {
877
- insertedTags.push_back(mutation.newChildShadowView.tag);
878
- }
879
- if (mutation.type == ShadowViewMutation::Type::Delete) {
880
- deletedTags.push_back(mutation.oldChildShadowView.tag);
881
- }
882
- if (mutation.type == ShadowViewMutation::Type::Create) {
883
- if (std::find(
884
- deletedTags.begin(),
885
- deletedTags.end(),
886
- mutation.newChildShadowView.tag) != deletedTags.end()) {
887
- reparentedTags.push_back(mutation.newChildShadowView.tag);
888
- }
889
- }
890
- }
891
-
892
- // Process mutations list into operations that can be sent to platform
893
- // immediately, and those that need to be animated Deletions, removals,
894
- // updates are delayed and animated. Creations and insertions are sent to
895
- // platform and then "animated in" with opacity updates. Upon completion,
896
- // removals and deletions are sent to platform
897
- ShadowViewMutation::List immediateMutations;
898
-
899
- // Remove operations that are actually moves should be copied to
900
- // "immediate mutations". The corresponding "insert" will also be executed
901
- // immediately and animated as an update.
902
- std::vector<AnimationKeyFrame> keyFramesToAnimate;
903
- std::vector<AnimationKeyFrame> movesToAnimate;
904
- auto const layoutAnimationConfig = animation.layoutAnimationConfig;
905
- for (auto const &mutation : mutations) {
906
- ShadowView baselineShadowView =
907
- (mutation.type == ShadowViewMutation::Type::Delete ||
908
- mutation.type == ShadowViewMutation::Type::Remove ||
909
- mutation.type == ShadowViewMutation::Type::Update
910
- ? mutation.oldChildShadowView
911
- : mutation.newChildShadowView);
912
- react_native_assert(baselineShadowView.tag > 0);
913
- bool haveComponentDescriptor =
914
- hasComponentDescriptorForShadowView(baselineShadowView);
915
-
916
- better::optional<ShadowViewMutation> executeMutationImmediately{};
917
-
918
- bool isRemoveReinserted =
919
- mutation.type == ShadowViewMutation::Type::Remove &&
920
- std::find(
921
- insertedTags.begin(),
922
- insertedTags.end(),
923
- mutation.oldChildShadowView.tag) != insertedTags.end();
924
-
925
- // Reparenting can result in a node being removed, inserted (moved) and
926
- // also deleted and created in the same frame, with the same props etc.
927
- // This should eventually be optimized out of the diffing algorithm, but
928
- // for now we detect reparenting and prevent the corresponding
929
- // Delete/Create instructions from being animated.
930
- bool isReparented = std::find(
931
- reparentedTags.begin(),
932
- reparentedTags.end(),
933
- baselineShadowView.tag) != reparentedTags.end();
934
-
935
- if (isRemoveReinserted) {
936
- movedTags.insert({mutation.oldChildShadowView.tag, mutation});
338
+ if (isRemoveReinserted) {
339
+ movedTags.insert({mutation.oldChildShadowView.tag, mutation});
937
340
  }
938
341
 
939
342
  // Inserts that follow a "remove" of the same tag should be treated as
@@ -963,16 +366,6 @@ LayoutAnimationKeyFrameManager::pullTransaction(
963
366
  bool haveConfiguration =
964
367
  mutationConfig.animationType != AnimationType::None;
965
368
 
966
- if (wasInsertedTagRemoved && haveConfiguration) {
967
- movesToAnimate.push_back(AnimationKeyFrame{
968
- {},
969
- AnimationConfigurationType::Update,
970
- mutation.newChildShadowView.tag,
971
- mutation.parentShadowView,
972
- movedIt->second.oldChildShadowView,
973
- mutation.newChildShadowView});
974
- }
975
-
976
369
  // Creates and inserts should also be executed immediately.
977
370
  // Mutations that would otherwise be animated, but have no
978
371
  // configuration, are also executed immediately.
@@ -1035,12 +428,11 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1035
428
  // that is being referenced by the REMOVE mutation.
1036
429
  if (keyframe.type == AnimationConfigurationType::Update &&
1037
430
  mutation.oldChildShadowView.tag > 0) {
1038
- executeMutationImmediately = ShadowViewMutation{
1039
- mutation.type,
1040
- mutation.parentShadowView,
1041
- keyframe.viewPrev,
1042
- {},
1043
- mutation.index};
431
+ executeMutationImmediately =
432
+ ShadowViewMutation::RemoveMutation(
433
+ mutation.parentShadowView,
434
+ keyframe.viewPrev,
435
+ mutation.index);
1044
436
  }
1045
437
  }
1046
438
  }
@@ -1075,15 +467,13 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1075
467
  haveComponentDescriptor) {
1076
468
  auto props =
1077
469
  getComponentDescriptorForShadowView(baselineShadowView)
1078
- .cloneProps(viewStart.props, {});
1079
-
1080
- // Dynamic cast, because - we don't know the type of this
1081
- // ShadowNode, it could be Image or Text or something else with
1082
- // different base props.
1083
- const auto viewProps =
1084
- dynamic_cast<const ViewProps *>(props.get());
1085
- if (viewProps != nullptr) {
1086
- const_cast<ViewProps *>(viewProps)->opacity = 0;
470
+ .cloneProps(propsParserContext, viewStart.props, {});
471
+
472
+ if (baselineShadowView.traits.check(
473
+ ShadowNodeTraits::Trait::ViewKind)) {
474
+ auto const &viewProps =
475
+ *std::static_pointer_cast<ViewProps const>(props);
476
+ const_cast<ViewProps &>(viewProps).opacity = 0;
1087
477
  }
1088
478
 
1089
479
  react_native_assert(props != nullptr);
@@ -1100,15 +490,12 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1100
490
  if ((isScaleX || isScaleY) && haveComponentDescriptor) {
1101
491
  auto props =
1102
492
  getComponentDescriptorForShadowView(baselineShadowView)
1103
- .cloneProps(viewStart.props, {});
1104
-
1105
- // Dynamic cast, because - we don't know the type of this
1106
- // ShadowNode, it could be Image or Text or something else with
1107
- // different base props.
1108
- const auto viewProps =
1109
- dynamic_cast<const ViewProps *>(props.get());
1110
- if (viewProps != nullptr) {
1111
- const_cast<ViewProps *>(viewProps)->transform =
493
+ .cloneProps(propsParserContext, viewStart.props, {});
494
+ if (baselineShadowView.traits.check(
495
+ ShadowNodeTraits::Trait::ViewKind)) {
496
+ auto const &viewProps =
497
+ *std::static_pointer_cast<ViewProps const>(props);
498
+ const_cast<ViewProps &>(viewProps).transform =
1112
499
  Transform::Scale(isScaleX ? 0 : 1, isScaleY ? 0 : 1, 1);
1113
500
  }
1114
501
 
@@ -1123,14 +510,14 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1123
510
  mutation);
1124
511
 
1125
512
  keyFrame = AnimationKeyFrame{
1126
- {},
1127
- AnimationConfigurationType::Create,
1128
- tag,
1129
- parent,
1130
- viewStart,
1131
- viewFinal,
1132
- baselineShadowView,
1133
- 0};
513
+ /* .finalMutationsForKeyFrame = */ {},
514
+ /* .type = */ AnimationConfigurationType::Create,
515
+ /* .tag = */ tag,
516
+ /* .parentView = */ parent,
517
+ /* .viewStart = */ viewStart,
518
+ /* .viewEnd = */ viewFinal,
519
+ /* .viewPrev = */ baselineShadowView,
520
+ /* .initialProgress = */ 0};
1134
521
  } else if (mutation.type == ShadowViewMutation::Type::Delete) {
1135
522
  // This is just for assertion purposes.
1136
523
  // The NDEBUG check here is to satisfy the compiler in certain environments
@@ -1161,14 +548,14 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1161
548
  mutation);
1162
549
 
1163
550
  keyFrame = AnimationKeyFrame{
1164
- {mutation},
1165
- AnimationConfigurationType::Update,
1166
- tag,
1167
- parent,
1168
- viewStart,
1169
- viewFinal,
1170
- baselineShadowView,
1171
- 0};
551
+ /* .finalMutationsForKeyFrame = */ {mutation},
552
+ /* .type = */ AnimationConfigurationType::Update,
553
+ /* .tag = */ tag,
554
+ /* .parentView = */ parent,
555
+ /* .viewStart = */ viewStart,
556
+ /* .viewEnd = */ viewFinal,
557
+ /* .viewPrev = */ baselineShadowView,
558
+ /* .initialProgress = */ 0};
1172
559
  } else {
1173
560
  // This should just be "Remove" instructions that are not animated
1174
561
  // (either this is a "move", or there's a corresponding "Delete"
@@ -1203,15 +590,13 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1203
590
  haveComponentDescriptor) {
1204
591
  auto props =
1205
592
  getComponentDescriptorForShadowView(baselineShadowView)
1206
- .cloneProps(viewFinal.props, {});
1207
-
1208
- // Dynamic cast, because - we don't know the type of this
1209
- // ShadowNode, it could be Image or Text or something else with
1210
- // different base props.
1211
- const auto viewProps =
1212
- dynamic_cast<const ViewProps *>(props.get());
1213
- if (viewProps != nullptr) {
1214
- const_cast<ViewProps *>(viewProps)->opacity = 0;
593
+ .cloneProps(propsParserContext, viewFinal.props, {});
594
+
595
+ if (baselineShadowView.traits.check(
596
+ ShadowNodeTraits::Trait::ViewKind)) {
597
+ auto const &viewProps =
598
+ *std::static_pointer_cast<ViewProps const>(props);
599
+ const_cast<ViewProps &>(viewProps).opacity = 0;
1215
600
  }
1216
601
 
1217
602
  react_native_assert(props != nullptr);
@@ -1230,15 +615,13 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1230
615
  if ((isScaleX || isScaleY) && haveComponentDescriptor) {
1231
616
  auto props =
1232
617
  getComponentDescriptorForShadowView(baselineShadowView)
1233
- .cloneProps(viewFinal.props, {});
1234
-
1235
- // Dynamic cast, because - we don't know the type of this
1236
- // ShadowNode, it could be Image or Text or something else with
1237
- // different base props.
1238
- const auto viewProps =
1239
- dynamic_cast<const ViewProps *>(props.get());
1240
- if (viewProps != nullptr) {
1241
- const_cast<ViewProps *>(viewProps)->transform =
618
+ .cloneProps(propsParserContext, viewFinal.props, {});
619
+
620
+ if (baselineShadowView.traits.check(
621
+ ShadowNodeTraits::Trait::ViewKind)) {
622
+ auto const &viewProps =
623
+ *std::static_pointer_cast<ViewProps const>(props);
624
+ const_cast<ViewProps &>(viewProps).transform =
1242
625
  Transform::Scale(isScaleX ? 0 : 1, isScaleY ? 0 : 1, 1);
1243
626
  }
1244
627
 
@@ -1253,14 +636,14 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1253
636
  mutation);
1254
637
 
1255
638
  keyFrame = AnimationKeyFrame{
1256
- {mutation, deleteMutation},
1257
- AnimationConfigurationType::Delete,
1258
- tag,
1259
- parent,
1260
- viewStart,
1261
- viewFinal,
1262
- baselineShadowView,
1263
- 0};
639
+ /* .finalMutationsForKeyFrame */ {mutation, deleteMutation},
640
+ /* .type */ AnimationConfigurationType::Delete,
641
+ /* .tag */ tag,
642
+ /* .parentView */ parent,
643
+ /* .viewStart */ viewStart,
644
+ /* .viewEnd */ viewFinal,
645
+ /* .viewPrev */ baselineShadowView,
646
+ /* .initialProgress */ 0};
1264
647
  } else {
1265
648
  PrintMutationInstruction(
1266
649
  "Executing Remove Immediately, due to reordering operation",
@@ -1399,7 +782,7 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1399
782
  // don't want to queue up any final UPDATE mutations here.
1400
783
  bool shouldGenerateSyntheticMutations =
1401
784
  keyFrame.generateFinalSyntheticMutations;
1402
- bool numFinalMutations = keyFrame.finalMutationsForKeyFrame.size();
785
+ auto numFinalMutations = keyFrame.finalMutationsForKeyFrame.size();
1403
786
  bool onlyMutationIsUpdate =
1404
787
  (numFinalMutations == 1 &&
1405
788
  keyFrame.finalMutationsForKeyFrame[0].type ==
@@ -1559,328 +942,738 @@ LayoutAnimationKeyFrameManager::pullTransaction(
1559
942
  "Conflict with non-animated mutation");
1560
943
  }
1561
944
 
1562
- // Make sure that all operations execute in the proper order.
1563
- // REMOVE operations with highest indices must operate first.
1564
- std::stable_sort(
1565
- finalMutationsForConflictingAnimations.begin(),
1566
- finalMutationsForConflictingAnimations.end(),
1567
- &shouldFirstComeBeforeSecondMutation);
945
+ // Make sure that all operations execute in the proper order.
946
+ // REMOVE operations with highest indices must operate first.
947
+ std::stable_sort(
948
+ finalMutationsForConflictingAnimations.begin(),
949
+ finalMutationsForConflictingAnimations.end(),
950
+ &shouldFirstComeBeforeSecondMutation);
951
+
952
+ #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
953
+ LOG(ERROR)
954
+ << "No Animation: Adjust delayed mutations based on all finalMutationsForConflictingAnimations";
955
+ #endif
956
+ for (auto const &mutation : finalMutationsForConflictingAnimations) {
957
+ if (mutation.type == ShadowViewMutation::Type::Remove ||
958
+ mutation.type == ShadowViewMutation::Type::Insert) {
959
+ adjustDelayedMutationIndicesForMutation(surfaceId, mutation);
960
+ }
961
+ }
962
+
963
+ // The ShadowTree layer doesn't realize that certain operations have
964
+ // been delayed, so we must adjust all Remove and Insert operations
965
+ // based on what else has been deferred, whether we are executing this
966
+ // immediately or later.
967
+ #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
968
+ LOG(ERROR)
969
+ << "No Animation: Adjust mutations based on remaining delayed mutations / adjust delayed, based on each";
970
+ #endif
971
+ for (auto &mutation : mutations) {
972
+ if (mutation.type == ShadowViewMutation::Type::Remove ||
973
+ mutation.type == ShadowViewMutation::Type::Insert) {
974
+ adjustImmediateMutationIndicesForDelayedMutations(
975
+ surfaceId, mutation);
976
+ adjustDelayedMutationIndicesForMutation(surfaceId, mutation);
977
+ }
978
+ }
979
+
980
+ // Append mutations to this list and swap - so that the final
981
+ // conflicting mutations happen before any other mutations
982
+ finalMutationsForConflictingAnimations.insert(
983
+ finalMutationsForConflictingAnimations.end(),
984
+ mutations.begin(),
985
+ mutations.end());
986
+ mutations = finalMutationsForConflictingAnimations;
987
+ }
988
+ } // if (mutations)
989
+
990
+ // We never commit a different root or modify anything -
991
+ // we just send additional mutations to the mounting layer until the
992
+ // animations are finished and the mounting layer (view) represents exactly
993
+ // what is in the most recent shadow tree
994
+ // Add animation mutations to the end of our existing mutations list in this
995
+ // function.
996
+ ShadowViewMutationList mutationsForAnimation{};
997
+ animationMutationsForFrame(surfaceId, mutationsForAnimation, now);
998
+
999
+ // If any delayed removes were executed, update remaining delayed keyframes
1000
+ #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1001
+ LOG(ERROR)
1002
+ << "Adjust all delayed mutations based on final mutations generated by animation driver";
1003
+ #endif
1004
+ for (auto const &mutation : mutationsForAnimation) {
1005
+ if (mutation.type == ShadowViewMutation::Type::Remove) {
1006
+ adjustDelayedMutationIndicesForMutation(surfaceId, mutation);
1007
+ }
1008
+ }
1009
+
1010
+ mutations.insert(
1011
+ mutations.end(),
1012
+ mutationsForAnimation.begin(),
1013
+ mutationsForAnimation.end());
1014
+
1015
+ // DEBUG ONLY: list existing inflight animations
1016
+ #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1017
+ LOG(ERROR) << "FINISHING DISPLAYING ONGOING inflightAnimations_!";
1018
+ int i = 0;
1019
+ int j = 0;
1020
+ for (auto const &inflightAnimation : inflightAnimations_) {
1021
+ i++;
1022
+ j = 0;
1023
+ if (inflightAnimation.completed) {
1024
+ continue;
1025
+ }
1026
+ for (auto &keyframe : inflightAnimation.keyFrames) {
1027
+ j++;
1028
+ if (keyframe.invalidated) {
1029
+ continue;
1030
+ }
1031
+ for (auto const &finalMutation : keyframe.finalMutationsForKeyFrame) {
1032
+ if (!finalMutation.mutatedViewIsVirtual()) {
1033
+ std::string msg = "Animation " + std::to_string(i) + " keyframe " +
1034
+ std::to_string(j) + ": Final Animation";
1035
+ PrintMutationInstruction(msg, finalMutation);
1036
+ }
1037
+ }
1038
+ }
1039
+ }
1040
+ LOG(ERROR) << "FINISHING DONE DISPLAYING ONGOING inflightAnimations_!";
1041
+ #endif
1042
+
1043
+ // Signal to delegate if all animations are complete, or if we were not
1044
+ // animating anything and now some animation exists.
1045
+ if (inflightAnimationsExistInitially && inflightAnimations_.empty()) {
1046
+ std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
1047
+ if (layoutAnimationStatusDelegate_ != nullptr) {
1048
+ layoutAnimationStatusDelegate_->onAllAnimationsComplete();
1049
+ }
1050
+ } else if (
1051
+ !inflightAnimationsExistInitially && !inflightAnimations_.empty()) {
1052
+ std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
1053
+ if (layoutAnimationStatusDelegate_ != nullptr) {
1054
+ layoutAnimationStatusDelegate_->onAnimationStarted();
1055
+ }
1056
+ }
1057
+
1058
+ simulateImagePropsMemoryAccess(mutations);
1059
+
1060
+ return MountingTransaction{
1061
+ surfaceId, transactionNumber, std::move(mutations), telemetry};
1062
+ }
1063
+
1064
+ void LayoutAnimationKeyFrameManager::uiManagerDidConfigureNextLayoutAnimation(
1065
+ LayoutAnimation layoutAnimation) const {
1066
+ currentAnimation_ = better::optional<LayoutAnimation>{layoutAnimation};
1067
+ }
1068
+
1069
+ void LayoutAnimationKeyFrameManager::setLayoutAnimationStatusDelegate(
1070
+ LayoutAnimationStatusDelegate *delegate) const {
1071
+ std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
1072
+ layoutAnimationStatusDelegate_ = delegate;
1073
+ }
1074
+
1075
+ void LayoutAnimationKeyFrameManager::setClockNow(
1076
+ std::function<uint64_t()> now) {
1077
+ now_ = now;
1078
+ }
1079
+
1080
+ void LayoutAnimationKeyFrameManager::enableSkipInvalidatedKeyFrames() {
1081
+ skipInvalidatedKeyFrames_ = true;
1082
+ }
1083
+
1084
+ void LayoutAnimationKeyFrameManager::enableCrashOnMissingComponentDescriptor() {
1085
+ crashOnMissingComponentDescriptor_ = true;
1086
+ }
1087
+
1088
+ void LayoutAnimationKeyFrameManager::enableSimulateImagePropsMemoryAccess() {
1089
+ simulateImagePropsMemoryAccess_ = true;
1090
+ }
1091
+
1092
+ #pragma mark - Protected
1093
+
1094
+ bool LayoutAnimationKeyFrameManager::hasComponentDescriptorForShadowView(
1095
+ ShadowView const &shadowView) const {
1096
+ auto hasComponentDescriptor =
1097
+ componentDescriptorRegistry_->hasComponentDescriptorAt(
1098
+ shadowView.componentHandle);
1099
+
1100
+ if (crashOnMissingComponentDescriptor_ && !hasComponentDescriptor) {
1101
+ LOG(FATAL) << "Component descriptor with handle: "
1102
+ << shadowView.componentHandle
1103
+ << " doesn't exist. The component name: "
1104
+ << shadowView.componentName;
1105
+ }
1106
+
1107
+ return hasComponentDescriptor;
1108
+ }
1109
+
1110
+ ComponentDescriptor const &
1111
+ LayoutAnimationKeyFrameManager::getComponentDescriptorForShadowView(
1112
+ ShadowView const &shadowView) const {
1113
+ return componentDescriptorRegistry_->at(shadowView.componentHandle);
1114
+ }
1115
+
1116
+ ShadowView LayoutAnimationKeyFrameManager::createInterpolatedShadowView(
1117
+ double progress,
1118
+ ShadowView const &startingView,
1119
+ ShadowView const &finalView) const {
1120
+ react_native_assert(startingView.tag > 0);
1121
+ react_native_assert(finalView.tag > 0);
1122
+ if (!hasComponentDescriptorForShadowView(startingView)) {
1123
+ LOG(ERROR) << "No ComponentDescriptor for ShadowView being animated: ["
1124
+ << startingView.tag << "]";
1125
+ react_native_assert(false);
1126
+ return finalView;
1127
+ }
1128
+
1129
+ ComponentDescriptor const &componentDescriptor =
1130
+ getComponentDescriptorForShadowView(startingView);
1131
+
1132
+ // Base the mutated view on the finalView, so that the following stay
1133
+ // consistent:
1134
+ // - state
1135
+ // - eventEmitter
1136
+ // For now, we do not allow interpolation of state. And we probably never
1137
+ // will, so make sure we always keep the mounting layer consistent with the
1138
+ // "final" state.
1139
+ auto mutatedShadowView = ShadowView(finalView);
1140
+ react_native_assert(mutatedShadowView.tag > 0);
1141
+
1142
+ react_native_assert(startingView.props != nullptr);
1143
+ react_native_assert(finalView.props != nullptr);
1144
+ if (startingView.props == nullptr || finalView.props == nullptr) {
1145
+ return finalView;
1146
+ }
1147
+
1148
+ // Animate opacity or scale/transform
1149
+ PropsParserContext propsParserContext{
1150
+ finalView.surfaceId, *contextContainer_};
1151
+ mutatedShadowView.props = componentDescriptor.interpolateProps(
1152
+ propsParserContext, progress, startingView.props, finalView.props);
1153
+ react_native_assert(mutatedShadowView.props != nullptr);
1154
+ if (mutatedShadowView.props == nullptr) {
1155
+ return finalView;
1156
+ }
1157
+
1158
+ // Interpolate LayoutMetrics
1159
+ LayoutMetrics const &finalLayoutMetrics = finalView.layoutMetrics;
1160
+ LayoutMetrics const &baselineLayoutMetrics = startingView.layoutMetrics;
1161
+ LayoutMetrics interpolatedLayoutMetrics = finalLayoutMetrics;
1162
+ interpolatedLayoutMetrics.frame.origin.x = interpolateFloats(
1163
+ progress,
1164
+ baselineLayoutMetrics.frame.origin.x,
1165
+ finalLayoutMetrics.frame.origin.x);
1166
+ interpolatedLayoutMetrics.frame.origin.y = interpolateFloats(
1167
+ progress,
1168
+ baselineLayoutMetrics.frame.origin.y,
1169
+ finalLayoutMetrics.frame.origin.y);
1170
+ interpolatedLayoutMetrics.frame.size.width = interpolateFloats(
1171
+ progress,
1172
+ baselineLayoutMetrics.frame.size.width,
1173
+ finalLayoutMetrics.frame.size.width);
1174
+ interpolatedLayoutMetrics.frame.size.height = interpolateFloats(
1175
+ progress,
1176
+ baselineLayoutMetrics.frame.size.height,
1177
+ finalLayoutMetrics.frame.size.height);
1178
+ mutatedShadowView.layoutMetrics = interpolatedLayoutMetrics;
1179
+
1180
+ return mutatedShadowView;
1181
+ }
1182
+
1183
+ void LayoutAnimationKeyFrameManager::callCallback(
1184
+ LayoutAnimationCallbackWrapper const &callback) const {
1185
+ runtimeExecutor_(
1186
+ [callback](jsi::Runtime &runtime) { callback.call(runtime); });
1187
+ }
1188
+
1189
+ void LayoutAnimationKeyFrameManager::queueFinalMutationsForCompletedKeyFrame(
1190
+ AnimationKeyFrame const &keyframe,
1191
+ ShadowViewMutation::List &mutationsList,
1192
+ bool interrupted,
1193
+ const std::string &logPrefix) const {
1194
+ if (skipInvalidatedKeyFrames_ && keyframe.invalidated) {
1195
+ return;
1196
+ }
1197
+ if (keyframe.finalMutationsForKeyFrame.size() > 0) {
1198
+ // TODO: modularize this segment, it is repeated 2x in KeyFrameManager
1199
+ // as well.
1200
+ ShadowView prev = keyframe.viewPrev;
1201
+ for (auto const &finalMutation : keyframe.finalMutationsForKeyFrame) {
1202
+ PrintMutationInstruction(
1203
+ logPrefix + ": Queuing up Final Mutation:", finalMutation);
1204
+ // Copy so that if something else mutates the inflight animations,
1205
+ // it won't change this mutation after this point.
1206
+ switch (finalMutation.type) {
1207
+ // For CREATE/INSERT this will contain CREATE, INSERT in that order.
1208
+ // For REMOVE/DELETE, same.
1209
+ case ShadowViewMutation::Type::Create:
1210
+ mutationsList.push_back(ShadowViewMutation::CreateMutation(
1211
+ finalMutation.newChildShadowView));
1212
+ break;
1213
+ case ShadowViewMutation::Type::Delete:
1214
+ mutationsList.push_back(ShadowViewMutation::DeleteMutation(prev));
1215
+ break;
1216
+ case ShadowViewMutation::Type::Insert:
1217
+ mutationsList.push_back(ShadowViewMutation::InsertMutation(
1218
+ finalMutation.parentShadowView,
1219
+ finalMutation.newChildShadowView,
1220
+ finalMutation.index));
1221
+ break;
1222
+ case ShadowViewMutation::Type::Remove:
1223
+ mutationsList.push_back(ShadowViewMutation::RemoveMutation(
1224
+ finalMutation.parentShadowView, prev, finalMutation.index));
1225
+ break;
1226
+ case ShadowViewMutation::Type::Update:
1227
+ mutationsList.push_back(ShadowViewMutation::UpdateMutation(
1228
+ prev, finalMutation.newChildShadowView));
1229
+ break;
1230
+ }
1231
+ if (finalMutation.newChildShadowView.tag > 0) {
1232
+ prev = finalMutation.newChildShadowView;
1233
+ }
1234
+ }
1235
+ } else {
1236
+ // If there's no final mutation associated, create a mutation that
1237
+ // corresponds to the animation being 100% complete. This is
1238
+ // important for, for example, INSERT mutations being animated from
1239
+ // opacity 0 to 1. If the animation is interrupted we must force the
1240
+ // View to be at opacity 1. For Android - since it passes along only
1241
+ // deltas, not an entire bag of props - generate an "animation"
1242
+ // frame corresponding to a final update for this view. Only then,
1243
+ // generate an update that will cause the ShadowTree to be
1244
+ // consistent with the Mounting layer by passing viewEnd,
1245
+ // unmodified, to the mounting layer. This helps with, for example,
1246
+ // opacity animations.
1247
+ // This is necessary for INSERT (create) and UPDATE (update) mutations, but
1248
+ // not REMOVE/DELETE mutations ("delete" animations).
1249
+ if (interrupted) {
1250
+ auto mutatedShadowView =
1251
+ createInterpolatedShadowView(1, keyframe.viewStart, keyframe.viewEnd);
1252
+ auto generatedPenultimateMutation = ShadowViewMutation::UpdateMutation(
1253
+ keyframe.viewPrev, mutatedShadowView);
1254
+ react_native_assert(
1255
+ generatedPenultimateMutation.oldChildShadowView.tag > 0);
1256
+ react_native_assert(
1257
+ generatedPenultimateMutation.newChildShadowView.tag > 0);
1258
+ PrintMutationInstruction(
1259
+ "Queueing up penultimate mutation instruction - synthetic",
1260
+ generatedPenultimateMutation);
1261
+ mutationsList.push_back(generatedPenultimateMutation);
1262
+
1263
+ auto generatedMutation = ShadowViewMutation::UpdateMutation(
1264
+ mutatedShadowView, keyframe.viewEnd);
1265
+ react_native_assert(generatedMutation.oldChildShadowView.tag > 0);
1266
+ react_native_assert(generatedMutation.newChildShadowView.tag > 0);
1267
+ PrintMutationInstruction(
1268
+ "Queueing up final mutation instruction - synthetic",
1269
+ generatedMutation);
1270
+ mutationsList.push_back(generatedMutation);
1271
+ } else {
1272
+ auto mutation = ShadowViewMutation::UpdateMutation(
1273
+ keyframe.viewPrev, keyframe.viewEnd);
1274
+ PrintMutationInstruction(
1275
+ logPrefix +
1276
+ "Animation Complete: Queuing up Final Synthetic Mutation:",
1277
+ mutation);
1278
+ react_native_assert(mutation.oldChildShadowView.tag > 0);
1279
+ react_native_assert(mutation.newChildShadowView.tag > 0);
1280
+ mutationsList.push_back(std::move(mutation));
1281
+ }
1282
+ }
1283
+ }
1284
+
1285
+ #pragma mark - Private
1286
+
1287
+ void LayoutAnimationKeyFrameManager::
1288
+ adjustImmediateMutationIndicesForDelayedMutations(
1289
+ SurfaceId surfaceId,
1290
+ ShadowViewMutation &mutation,
1291
+ bool skipLastAnimation,
1292
+ bool lastAnimationOnly) const {
1293
+ bool isRemoveMutation = mutation.type == ShadowViewMutation::Type::Remove;
1294
+ react_native_assert(
1295
+ isRemoveMutation || mutation.type == ShadowViewMutation::Type::Insert);
1296
+
1297
+ // TODO: turn all of this into a lambda and share code?
1298
+ if (mutation.mutatedViewIsVirtual()) {
1299
+ PrintMutationInstruction(
1300
+ "[IndexAdjustment] Not calling adjustImmediateMutationIndicesForDelayedMutations, is virtual, for:",
1301
+ mutation);
1302
+ return;
1303
+ }
1304
+
1305
+ PrintMutationInstruction(
1306
+ "[IndexAdjustment] Calling adjustImmediateMutationIndicesForDelayedMutations for:",
1307
+ mutation);
1308
+
1309
+ // First, collect all final mutations that could impact this immediate
1310
+ // mutation.
1311
+ std::vector<ShadowViewMutation *> candidateMutations{};
1312
+
1313
+ for (auto inflightAnimationIt =
1314
+ inflightAnimations_.rbegin() + (skipLastAnimation ? 1 : 0);
1315
+ inflightAnimationIt != inflightAnimations_.rend();
1316
+ inflightAnimationIt++) {
1317
+ auto &inflightAnimation = *inflightAnimationIt;
1318
+ if (inflightAnimation.surfaceId != surfaceId) {
1319
+ continue;
1320
+ }
1321
+ if (inflightAnimation.completed) {
1322
+ continue;
1323
+ }
1324
+
1325
+ for (auto it = inflightAnimation.keyFrames.begin();
1326
+ it != inflightAnimation.keyFrames.end();
1327
+ it++) {
1328
+ auto &animatedKeyFrame = *it;
1568
1329
 
1569
- #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1570
- LOG(ERROR)
1571
- << "No Animation: Adjust delayed mutations based on all finalMutationsForConflictingAnimations";
1572
- #endif
1573
- for (auto const &mutation : finalMutationsForConflictingAnimations) {
1574
- if (mutation.type == ShadowViewMutation::Type::Remove ||
1575
- mutation.type == ShadowViewMutation::Type::Insert) {
1576
- adjustDelayedMutationIndicesForMutation(surfaceId, mutation);
1577
- }
1330
+ if (animatedKeyFrame.invalidated) {
1331
+ continue;
1578
1332
  }
1579
1333
 
1580
- // The ShadowTree layer doesn't realize that certain operations have
1581
- // been delayed, so we must adjust all Remove and Insert operations
1582
- // based on what else has been deferred, whether we are executing this
1583
- // immediately or later.
1584
- #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1585
- LOG(ERROR)
1586
- << "No Animation: Adjust mutations based on remaining delayed mutations / adjust delayed, based on each";
1587
- #endif
1588
- for (auto &mutation : mutations) {
1589
- if (mutation.type == ShadowViewMutation::Type::Remove ||
1590
- mutation.type == ShadowViewMutation::Type::Insert) {
1591
- adjustImmediateMutationIndicesForDelayedMutations(
1592
- surfaceId, mutation);
1593
- adjustDelayedMutationIndicesForMutation(surfaceId, mutation);
1334
+ // Detect if they're in the same view hierarchy, but not equivalent
1335
+ // We've already detected direct conflicts and removed them.
1336
+ if (animatedKeyFrame.parentView.tag != mutation.parentShadowView.tag) {
1337
+ continue;
1338
+ }
1339
+
1340
+ for (auto &delayedMutation : animatedKeyFrame.finalMutationsForKeyFrame) {
1341
+ if (delayedMutation.type != ShadowViewMutation::Type::Remove) {
1342
+ continue;
1343
+ }
1344
+ if (delayedMutation.mutatedViewIsVirtual()) {
1345
+ continue;
1594
1346
  }
1347
+ if (delayedMutation.oldChildShadowView.tag ==
1348
+ (isRemoveMutation ? mutation.oldChildShadowView.tag
1349
+ : mutation.newChildShadowView.tag)) {
1350
+ continue;
1351
+ }
1352
+
1353
+ PrintMutationInstructionRelative(
1354
+ "[IndexAdjustment] adjustImmediateMutationIndicesForDelayedMutations CANDIDATE for:",
1355
+ mutation,
1356
+ delayedMutation);
1357
+ candidateMutations.push_back(&delayedMutation);
1595
1358
  }
1359
+ }
1596
1360
 
1597
- // Append mutations to this list and swap - so that the final
1598
- // conflicting mutations happen before any other mutations
1599
- finalMutationsForConflictingAnimations.insert(
1600
- finalMutationsForConflictingAnimations.end(),
1601
- mutations.begin(),
1602
- mutations.end());
1603
- mutations = finalMutationsForConflictingAnimations;
1361
+ if (lastAnimationOnly) {
1362
+ break;
1604
1363
  }
1605
- } // if (mutations)
1364
+ }
1606
1365
 
1607
- // We never commit a different root or modify anything -
1608
- // we just send additional mutations to the mounting layer until the
1609
- // animations are finished and the mounting layer (view) represents exactly
1610
- // what is in the most recent shadow tree
1611
- // Add animation mutations to the end of our existing mutations list in this
1612
- // function.
1613
- ShadowViewMutationList mutationsForAnimation{};
1614
- animationMutationsForFrame(surfaceId, mutationsForAnimation, now);
1366
+ // While the mutation keeps being affected, keep checking. We use the vector
1367
+ // so we only perform one adjustment per delayed mutation. See comments at
1368
+ // bottom of adjustDelayedMutationIndicesForMutation for further explanation.
1369
+ bool changed = true;
1370
+ int adjustedDelta = 0;
1371
+ while (changed) {
1372
+ changed = false;
1373
+ candidateMutations.erase(
1374
+ std::remove_if(
1375
+ candidateMutations.begin(),
1376
+ candidateMutations.end(),
1377
+ [&changed, &mutation, &adjustedDelta, &isRemoveMutation](
1378
+ ShadowViewMutation *candidateMutation) {
1379
+ bool indexConflicts =
1380
+ (candidateMutation->index < mutation.index ||
1381
+ (isRemoveMutation &&
1382
+ candidateMutation->index == mutation.index));
1383
+ if (indexConflicts) {
1384
+ mutation.index++;
1385
+ adjustedDelta++;
1386
+ changed = true;
1387
+ PrintMutationInstructionRelative(
1388
+ "[IndexAdjustment] adjustImmediateMutationIndicesForDelayedMutations: Adjusting mutation UPWARD",
1389
+ mutation,
1390
+ *candidateMutation);
1391
+ return true;
1392
+ }
1393
+ return false;
1394
+ }),
1395
+ candidateMutations.end());
1396
+ }
1397
+ }
1615
1398
 
1616
- // If any delayed removes were executed, update remaining delayed keyframes
1617
- #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1618
- LOG(ERROR)
1619
- << "Adjust all delayed mutations based on final mutations generated by animation driver";
1620
- #endif
1621
- for (auto const &mutation : mutationsForAnimation) {
1622
- if (mutation.type == ShadowViewMutation::Type::Remove) {
1623
- adjustDelayedMutationIndicesForMutation(surfaceId, mutation);
1624
- }
1399
+ void LayoutAnimationKeyFrameManager::adjustDelayedMutationIndicesForMutation(
1400
+ SurfaceId surfaceId,
1401
+ ShadowViewMutation const &mutation,
1402
+ bool skipLastAnimation) const {
1403
+ bool isRemoveMutation = mutation.type == ShadowViewMutation::Type::Remove;
1404
+ bool isInsertMutation = mutation.type == ShadowViewMutation::Type::Insert;
1405
+ auto tag = isRemoveMutation ? mutation.oldChildShadowView.tag
1406
+ : mutation.newChildShadowView.tag;
1407
+ react_native_assert(isRemoveMutation || isInsertMutation);
1408
+
1409
+ if (mutation.mutatedViewIsVirtual()) {
1410
+ PrintMutationInstruction(
1411
+ "[IndexAdjustment] Not calling adjustDelayedMutationIndicesForMutation, is virtual, for:",
1412
+ mutation);
1413
+ return;
1625
1414
  }
1626
1415
 
1627
- mutations.insert(
1628
- mutations.end(),
1629
- mutationsForAnimation.begin(),
1630
- mutationsForAnimation.end());
1416
+ // First, collect all final mutations that could impact this immediate
1417
+ // mutation.
1418
+ std::vector<ShadowViewMutation *> candidateMutations{};
1631
1419
 
1632
- // DEBUG ONLY: list existing inflight animations
1633
- #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1634
- LOG(ERROR) << "FINISHING DISPLAYING ONGOING inflightAnimations_!";
1635
- int i = 0;
1636
- int j = 0;
1637
- for (auto const &inflightAnimation : inflightAnimations_) {
1638
- i++;
1639
- j = 0;
1420
+ for (auto inflightAnimationIt =
1421
+ inflightAnimations_.rbegin() + (skipLastAnimation ? 1 : 0);
1422
+ inflightAnimationIt != inflightAnimations_.rend();
1423
+ inflightAnimationIt++) {
1424
+ auto &inflightAnimation = *inflightAnimationIt;
1425
+
1426
+ if (inflightAnimation.surfaceId != surfaceId) {
1427
+ continue;
1428
+ }
1640
1429
  if (inflightAnimation.completed) {
1641
1430
  continue;
1642
1431
  }
1643
- for (auto &keyframe : inflightAnimation.keyFrames) {
1644
- j++;
1645
- if (keyframe.invalidated) {
1432
+
1433
+ for (auto it = inflightAnimation.keyFrames.begin();
1434
+ it != inflightAnimation.keyFrames.end();
1435
+ it++) {
1436
+ auto &animatedKeyFrame = *it;
1437
+
1438
+ if (animatedKeyFrame.invalidated) {
1439
+ continue;
1440
+ }
1441
+
1442
+ // Detect if they're in the same view hierarchy, but not equivalent
1443
+ // (We've already detected direct conflicts and handled them above)
1444
+ if (animatedKeyFrame.parentView.tag != mutation.parentShadowView.tag) {
1445
+ continue;
1446
+ }
1447
+
1448
+ for (auto &finalAnimationMutation :
1449
+ animatedKeyFrame.finalMutationsForKeyFrame) {
1450
+ if (finalAnimationMutation.oldChildShadowView.tag == tag) {
1451
+ continue;
1452
+ }
1453
+
1454
+ if (finalAnimationMutation.type != ShadowViewMutation::Type::Remove) {
1455
+ continue;
1456
+ }
1457
+ if (finalAnimationMutation.mutatedViewIsVirtual()) {
1458
+ continue;
1459
+ }
1460
+
1461
+ PrintMutationInstructionRelative(
1462
+ "[IndexAdjustment] adjustDelayedMutationIndicesForMutation: CANDIDATE:",
1463
+ mutation,
1464
+ finalAnimationMutation);
1465
+ candidateMutations.push_back(&finalAnimationMutation);
1466
+ }
1467
+ }
1468
+ }
1469
+
1470
+ // Because the finalAnimations are not sorted in any way, it is possible to
1471
+ // have some sequence like:
1472
+ // * DELAYED REMOVE 10 from {TAG}
1473
+ // * DELAYED REMOVE 9 from {TAG}
1474
+ // * ...
1475
+ // * DELAYED REMOVE 5 from {TAG}
1476
+ // with mutation: INSERT 6/REMOVE 6. This would cause the first few mutations
1477
+ // to *not* be adjusted, even though they would be impacted by mutation or
1478
+ // vice-versa after later adjustments are applied. Therefore, we just keep
1479
+ // recursing while there are any changes. This isn't great, but is good enough
1480
+ // for now until we change these data-structures.
1481
+ bool changed = true;
1482
+ while (changed) {
1483
+ changed = false;
1484
+ candidateMutations.erase(
1485
+ std::remove_if(
1486
+ candidateMutations.begin(),
1487
+ candidateMutations.end(),
1488
+ [&mutation, &isRemoveMutation, &isInsertMutation, &changed](
1489
+ ShadowViewMutation *candidateMutation) {
1490
+ if (isRemoveMutation &&
1491
+ mutation.index <= candidateMutation->index) {
1492
+ candidateMutation->index--;
1493
+ changed = true;
1494
+ PrintMutationInstructionRelative(
1495
+ "[IndexAdjustment] adjustDelayedMutationIndicesForMutation: Adjusting mutation DOWNWARD",
1496
+ mutation,
1497
+ *candidateMutation);
1498
+ return true;
1499
+ } else if (
1500
+ isInsertMutation &&
1501
+ mutation.index <= candidateMutation->index) {
1502
+ candidateMutation->index++;
1503
+ changed = true;
1504
+ PrintMutationInstructionRelative(
1505
+ "[IndexAdjustment] adjustDelayedMutationIndicesForMutation: Adjusting mutation UPWARD",
1506
+ mutation,
1507
+ *candidateMutation);
1508
+ return true;
1509
+ }
1510
+ return false;
1511
+ }),
1512
+ candidateMutations.end());
1513
+ }
1514
+ }
1515
+
1516
+ void LayoutAnimationKeyFrameManager::getAndEraseConflictingAnimations(
1517
+ SurfaceId surfaceId,
1518
+ ShadowViewMutationList const &mutations,
1519
+ std::vector<AnimationKeyFrame> &conflictingAnimations) const {
1520
+ ShadowViewMutationList localConflictingMutations{};
1521
+ for (auto const &mutation : mutations) {
1522
+ bool mutationIsCreateOrDelete =
1523
+ mutation.type == ShadowViewMutation::Type::Create ||
1524
+ mutation.type == ShadowViewMutation::Type::Delete;
1525
+ auto const &baselineShadowView =
1526
+ (mutation.type == ShadowViewMutation::Type::Insert ||
1527
+ mutation.type == ShadowViewMutation::Type::Create)
1528
+ ? mutation.newChildShadowView
1529
+ : mutation.oldChildShadowView;
1530
+ auto baselineTag = baselineShadowView.tag;
1531
+
1532
+ for (auto &inflightAnimation : inflightAnimations_) {
1533
+ if (inflightAnimation.surfaceId != surfaceId) {
1646
1534
  continue;
1647
1535
  }
1648
- for (auto const &finalMutation : keyframe.finalMutationsForKeyFrame) {
1649
- if (!finalMutation.mutatedViewIsVirtual()) {
1650
- std::string msg = "Animation " + std::to_string(i) + " keyframe " +
1651
- std::to_string(j) + ": Final Animation";
1652
- PrintMutationInstruction(msg, finalMutation);
1653
- }
1536
+ if (inflightAnimation.completed) {
1537
+ continue;
1654
1538
  }
1655
- }
1656
- }
1657
- LOG(ERROR) << "FINISHING DONE DISPLAYING ONGOING inflightAnimations_!";
1658
- #endif
1659
1539
 
1660
- // Signal to delegate if all animations are complete, or if we were not
1661
- // animating anything and now some animation exists.
1662
- if (inflightAnimationsExistInitially && inflightAnimations_.empty()) {
1663
- std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
1664
- if (layoutAnimationStatusDelegate_ != nullptr) {
1665
- layoutAnimationStatusDelegate_->onAllAnimationsComplete();
1666
- }
1667
- } else if (
1668
- !inflightAnimationsExistInitially && !inflightAnimations_.empty()) {
1669
- std::lock_guard<std::mutex> lock(layoutAnimationStatusDelegateMutex_);
1670
- if (layoutAnimationStatusDelegate_ != nullptr) {
1671
- layoutAnimationStatusDelegate_->onAnimationStarted();
1672
- }
1673
- }
1540
+ for (auto it = inflightAnimation.keyFrames.begin();
1541
+ it != inflightAnimation.keyFrames.end();) {
1542
+ auto &animatedKeyFrame = *it;
1674
1543
 
1675
- return MountingTransaction{
1676
- surfaceId, transactionNumber, std::move(mutations), telemetry};
1677
- }
1544
+ if (animatedKeyFrame.invalidated) {
1545
+ continue;
1546
+ }
1678
1547
 
1679
- bool LayoutAnimationKeyFrameManager::hasComponentDescriptorForShadowView(
1680
- ShadowView const &shadowView) const {
1681
- return componentDescriptorRegistry_->hasComponentDescriptorAt(
1682
- shadowView.componentHandle);
1683
- }
1548
+ // A conflict is when either: the animated node itself is mutated
1549
+ // directly; or, the parent of the node is created or deleted. In cases
1550
+ // of reparenting - say, the parent is deleted but the node was moved to
1551
+ // a different parent first - the reparenting (remove/insert) conflict
1552
+ // will be detected before we process the parent DELETE.
1553
+ // Parent deletion is important because deleting a parent recursively
1554
+ // deletes all children. If we previously deferred deletion of a child,
1555
+ // we need to force deletion/removal to happen immediately.
1556
+ bool conflicting = animatedKeyFrame.tag == baselineTag ||
1557
+ (mutationIsCreateOrDelete &&
1558
+ animatedKeyFrame.parentView.tag == baselineTag &&
1559
+ animatedKeyFrame.parentView.tag != 0);
1684
1560
 
1685
- ComponentDescriptor const &
1686
- LayoutAnimationKeyFrameManager::getComponentDescriptorForShadowView(
1687
- ShadowView const &shadowView) const {
1688
- return componentDescriptorRegistry_->at(shadowView.componentHandle);
1689
- }
1561
+ // Conflicting animation detected: if we're mutating a tag under
1562
+ // animation, or deleting the parent of a tag under animation, or
1563
+ // reparenting.
1564
+ if (conflicting) {
1565
+ animatedKeyFrame.invalidated = true;
1690
1566
 
1691
- void LayoutAnimationKeyFrameManager::setComponentDescriptorRegistry(
1692
- const SharedComponentDescriptorRegistry &componentDescriptorRegistry) {
1693
- componentDescriptorRegistry_ = componentDescriptorRegistry;
1694
- }
1567
+ // We construct a list of all conflicting animations, whether or not
1568
+ // they have a "final mutation" to execute. This is important with,
1569
+ // for example, "insert" mutations where the final update needs to set
1570
+ // opacity to "1", even if there's no final ShadowNode update.
1571
+ // TODO: don't animate virtual views in the first place?
1572
+ bool isVirtual = false;
1573
+ for (const auto &finalMutationForKeyFrame :
1574
+ animatedKeyFrame.finalMutationsForKeyFrame) {
1575
+ isVirtual =
1576
+ isVirtual || finalMutationForKeyFrame.mutatedViewIsVirtual();
1695
1577
 
1696
- /**
1697
- * Given a `progress` between 0 and 1, a mutation and LayoutAnimation config,
1698
- * return a ShadowView with mutated props and/or LayoutMetrics.
1699
- *
1700
- * @param progress
1701
- * @param layoutAnimation
1702
- * @param animatedMutation
1703
- * @return
1704
- */
1705
- ShadowView LayoutAnimationKeyFrameManager::createInterpolatedShadowView(
1706
- double progress,
1707
- ShadowView startingView,
1708
- ShadowView finalView) const {
1709
- react_native_assert(startingView.tag > 0);
1710
- react_native_assert(finalView.tag > 0);
1711
- if (!hasComponentDescriptorForShadowView(startingView)) {
1712
- react_native_assert(false);
1713
- return finalView;
1714
- }
1715
- ComponentDescriptor const &componentDescriptor =
1716
- getComponentDescriptorForShadowView(startingView);
1578
+ #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1579
+ PrintMutationInstructionRelative(
1580
+ "Found mutation that conflicts with existing in-flight animation:",
1581
+ mutation,
1582
+ finalMutationForKeyFrame);
1583
+ #endif
1584
+ }
1717
1585
 
1718
- // Base the mutated view on the finalView, so that the following stay
1719
- // consistent:
1720
- // - state
1721
- // - eventEmitter
1722
- // For now, we do not allow interpolation of state. And we probably never
1723
- // will, so make sure we always keep the mounting layer consistent with the
1724
- // "final" state.
1725
- auto mutatedShadowView = ShadowView(finalView);
1726
- react_native_assert(mutatedShadowView.tag > 0);
1586
+ conflictingAnimations.push_back(animatedKeyFrame);
1587
+ for (const auto &finalMutationForKeyFrame :
1588
+ animatedKeyFrame.finalMutationsForKeyFrame) {
1589
+ if (!isVirtual ||
1590
+ finalMutationForKeyFrame.type ==
1591
+ ShadowViewMutation::Type::Delete) {
1592
+ localConflictingMutations.push_back(finalMutationForKeyFrame);
1593
+ }
1594
+ }
1727
1595
 
1728
- react_native_assert(startingView.props != nullptr);
1729
- react_native_assert(finalView.props != nullptr);
1730
- if (startingView.props == nullptr || finalView.props == nullptr) {
1731
- return finalView;
1596
+ // Delete from existing animation
1597
+ it = inflightAnimation.keyFrames.erase(it);
1598
+ } else {
1599
+ it++;
1600
+ }
1601
+ }
1602
+ }
1732
1603
  }
1733
1604
 
1734
- // Animate opacity or scale/transform
1735
- mutatedShadowView.props = componentDescriptor.interpolateProps(
1736
- progress, startingView.props, finalView.props);
1737
- react_native_assert(mutatedShadowView.props != nullptr);
1738
- if (mutatedShadowView.props == nullptr) {
1739
- return finalView;
1605
+ // Recurse, in case conflicting mutations conflict with other existing
1606
+ // animations
1607
+ if (!localConflictingMutations.empty()) {
1608
+ getAndEraseConflictingAnimations(
1609
+ surfaceId, localConflictingMutations, conflictingAnimations);
1740
1610
  }
1741
-
1742
- // Interpolate LayoutMetrics
1743
- LayoutMetrics const &finalLayoutMetrics = finalView.layoutMetrics;
1744
- LayoutMetrics const &baselineLayoutMetrics = startingView.layoutMetrics;
1745
- LayoutMetrics interpolatedLayoutMetrics = finalLayoutMetrics;
1746
- interpolatedLayoutMetrics.frame.origin.x = interpolateFloats(
1747
- progress,
1748
- baselineLayoutMetrics.frame.origin.x,
1749
- finalLayoutMetrics.frame.origin.x);
1750
- interpolatedLayoutMetrics.frame.origin.y = interpolateFloats(
1751
- progress,
1752
- baselineLayoutMetrics.frame.origin.y,
1753
- finalLayoutMetrics.frame.origin.y);
1754
- interpolatedLayoutMetrics.frame.size.width = interpolateFloats(
1755
- progress,
1756
- baselineLayoutMetrics.frame.size.width,
1757
- finalLayoutMetrics.frame.size.width);
1758
- interpolatedLayoutMetrics.frame.size.height = interpolateFloats(
1759
- progress,
1760
- baselineLayoutMetrics.frame.size.height,
1761
- finalLayoutMetrics.frame.size.height);
1762
- mutatedShadowView.layoutMetrics = interpolatedLayoutMetrics;
1763
-
1764
- return mutatedShadowView;
1765
1611
  }
1766
1612
 
1767
- void LayoutAnimationKeyFrameManager::queueFinalMutationsForCompletedKeyFrame(
1768
- AnimationKeyFrame const &keyframe,
1769
- ShadowViewMutation::List &mutationsList,
1770
- bool interrupted,
1771
- std::string logPrefix) const {
1772
- if (keyframe.finalMutationsForKeyFrame.size() > 0) {
1773
- // TODO: modularize this segment, it is repeated 2x in KeyFrameManager
1774
- // as well.
1775
- ShadowView prev = keyframe.viewPrev;
1776
- for (auto const &finalMutation : keyframe.finalMutationsForKeyFrame) {
1777
- PrintMutationInstruction(
1778
- logPrefix + ": Queuing up Final Mutation:", finalMutation);
1779
- // Copy so that if something else mutates the inflight animations,
1780
- // it won't change this mutation after this point.
1781
- auto mutation = ShadowViewMutation{
1782
- finalMutation.type,
1783
- finalMutation.parentShadowView,
1784
- prev,
1785
- finalMutation.newChildShadowView,
1786
- finalMutation.index};
1787
- react_native_assert(mutation.oldChildShadowView.tag > 0);
1788
- react_native_assert(
1789
- mutation.newChildShadowView.tag > 0 ||
1790
- finalMutation.type == ShadowViewMutation::Remove ||
1791
- finalMutation.type == ShadowViewMutation::Delete);
1792
- mutationsList.push_back(mutation);
1793
- if (finalMutation.newChildShadowView.tag > 0) {
1794
- prev = finalMutation.newChildShadowView;
1795
- }
1613
+ void LayoutAnimationKeyFrameManager::deleteAnimationsForStoppedSurfaces()
1614
+ const {
1615
+ bool inflightAnimationsExistInitially = !inflightAnimations_.empty();
1616
+
1617
+ // Execute stopSurface on any ongoing animations
1618
+ if (inflightAnimationsExistInitially) {
1619
+ better::set<SurfaceId> surfaceIdsToStop{};
1620
+ {
1621
+ std::lock_guard<std::mutex> lock(surfaceIdsToStopMutex_);
1622
+ surfaceIdsToStop = surfaceIdsToStop_;
1623
+ surfaceIdsToStop_.clear();
1796
1624
  }
1797
- } else {
1798
- // If there's no final mutation associated, create a mutation that
1799
- // corresponds to the animation being 100% complete. This is
1800
- // important for, for example, INSERT mutations being animated from
1801
- // opacity 0 to 1. If the animation is interrupted we must force the
1802
- // View to be at opacity 1. For Android - since it passes along only
1803
- // deltas, not an entire bag of props - generate an "animation"
1804
- // frame corresponding to a final update for this view. Only then,
1805
- // generate an update that will cause the ShadowTree to be
1806
- // consistent with the Mounting layer by passing viewEnd,
1807
- // unmodified, to the mounting layer. This helps with, for example,
1808
- // opacity animations.
1809
- // This is necessary for INSERT (create) and UPDATE (update) mutations, but
1810
- // not REMOVE/DELETE mutations ("delete" animations).
1811
- if (interrupted) {
1812
- auto mutatedShadowView =
1813
- createInterpolatedShadowView(1, keyframe.viewStart, keyframe.viewEnd);
1814
- auto generatedPenultimateMutation = ShadowViewMutation::UpdateMutation(
1815
- keyframe.viewPrev, mutatedShadowView);
1816
- react_native_assert(
1817
- generatedPenultimateMutation.oldChildShadowView.tag > 0);
1818
- react_native_assert(
1819
- generatedPenultimateMutation.newChildShadowView.tag > 0);
1820
- PrintMutationInstruction(
1821
- "Queueing up penultimate mutation instruction - synthetic",
1822
- generatedPenultimateMutation);
1823
- mutationsList.push_back(generatedPenultimateMutation);
1824
1625
 
1825
- auto generatedMutation = ShadowViewMutation::UpdateMutation(
1826
- mutatedShadowView, keyframe.viewEnd);
1827
- react_native_assert(generatedMutation.oldChildShadowView.tag > 0);
1828
- react_native_assert(generatedMutation.newChildShadowView.tag > 0);
1829
- PrintMutationInstruction(
1830
- "Queueing up final mutation instruction - synthetic",
1831
- generatedMutation);
1832
- mutationsList.push_back(generatedMutation);
1833
- } else {
1834
- auto mutation = ShadowViewMutation{
1835
- ShadowViewMutation::Type::Update,
1836
- keyframe.parentView,
1837
- keyframe.viewPrev,
1838
- keyframe.viewEnd,
1839
- -1};
1840
- PrintMutationInstruction(
1841
- logPrefix +
1842
- "Animation Complete: Queuing up Final Synthetic Mutation:",
1843
- mutation);
1844
- react_native_assert(mutation.oldChildShadowView.tag > 0);
1845
- react_native_assert(mutation.newChildShadowView.tag > 0);
1846
- mutationsList.push_back(mutation);
1626
+ for (auto it = inflightAnimations_.begin();
1627
+ it != inflightAnimations_.end();) {
1628
+ const auto &animation = *it;
1629
+
1630
+ #ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
1631
+ LOG(ERROR)
1632
+ << "LayoutAnimations: stopping animation due to stopSurface on "
1633
+ << surfaceId;
1634
+ #endif
1635
+ if (surfaceIdsToStop.find(animation.surfaceId) !=
1636
+ surfaceIdsToStop.end()) {
1637
+ it = inflightAnimations_.erase(it);
1638
+ } else {
1639
+ it++;
1640
+ }
1847
1641
  }
1848
1642
  }
1849
1643
  }
1850
1644
 
1851
- void LayoutAnimationKeyFrameManager::callCallback(
1852
- const LayoutAnimationCallbackWrapper &callback) const {
1853
- if (callback.readyForCleanup()) {
1645
+ void LayoutAnimationKeyFrameManager::simulateImagePropsMemoryAccess(
1646
+ ShadowViewMutationList const &mutations) const {
1647
+ if (!simulateImagePropsMemoryAccess_) {
1854
1648
  return;
1855
1649
  }
1856
-
1857
- // Callbacks can only be called once. Replace the callsite with an empty
1858
- // CallbackWrapper. We use a unique_ptr to avoid copying into the vector.
1859
- std::unique_ptr<LayoutAnimationCallbackWrapper> copiedCallback(
1860
- std::make_unique<LayoutAnimationCallbackWrapper>(callback));
1861
-
1862
- // Call the callback that is being retained in the vector
1863
- copiedCallback->call(runtimeExecutor_);
1864
-
1865
- // Protect with a mutex: this can be called on failure callbacks in the JS
1866
- // thread and success callbacks on the UI thread
1867
- {
1868
- std::lock_guard<std::mutex> lock(callbackWrappersPendingMutex_);
1869
-
1870
- // Clean any stale data in the retention vector
1871
- callbackWrappersPending_.erase(
1872
- std::remove_if(
1873
- callbackWrappersPending_.begin(),
1874
- callbackWrappersPending_.end(),
1875
- [](const std::unique_ptr<LayoutAnimationCallbackWrapper> &wrapper) {
1876
- return wrapper->readyForCleanup();
1877
- }),
1878
- callbackWrappersPending_.end());
1879
-
1880
- // Hold onto a reference to the callback, only while
1881
- // LayoutAnimationKeyFrameManager is alive and the callback hasn't
1882
- // completed yet.
1883
- callbackWrappersPending_.push_back(std::move(copiedCallback));
1650
+ for (auto const &mutation : mutations) {
1651
+ if (mutation.type != ShadowViewMutation::Type::Insert) {
1652
+ continue;
1653
+ }
1654
+ if (strcmp(mutation.newChildShadowView.componentName, "Image") == 0) {
1655
+ auto const &imageProps = *std::static_pointer_cast<ImageProps const>(
1656
+ mutation.newChildShadowView.props);
1657
+ int temp = 0;
1658
+ switch (imageProps.resizeMode) {
1659
+ case ImageResizeMode::Cover:
1660
+ temp = 1;
1661
+ break;
1662
+ case ImageResizeMode::Contain:
1663
+ temp = 2;
1664
+ break;
1665
+ case ImageResizeMode::Stretch:
1666
+ temp = 3;
1667
+ break;
1668
+ case ImageResizeMode::Center:
1669
+ temp = 4;
1670
+ break;
1671
+ case ImageResizeMode::Repeat:
1672
+ temp = 5;
1673
+ break;
1674
+ }
1675
+ (void)temp;
1676
+ }
1884
1677
  }
1885
1678
  }
1886
1679