-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add support for remaining synchronous props on Android #7962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bartlomiejbloniarz
approved these changes
Jul 31, 2025
15 tasks
MatiPl01
pushed a commit
that referenced
this pull request
Aug 4, 2025
## Summary This PR adds support for the animating remaining synchronous props using a fast path on Android (which is still hidden behind `ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS` static Reanimated feature flag). After this change, all props from [NativeAnimatedAllowlist.js](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js) are supported, except for `scaleX`, `scaleY`, `translateX`, `translateY` (which are deprecated outside of `transform`), `shadowOffset`, `shadowOpacity` (which are not supported on Android at all) and `color` (which doesn't work for some unknown reason). Even though `elevation` and `zIndex` are supposed to be integers, I decided to pass them as double to achieve the same behavior as when animating them via `ShadowTree`. ## TODO * Add support other `react-native` props, e.g. `filter`, `outlineColor`, `placeholderTextColor` etc. * Add support for other `react-native-svg` props, e.g. `fill`, `stroke` etc. ## Test plan Enable `ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS` static feature flag <details> <summary> `tintColor` </summary> ```tsx import React, { useEffect } from 'react'; import { StyleSheet, View } from 'react-native'; import Animated, { interpolateColor, useAnimatedStyle, useSharedValue, withRepeat, withTiming, } from 'react-native-reanimated'; export default function EmptyExample() { const sv = useSharedValue(0); useEffect(() => { sv.value = 0; sv.value = withRepeat(withTiming(1, { duration: 500 }), -1, true); }, [sv]); const animatedStyle = useAnimatedStyle(() => { return { tintColor: interpolateColor(sv.value, [0, 1], ['red', 'blue']), }; }); return ( <View style={styles.container}> <Animated.Image style={[{ width: 50, height: 50 }, animatedStyle]} source={{ uri: 'https://raw.githubusercontent.com/facebook/react-native/refs/heads/main/packages/rn-tester/js/assets/uie_thumb_normal%402x.png', }} /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, }); ``` </details>
MatiPl01
pushed a commit
that referenced
this pull request
Aug 4, 2025
## Summary This PR adds support for the animating remaining synchronous props using a fast path on Android (which is still hidden behind `ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS` static Reanimated feature flag). After this change, all props from [NativeAnimatedAllowlist.js](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js) are supported, except for `scaleX`, `scaleY`, `translateX`, `translateY` (which are deprecated outside of `transform`), `shadowOffset`, `shadowOpacity` (which are not supported on Android at all) and `color` (which doesn't work for some unknown reason). Even though `elevation` and `zIndex` are supposed to be integers, I decided to pass them as double to achieve the same behavior as when animating them via `ShadowTree`. ## TODO * Add support other `react-native` props, e.g. `filter`, `outlineColor`, `placeholderTextColor` etc. * Add support for other `react-native-svg` props, e.g. `fill`, `stroke` etc. ## Test plan Enable `ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS` static feature flag <details> <summary> `tintColor` </summary> ```tsx import React, { useEffect } from 'react'; import { StyleSheet, View } from 'react-native'; import Animated, { interpolateColor, useAnimatedStyle, useSharedValue, withRepeat, withTiming, } from 'react-native-reanimated'; export default function EmptyExample() { const sv = useSharedValue(0); useEffect(() => { sv.value = 0; sv.value = withRepeat(withTiming(1, { duration: 500 }), -1, true); }, [sv]); const animatedStyle = useAnimatedStyle(() => { return { tintColor: interpolateColor(sv.value, [0, 1], ['red', 'blue']), }; }); return ( <View style={styles.container}> <Animated.Image style={[{ width: 50, height: 50 }, animatedStyle]} source={{ uri: 'https://raw.githubusercontent.com/facebook/react-native/refs/heads/main/packages/rn-tester/js/assets/uie_thumb_normal%402x.png', }} /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, }); ``` </details>
MatiPl01
pushed a commit
that referenced
this pull request
Aug 5, 2025
## Summary This PR adds support for the animating remaining synchronous props using a fast path on Android (which is still hidden behind `ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS` static Reanimated feature flag). After this change, all props from [NativeAnimatedAllowlist.js](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Animated/NativeAnimatedAllowlist.js) are supported, except for `scaleX`, `scaleY`, `translateX`, `translateY` (which are deprecated outside of `transform`), `shadowOffset`, `shadowOpacity` (which are not supported on Android at all) and `color` (which doesn't work for some unknown reason). Even though `elevation` and `zIndex` are supposed to be integers, I decided to pass them as double to achieve the same behavior as when animating them via `ShadowTree`. ## TODO * Add support other `react-native` props, e.g. `filter`, `outlineColor`, `placeholderTextColor` etc. * Add support for other `react-native-svg` props, e.g. `fill`, `stroke` etc. ## Test plan Enable `ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS` static feature flag <details> <summary> `tintColor` </summary> ```tsx import React, { useEffect } from 'react'; import { StyleSheet, View } from 'react-native'; import Animated, { interpolateColor, useAnimatedStyle, useSharedValue, withRepeat, withTiming, } from 'react-native-reanimated'; export default function EmptyExample() { const sv = useSharedValue(0); useEffect(() => { sv.value = 0; sv.value = withRepeat(withTiming(1, { duration: 500 }), -1, true); }, [sv]); const animatedStyle = useAnimatedStyle(() => { return { tintColor: interpolateColor(sv.value, [0, 1], ['red', 'blue']), }; }); return ( <View style={styles.container}> <Animated.Image style={[{ width: 50, height: 50 }, animatedStyle]} source={{ uri: 'https://raw.githubusercontent.com/facebook/react-native/refs/heads/main/packages/rn-tester/js/assets/uie_thumb_normal%402x.png', }} /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, }); ``` </details>
MatiPl01
added a commit
that referenced
this pull request
Aug 5, 2025
…7992) Cherry-pick of the #7962 Co-authored-by: Tomasz Zawadzki <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for the animating remaining synchronous props using a fast path on Android (which is still hidden behind
ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS
static Reanimated feature flag).After this change, all props from NativeAnimatedAllowlist.js are supported, except for
scaleX
,scaleY
,translateX
,translateY
(which are deprecated outside oftransform
),shadowOffset
,shadowOpacity
(which are not supported on Android at all) andcolor
(which doesn't work for some unknown reason).Even though
elevation
andzIndex
are supposed to be integers, I decided to pass them as double to achieve the same behavior as when animating them viaShadowTree
.TODO
react-native
props, e.g.filter
,outlineColor
,placeholderTextColor
etc.react-native-svg
props, e.g.fill
,stroke
etc.Test plan
Enable
ANDROID_SYNCHRONOUSLY_UPDATE_UI_PROPS
static feature flagtintColor