Created
May 19, 2021 16:41
-
-
Save enzomanuelmangano/402037937e5903d6941c22c4f64c944a to your computer and use it in GitHub Desktop.
Prepare the stuff for backgroundColor interpolation
This file contains 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
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