Merge react app with react native app

I want to put React app files in the React Native app.

I used React Native Web to support React Native components in the React app.

Last step I want to put all files from React App folder to React Native App folder.

the difference is in Package.json

React Package.json :

{
  "name": "appname",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-scripts": "1.0.10"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

React Native Package.json:

{
    "name": "appname",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "react": "16.0.0-alpha.12",
        "react-native": "0.47.1",
        "react-native-windows": "0.47.0-rc.5"
    },
    "devDependencies": {
        "babel-jest": "20.0.3",
        "babel-preset-react-native": "2.1.0",
        "jest": "20.0.4",
        "react-test-renderer": "16.0.0-alpha.12",
        "rnpm-plugin-windows": "^0.2.7"
    },
    "jest": {
        "preset": "react-native"
    }
}

So is it possible I can merge the two packages together?

For your native app you can use package.json from React Native, no need to merge. You don't need "react-dom" and similar libs in native app. If your components are all from React Native for Web, there will be no problem running them on native.

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue