Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ inline const std::unordered_set<std::string> &getDirectManipulationAllowlist()
"borderStartStartRadius",
"elevation",
"opacity",
"filter",
"transform",
"zIndex",
/* ios styles */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "AnimationTestsBase.h"

#include <react/renderer/animated/internal/NativeAnimatedAllowlist.h>
#include <react/renderer/animated/nodes/ColorAnimatedNode.h>
#include <react/renderer/animated/nodes/ObjectAnimatedNode.h>
#include <react/renderer/core/ReactRootViewTagGenerator.h>
Expand Down Expand Up @@ -332,4 +333,61 @@ TEST_F(AnimatedNodeTests, ObjectAnimatedNode) {
EXPECT_EQ(collectedProps["test"][2]["scale3d"], 4);
}

// Styles that Animated supports and that do not participate in layout must be
// direct-manipulation eligible; anything absent from this set is treated as a
// layout update by StyleAnimatedNode and forced through a Fabric commit.
// Keep in sync with SUPPORTED_STYLES in
// packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js.
TEST_F(AnimatedNodeTests, directManipulationAllowlistCoversNonLayoutStyles) {
const auto& allowlist = getDirectManipulationAllowlist();

for (const auto& style :
{"backgroundColor",
"borderBottomColor",
"borderColor",
"borderEndColor",
"borderLeftColor",
"borderRightColor",
"borderStartColor",
"borderTopColor",
"color",
"tintColor",
"borderBottomEndRadius",
"borderBottomLeftRadius",
"borderBottomRightRadius",
"borderBottomStartRadius",
"borderEndEndRadius",
"borderEndStartRadius",
"borderRadius",
"borderTopEndRadius",
"borderTopLeftRadius",
"borderTopRightRadius",
"borderTopStartRadius",
"borderStartEndRadius",
"borderStartStartRadius",
"elevation",
"opacity",
"filter",
"transform",
"zIndex",
"shadowOpacity",
"shadowRadius",
"scaleX",
"scaleY",
"translateX",
"translateY"}) {
EXPECT_EQ(allowlist.count(style), 1u)
<< style
<< " is animatable and does not affect layout, so it must be "
"direct-manipulation eligible";
}

// Layout styles must stay out, so they keep going through Fabric.
for (const auto& style :
{"width", "height", "margin", "padding", "flex", "top", "gap"}) {
EXPECT_EQ(allowlist.count(style), 0u)
<< style << " affects layout and must not be direct-manipulated";
}
}

} // namespace facebook::react
Loading