From c4f8551fd745edfa166ccd19b87e5a168c98fcf9 Mon Sep 17 00:00:00 2001 From: Andreas Amsenius Date: Tue, 31 Oct 2017 05:59:47 -0700 Subject: [PATCH] Allow shadowOpacity and shadowRadius in NativeAnimated Summary: I want to animate `shadowOpacity` style property with Native Animated (`useNativeDriver: true`). This is useful for example in an ios-like navigation transition where the shadow fades in with the view that is sliding in from the side. Code comment for `STYLES_WHITELIST` says: _In general native animated implementation should support any numeric property that doesn't need to be updated through the shadow view hierarchy (all non-layout properties)._ so I just added `shadowOpacity` (and `shadowRadius` too because why not?). Before this change, setting `shadowOpacity` (or `shadowRadius`) to an `AnimatedValue` (with `useNativeDriver: true`) would throw the error: `Style property 'shadowOpacity' is not supported by the native animated module`. After adding `shadowOpacity` (and `shadowRadius`), there is no error. The animation looks correct so it seems to be working. I also tried setting a ridiculously large `shadowRadius` and could see that working too. Please advice on any further testing I should do. [IOS] [ENHANCEMENT] [NativeAnimated] - Allow `shadowRadius` and `shadowOpacity` as NativeAnimated style properties. Closes https://github.com/facebook/react-native/pull/16603 Differential Revision: D6195364 Pulled By: hramos fbshipit-source-id: a55630df43df3c8f9db9921dab0bfbf925b6a09f --- Libraries/Animated/src/NativeAnimatedHelper.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/Animated/src/NativeAnimatedHelper.js b/Libraries/Animated/src/NativeAnimatedHelper.js index cc25a4b9c..521ecfa7f 100644 --- a/Libraries/Animated/src/NativeAnimatedHelper.js +++ b/Libraries/Animated/src/NativeAnimatedHelper.js @@ -147,6 +147,9 @@ const API = { const STYLES_WHITELIST = { opacity: true, transform: true, + /* ios styles */ + shadowOpacity: true, + shadowRadius: true, /* legacy android transform properties */ scaleX: true, scaleY: true,