typescript - 如何在 React 导航 5x 中定义导航属性类型
问题描述
我正在做新项目。我开始在这个项目中使用打字稿。当我开始新项目时,我使用了 React Navigation 5x 版本。我的问题,如何在反应导航 5x 版本中定义界面破坏导航道具类型?我不使用任何类型。我阅读了文档反应导航,但我没有找到我的问题。非常感谢。希望你有个美好的一天。
import React from 'react';
import {Button, Text, SafeAreaView} from 'react-native';
import {inject, observer} from 'mobx-react';
import {Col, Grid} from 'react-native-easy-grid';
import Stores from '../../stores/storeIdentifier';
import ThemeStore from '../../stores/themeStore';
interface Props {
navigation: any;
}
interface InjectedProps extends Props {
themeStore: ThemeStore;
}
export function ModalComponent(props: Props) {
const {themeStore, navigation} = props as InjectedProps;
return (
<SafeAreaView style={themeStore.styleSheet.globalModal__container}>
<Grid>
<Col
style={[
themeStore.styleSheet.alignCenter,
themeStore.styleSheet.justifyCenter,
]}>
<Text>Welcome to Global Modal </Text>
<Button onPress={() => navigation.goBack()} title="Back" />
</Col>
</Grid>
</SafeAreaView>
);
}
export const Modal = inject(Stores.ThemeStore)(observer(ModalComponent));
解决方案
推荐阅读
- c# - Dotnet 调试器,运行到我的代码的下一行?
- reactjs - 如何使 Chakra UI 框/flex 项目占用 100% 宽度
- c# - 使用 UpdateAsync() 时 ASP.Net 身份库出错
- mongodb - 获取文件列表中的列表总和
- php - Laravel 5.8:未定义属性:Illuminate\Database\Eloquent\Relations\BelongsToMany::$usr_id
- magento - 当用户从shopify商店购买某些产品时,它必须重定向到magento商店
- javascript - Convert Callback to Promise in Publish Subscribe Model
- h.264 - VLC 或其他播放器无法识别基本流中的 CEA 708 文本
- xml - 如何使用 vtk 的 XML 格式在 StructuredGrid 的单元格数据中包含字符串属性?
- asp.net-mvc - 转义字符在 cshtml ASP.NET MVC5 中不起作用