【发布时间】:2021-07-07 11:33:50
【问题描述】:
我正在使用 react-navigation 4.0.10 和 react-navigation-stack 1.10.3 并尝试为 Android 实现 CardStyleInterpolations。根据文档https://reactnavigation.org/docs/4.x/stack-navigator 来实现这个我必须做这样的事情
import { CardStyleInterpolators } from 'react-navigation-stack';
// ...
static navigationOptions = {
title: 'Profile',
cardStyleInterpolator: CardStyleInterpolators.forFadeFromBottomAndroid,
}
我正在使用这样的功能组件来实现它
Login.navigationOptions = () => {
return {
cardStyleInterpolator: CardStyleInterpolators.forFadeFromBottomAndroid,
};
};
因为静态navigationOptions是针对类组件的。
这看起来很简单,但它给我一个错误undefined.object 评估 CardStyleInterpolators.forFadeFromBottomAndroid 我猜这与不正确的导入有关。任何人都知道如何正确实现它。
【问题讨论】:
标签: react-native react-navigation