npx create-react-app --scripts-version=react-scripts-for-react-native-web my-app
using this create-react-app forktouch bsconfig.json
yarn add -D bs-platform
yarn add reason-react bs-react-native react-native-web
echo "SKIP_PREFLIGHT_CHECK=true" > .env
.- Open
bsconfig.json
, add the following:
{
"name": "my-app",
"version": "0.1.0",
"reason": {
"react-jsx": 2
},
"package-specs": {
"module": "commonjs",
"in-source": true
},
"bsc-flags": [
"-bs-super-errors"
],
"sources": [
{
"dir": "src",
"subdirs": true
}
],
"bs-dependencies": ["reason-react", "bs-react-native"],
"refmt": 3,
"suffix": ".bs.js",
"namespace": true
}
- In a seperate directory run
react-native init RnMyApp --template reason
- Copy all of the root directory files/dir except
node_modules
andApp.js
into the web app you created before. - Rename
index.js
in your root directory toindex.ios.js
. Then open it and changeimport App from 'App';
toimport {default as App} from 'src/App.bs';
- Change your first scripts to they look like:
"start": "node node_modules/react-native/local-cli/cli.js start",
"ios": "react-native run-ios",
"start:web": "react-scripts start",
"build-reason": "bsb -make-world",
"watch": "bsb -make-world -w",
"clean": "bsb -clean-world"
- Compile reason with
yarn watch
- Run web version with
yarn start-web
- Run
yarn start
to run start react-native. - Run
yarn ios
to run the simulator. This takes a while.