From 163ec924fb07cbfe3c984482da1bc0876142c1f3 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Fri, 29 May 2020 13:53:54 -0700 Subject: [PATCH] Disable restoreDefaultValues in Native Animated in Fabric Summary: Changelog: [Internal] # Problem Before every update, restoreDefaults is called on animated nodes. In paper this makes sure no stale properties are on animated nodes. In paper it works fine because restoreDefaults is called before mounting and animations are triggered after mounting within single commit. Details: https://github.com/facebook/react-native/pull/11819 In Fabric however it is called outside of other mounting operations and it applies default values to the view and then re-applies animated values. Reviewed By: JoshuaGross Differential Revision: D21786765 fbshipit-source-id: a2cb6d6d9cbd39d4c403c97c2f51e7d92078102f --- Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m index 222276993f4..5c31145d84f 100644 --- a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m @@ -75,6 +75,11 @@ - (void)restoreDefaultValues { + if (_managedByFabric) { + // Restoring to default values causes render of inconsistent state + // to the user because it isn't synchonised with Fabric's UIManager. + return; + } // Restore the default value for all props that were modified by this node. for (NSString *key in _propsDictionary.allKeys) { _propsDictionary[key] = [NSNull null];