Skip to content

Instantly share code, notes, and snippets.

@enzomanuelmangano
Created May 19, 2021 16:41
Show Gist options
  • Save enzomanuelmangano/402037937e5903d6941c22c4f64c944a to your computer and use it in GitHub Desktop.
Save enzomanuelmangano/402037937e5903d6941c22c4f64c944a to your computer and use it in GitHub Desktop.
Prepare the stuff for backgroundColor interpolation
export default function App() {
const [theme, setTheme] = useState<Theme>('light');
const rStyle = useAnimatedStyle(() => {
return {
backgroundColor: Colors.light.background,
};
});
return (
<Animated.View style={[styles.container, rStyle]}>
<Switch
value={theme === 'dark'}
onValueChange={(toggled) => {
setTheme(toggled ? 'dark' : 'light');
}}
trackColor={SWITCH_TRACK_COLOR}
thumbColor={'violet'}
/>
</Animated.View>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment