我已经为此苦苦挣扎了几周了,没有遇到任何问题或堆栈溢出的运气。
我正在尝试使用Transitioner组件创建自定义过渡,但没有任何运气。
该问题似乎与我的抽屉有关。与其导航到我的抽屉路线,不如导航到我的抽屉路线。
RootNavigator.js
class Test extends Component {
renderScene = (transitionProps, scene) => {
const { navigation, router } = this.props;
const { key, route } = scene
let Screen = CustomRouter.getComponentForRouteName(route.routeName)
return (
<Screen navigation={this.props.navigation} key={key}/>
)
}
render () {
return (
<Transitioner
configureTransition={() => ({
timing: Animated.timing,
duration: 1000,
easing: Easing.linear(),
useNativeDriver: true
})}
navigation={this.props.navigation}
render={(transitionProps) => {
return (
<View style={{ flex: 1 }}>
{transitionProps.scenes.map(scene =>
this.renderScene(transitionProps, scene))}
</View>
)
}}
/>
)
}
}
const CustomRouter = StackRouter({
Drawer,
AnimatedPlayer
})
export const RootNavigator = createNavigationContainer(createNavigator(Test,
CustomRouter))
DrawerRoutes.js
export const DrawerRoutes = {
Home: { screen: HomeStack },
Messages: { screen: MessagesStack },
Discussions: { screen: DiscussionsStack },
Chat: { screen: ChatStack },
Submissions: { screen: SubmissionsStack },
Vote: { screen: VoteStack },
History: { screen: HistoryStack },
Settings: { screen: SettingsStack },
Login: { screen: LoginStack }
}
错误消息