React native 自定义打开/关闭抽屉动画
我的应用程序中有抽屉导航器。我已成功地将屏幕之间的默认(从右到左)动画更改为fadeIn/fadeOut 但是我找不到一种方法来更改从右向左滑动的react导航抽屉的默认动画。我需要它淡出/淡出React native 自定义打开/关闭抽屉动画,react-native,react-navigation,react-navigation-drawer,React Native,React Navigation,React Navigation Drawer,我的应用程序中有抽屉导航器。我已成功地将屏幕之间的默认(从右到左)动画更改为fadeIn/fadeOut 但是我找不到一种方法来更改从右向左滑动的react导航抽屉的默认动画。我需要它淡出/淡出 我正在使用自定义抽屉组件和navigation.openDrawer()打开抽屉,并使用navigation.closeDrawer()关闭抽屉。您可以将抽屉动画设置为其他动画,但不能设置为淡入动画 drawerType - Type of the drawer. It determines how t
我正在使用自定义抽屉组件和
navigation.openDrawer()
打开抽屉,并使用navigation.closeDrawer()
关闭抽屉。您可以将抽屉动画设置为其他动画,但不能设置为淡入动画
drawerType - Type of the drawer. It determines how the drawer looks and animates.
- front: Traditional drawer which covers the screen with a overlay behind it.
- back: The drawer is revealed behind the screen on swipe.
- slide: Both the screen and the drawer slide on swipe to reveal the drawer.
或者,您可以设置抽屉内内容的动画:
const CustomDrawerContentComponent = props => {
const translateX = props.drawerOpenProgress.interpolate({
inputRange: [0, 1],
outputRange: [-100, 0],
});
return (
<Animated.View style={{ transform: [{ translateX }] }}>
{/* ... drawer contents */}
</Animated.View>
);
};
const CustomDrawerContentComponent=props=>{
const translateX=props.drawerropenprogress.interpolate({
输入范围:[0,1],
输出范围:[-100,0],
});
返回(
欢迎来到Stack Overflow!这个问题涉及面很广,很笼统——请您添加详细信息,包括您编写的任何代码,使其更具体一些好吗?谢谢,我使用了DrawerPropenProgress和interpolate函数成功地做到了这一点。