You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a header component that has a View sandwiched between two Views to keep it at the center. I want to animate this sandwiched view to the left and introduce a "close" button to the right when formVisible===true. Essentially,
From this:
[---View1---][---View2---][---View3---]
To this:
[---View2---][------------------Close-]
So, I remove View1 and View3 when the form is visible, and add the Close button with Layout.duration(2000).delay(300).springify() but it does not work smoothly. Here is a simplified video of it:
reanimated2-bug-report.mp4
Here is the minimalistic code. What am I missing?
Thanks for reading this through. :)
import{StyleSheet,Text,View}from"react-native";importReactfrom"react";importAnimated,{FadeInUp,FadeOutDown,Layout,}from"react-native-reanimated";typeProps={formVisible: boolean;};constBottomSheetHeader=({ formVisible }: Props)=>{return(<Animated.Viewstyle={{flexDirection: "row"}}layout={Layout.duration(2000).delay(300).springify()}>{// Filler block to keep title in the center when form is not visible!formVisible&&(<Animated.Viewstyle={{flexGrow: 1,backgroundColor: "yellow"}}/>)}<Animated.Viewstyle={styles.title}><Text>Edit Expense</Text></Animated.View>{//Filler block to keep title in the center when form is not visible!formVisible&&(<Animated.Viewstyle={{flexGrow: 1,backgroundColor: "yellow"}}/>)}{// This component enters when form is visibleformVisible&&(<Animated.Viewentering={FadeInUp}exiting={FadeOutDown}style={{flexGrow: 1,alignItems: "flex-end"}}><Text>X</Text></Animated.View>)}</Animated.View>);};exportdefaultBottomSheetHeader;conststyles=StyleSheet.create({title: {marginBottom: 10,alignItems: "center",justifyContent: "center",flexDirection: "row",backgroundColor: "red",},});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a header component that has a
View
sandwiched between twoView
s to keep it at the center. I want to animate this sandwiched view to the left and introduce a "close" button to the right whenformVisible===true
. Essentially,From this:
To this:
So, I remove
View1
andView3
when the form is visible, and add theClose
button withLayout.duration(2000).delay(300).springify()
but it does not work smoothly. Here is a simplified video of it:reanimated2-bug-report.mp4
Here is the minimalistic code. What am I missing?
Thanks for reading this through. :)
Beta Was this translation helpful? Give feedback.
All reactions