React Native Web-- use RN App and Web application development

Create a React, React Native, Dva Trinity scaffolding, provide company projects.

Benpian first chapter, is relatively simple, build a ReactNative, ReactNativeWeb run the project.

react-native-web of this project, is a former Twitter front-end engineers, the authors used React to achieve the most commonly used ReactNative components, replace webpack dynamic run-time, so that RN code can run on web side.

First, initialize RN Works, Use ReactNative init method, with particular reference to the official website of RN.

$ sudo npm i -g react-native-cli
$ react-native init rnweb

The second part process dependencies:
My package.json is dependent only: react, react-dom, react -native, react-scripts, react-native-web.

Specific document reads as follows:

{
  "name": "rnwebdva",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "ss": "react-scripts start",
    "test": "jest"
  },
  "main": "src/index.js",
  "dependencies": {
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "0.59.8",
    "react-native-web": "^0.11.4",
    "react-scripts": "^3.0.1"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

This scaffolding is not webpack configuration file, use the default configuration.

Run a local service or use yarn ss npm run ss.

During react-native run-iosa problem when using iOS RN 0.45 or later required third-party libraries to compile this article resolved.

reference:

  1. Web-Native-REACT , RN Chinese pipeline network, webpack Chinese pipeline network.
  2. A built by react-native, react-navigation, dva simple shelf
  3. Use react-native-web will you react-native application of H5
  4. iOS RN 0.45 or later required for third-party compiler libraries

Guess you like

Origin blog.csdn.net/weixin_34273046/article/details/91013099