Support DynamicColorIOS #8200
Replies: 2 comments 2 replies
-
Hi @chrisnojima, thanks for opening the discussion. What exactly do you mean by supporting DynamicColorIOS? Would you like to use them within |
Beta Was this translation helpful? Give feedback.
-
hi @chrisnojima! I've tried passing a static backgroundColor to an Animated component in Reanimated 4, and it works for me. Example code that's workingimport React, { useEffect, useState } from 'react';
import { Button,StyleSheet, View, DynamicColorIOS} from 'react-native';
import Animated, {interpolateColor,runOnUI, runOnJS, useAnimatedStyle, useSharedValue, withTiming, useAnimatedProps } from 'react-native-reanimated';
export default function EmptyExample() {
const opacity = useSharedValue(1);
const width = useSharedValue(100);
const backgroundColor = DynamicColorIOS({light: 'red', dark: 'blue'})
useEffect(() => {
const interval = setInterval(() => {
opacity.value = withTiming(opacity.value === 1 ? 0.2 : 1, {duration: 2000})
width.value = withTiming(width.value === 100 ? 200 : 100, {duration: 2000})
}
,2000
)
return () => clearInterval(interval)
},[])
const animatedStyle = useAnimatedStyle(() => {
return {
opacity: opacity.value,
width: width.value
};
});
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<Animated.View style={[styles.container, animatedStyle, {backgroundColor}]}/>
</View>
);
}
const styles = StyleSheet.create({
container: {
height: 100,
},
});
Screen.Recording.2025-09-09.at.09.29.17.movRegarding animations, I'll work on enabling them with DynamicColors in Reanimated :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Would it be possible to support DynamicColorIOS (https://reactnative.dev/docs/dynamiccolorios). We currently use this to have nice auto dark/light support on ios but these colors don't play nicely with animated views. We use these colors extensively and when we need to use an animated view we have to convert them. Is it a big lift to handle them natively in reanimated?
Beta Was this translation helpful? Give feedback.
All reactions