【发布时间】:2021-10-24 14:34:54
【问题描述】:
我想实现如下图所示的屏幕。
我有这个过渡:
const MyTransition = {
transitionSpec: {
open: {
animation: 'timing',
config: {
duration: 750,
},
},
close: {
animation: 'timing',
config: {
duration: 750,
},
},
},
cardStyleInterpolator: ({ current, next, layouts }) => {
return {
cardStyle: {
transform: [
{
perspective: 750
},
{
translateY: current.progress.interpolate({
inputRange: [0, 1],
outputRange: [height -54, 54],
}),
},
{
scale: current.progress.interpolate({
inputRange: [0, 1, 2],
outputRange: [1.2, 1, .9],
}),
},
],
},
overlayStyle: {
opacity: current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 1],
}),
},
}
},
}
导航器:
<Stack.Navigator
screenOptions={{
headerShown: false,
cardOverlayEnabled: true,
gestureEnabled: true,
...MyTransition,
}}
>
<Stack.Screen name="ScreenA" component={ScreenA} />
<Stack.Screen name="ScreenB" component={ScreenB} mode='modal'/>
</Stack.Navigator>
Please see the transition animation here with Loom video
(顺便说一句,我可以在问题中嵌入 gif/Loom 视频吗?)
从视频中可以看出,
-Screen A 顶部有多余的空白空间。
-Screen A 和 Screen B 没有 top border radius。
(如果我使用borderRadius,则会收到此错误:Property 'borderRadius' is not supported by native animated module)
-Screen B打开后,看不到Screen B下的Screen A。
我该如何解决以上问题?
编辑: 如果 Loom 视频无法打开,我正在添加图片。
【问题讨论】:
标签: javascript react-native react-navigation-v5 react-animated react-native-reanimated