Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将react native web与Typescript一起使用_Typescript_React Native_React Native Web - Fatal编程技术网

如何将react native web与Typescript一起使用

如何将react native web与Typescript一起使用,typescript,react-native,react-native-web,Typescript,React Native,React Native Web,我已经使用create react native app创建了应用程序。我用于运行和生成生产版本的命令有: "scripts": { "web": "react-scripts start", "build": "react-scripts build" } 对于react-native,我可以使用react-native脚本ts,但如何使用react-native web配置Typescript管道?因此解决方案是使用: "scripts": { "test": "jest"

我已经使用
create react native app
创建了应用程序。我用于运行和生成生产版本的命令有:

"scripts": {
  "web": "react-scripts start",
  "build": "react-scripts build"
}

对于react-native,我可以使用
react-native脚本ts
,但如何使用react-native web配置Typescript管道?

因此解决方案是使用:

"scripts": {
    "test": "jest",
    "web": "react-scripts-ts start",
    "build": "react-native-scripts-ts build",
    "test:web": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
并使用以下工具运行App.tsx:

AppRegistry.registerComponent("root", () => App);
AppRegistry.runApplication('root', { rootTag: document.getElementById('root') });