我正在尝试使用react-native,react-navigation和Typescript一起创建一个应用程序。总共只有两个屏幕(HomeScreen和ConfigScreen)和一个组件(GoToConfigButton),如下所示。
import React from "react";
import { NavigationScreenProps } from "react-navigation";
import { Text, View } from "react-native";
import GoToConfigButton from "./GoToConfigButton";
export class HomeScreen extends React.Component<NavigationScreenProps> {
render() {
return (
<View>
<Text>Click the following button to go to the config tab.</Text>
<GoToConfigButton/>
</View>
)
}
}
Run Code Online (Sandbox Code Playgroud)
import React from "react";
import { Button } from "react-native";
import { NavigationInjectedProps, withNavigation } from "react-navigation";
class GoToConfigButton extends React.Component<NavigationInjectedProps> {
render() { …Run Code Online (Sandbox Code Playgroud)