Improve animation jitter in main menu

zio/stable
Paul Frazee 2022-11-01 10:02:24 -05:00
parent d0b94d7570
commit 6329ab4b08
1 changed files with 12 additions and 3 deletions

View File

@ -40,7 +40,7 @@ export const MainMenu = observer(
opacity: interpolate(initInterp.value, [0, 1.0], [0, 1.0]), opacity: interpolate(initInterp.value, [0, 1.0], [0, 1.0]),
})) }))
const menuItemsAnimStyle = useAnimatedStyle(() => ({ const menuItemsAnimStyle = useAnimatedStyle(() => ({
marginTop: interpolate(initInterp.value, [0, 1.0], [15, 0]), top: interpolate(initInterp.value, [0, 1.0], [15, 0]),
})) }))
// events // events
@ -154,7 +154,12 @@ export const MainMenu = observer(
/> />
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<Animated.View style={[styles.section, menuItemsAnimStyle]}> <Animated.View
style={[
styles.section,
styles.menuItemsAnimContainer,
menuItemsAnimStyle,
]}>
<View style={[styles.menuItems]}> <View style={[styles.menuItems]}>
<MenuItem icon="home" label="Home" url="/" /> <MenuItem icon="home" label="Home" url="/" />
<MenuItem <MenuItem
@ -217,8 +222,9 @@ const styles = StyleSheet.create({
topSection: { topSection: {
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
height: 40,
paddingHorizontal: 10, paddingHorizontal: 10,
paddingBottom: 10, marginBottom: 10,
}, },
section: { section: {
paddingHorizontal: 10, paddingHorizontal: 10,
@ -251,6 +257,9 @@ const styles = StyleSheet.create({
marginRight: 10, marginRight: 10,
}, },
menuItemsAnimContainer: {
position: 'relative',
},
menuItems: { menuItems: {
flexDirection: 'row', flexDirection: 'row',
marginBottom: 20, marginBottom: 20,