我使用 create-react-native-app
创建了应用程序。我用来运行和进行生产构建的命令是:
"scripts": {
"web": "react-scripts start",
"build": "react-scripts build"
}
对于 React Native,我可以使用 react-native-scripts-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') });
关于typescript - 如何在 Typescript 中使用 react-native-web,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51580389/