{"id":16645513,"url":"https://github.com/tdzl2003/react-native-web-platform","last_synced_at":"2026-03-16T04:04:40.125Z","repository":{"id":57341417,"uuid":"101642252","full_name":"tdzl2003/react-native-web-platform","owner":"tdzl2003","description":"React Native on web","archived":false,"fork":false,"pushed_at":"2017-12-19T13:44:35.000Z","size":155,"stargazers_count":49,"open_issues_count":9,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-13T08:24:03.239Z","etag":null,"topics":["react","reactnative","web"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tdzl2003.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-28T12:45:36.000Z","updated_at":"2021-05-20T11:48:31.000Z","dependencies_parsed_at":"2022-09-14T04:30:18.620Z","dependency_job_id":null,"html_url":"https://github.com/tdzl2003/react-native-web-platform","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdzl2003%2Freact-native-web-platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdzl2003%2Freact-native-web-platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdzl2003%2Freact-native-web-platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdzl2003%2Freact-native-web-platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tdzl2003","download_url":"https://codeload.github.com/tdzl2003/react-native-web-platform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221668761,"owners_count":16860722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","reactnative","web"],"created_at":"2024-10-12T08:24:06.029Z","updated_at":"2026-03-16T04:04:40.100Z","avatar_url":"https://github.com/tdzl2003.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Real React Native on Web Platform\n\n## Install:\n\nFirst initialize your react-native project\n\n```shell\nreact-native init MyProject\ncd MyProject\n```\n\nInstall this module.\n\n```shell\nyarn add react-native-web-platform\n```\n\nConfigure your rn-cli.config.js to add web platform \u0026 provideModuleNodeModules:\n\n```javascript\n'use strict';\n\nconst config = {\n  // Add these lines if you already have a rn-cli.config.js\n  getPlatforms() {\n    return ['web'];\n  },\n\n   getProvidesModuleNodeModules() {\n    return [\n      'react-native',\n      'react-native-web-platform',\n    ];\n  },\n};\n\nmodule.exports = config;\n```\n\nAdd a launch.web.js and index.html in your project root:\n\n```javascript\n// launch.web.js\n\n// Install polyfills in native thread.\nrequire('regenerator-runtime/runtime');\nrequire('es6-promise').polyfill();\nrequire('isomorphic-fetch');\nconst { Bridge } = require('react-native-web-platform/lib/launch');\n\nconst bridge = new Bridge(\n  __DEV__ ?\n    './index.bundle?platform=web' :\n    './index.bundle.js'\n);\n\nbridge.start();\n\nbridge.createRootView(document.body, 'YOUR_APP_NAME_HERE');\n```\n\n\u003e Note: if your react native version \u003c= 0.48.x, use following instead:\n\n```javascript\n// launch.web.js\nconst { Bridge } = require('react-native-web-platform/lib/launch');\n\nconst bridge = new Bridge(\n  __DEV__ ?\n    './index.web.bundle?platform=web' :\n    './index.bundle.js'\n);\n\nbridge.start();\n\nbridge.createRootView(document.body, 'YOUR_APP_NAME_HERE');\n```\n\nindex.html:\n\n```html\n\u003chtml\u003e\n\u003chead\u003e\n  \u003ctitle\u003eYOUR_APP_NAME_HERE\u003c/title\u003e\n  \u003cstyle\u003e\n    body { margin: 0; } html, body { height: 100%; }\n    .pointer-events-none {\n      pointer-events: none;\n    }\n    .pointer-events-box-none * {\n      pointer-events: all;\n    }\n    .pointer-events-box-none {\n      pointer-events: none;\n    }\n    .pointer-events-box-only * {\n      pointer-events: none;\n    }\n    .pointer-events-box-only {\n      pointer-events: all;\n    }\n  \u003c/style\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cscript src=\"./launch.web.bundle?platform=web\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nindex.release.html:\n\n```html\n\u003chtml\u003e\n\u003chead\u003e\n  \u003ctitle\u003eYOUR_APP_NAME_HERE\u003c/title\u003e\n  \u003cstyle\u003e\n    body { margin: 0; } html, body { height: 100%; }\n    .pointer-events-none {\n      pointer-events: none;\n    }\n    .pointer-events-box-none * {\n      pointer-events: all;\n    }\n    .pointer-events-box-none {\n      pointer-events: none;\n    }\n    .pointer-events-box-only * {\n      pointer-events: none;\n    }\n    .pointer-events-box-only {\n      pointer-events: all;\n    }\n  \u003c/style\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cscript src=\"./launch.bundle.js\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nIf your react native version \u003c= 0.48.x, you should also create a `index.web.js` with the content like `index.ios.js` or `index.android.js`:\n\n## Debug\n\n```shell\nnpm start\n```\n\nThen visit [http://localhost:8081/index.html](http://localhost:8081/index.html) to visit your page.\n\n## Publish\n\n#### version \u003e= 0.49.x:\n\nLinux \u0026 Mac:\n\n```shell\nmkdir build\nmkdir build/web\nreact-native bundle --entry-file launch.web.js --platform web --dev false --bundle-output build/web/launch.bundle.js --assets-dest build/web\nreact-native bundle --entry-file index.js --platform web --dev false --bundle-output build/web/index.bundle.js --assets-dest build/web\ncp index.release.html build/web/index.html\n```\n\nWindows: \n\n```shell\nmd build\nmd build\\web\nreact-native bundle --entry-file launch.web.js --platform web --dev false --bundle-output build/web/launch.bundle.js --assets-dest build/web\nreact-native bundle --entry-file index.js --platform web --dev false --bundle-output build/web/index.bundle.js --assets-dest build/web\ncopy index.release.html build\\web\\index.html\n```\n\n#### version \u003c= 0.48.x\n\nLinux \u0026 Mac:\n\n```shell\nmkdir build\nmkdir build/web\nreact-native bundle --entry-file launch.web.js --platform web --dev false --bundle-output build/web/launch.bundle.js --assets-dest build/web\nreact-native bundle --entry-file index.web.js --platform web --dev false --bundle-output build/web/index.bundle.js --assets-dest build/web\ncp index.release.html build/web/index.html\n```\n\nWindows: \n\n```shell\nmd build\nmd build\\web\nreact-native bundle --entry-file launch.web.js --platform web --dev false --bundle-output build/web/launch.bundle.js --assets-dest build/web\nreact-native bundle --entry-file index.web.js --platform web --dev false --bundle-output build/web/index.bundle.js --assets-dest build/web\ncopy index.release.html build\\web\\index.html\n```\n\nThen publish everything in `build/web` into your server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdzl2003%2Freact-native-web-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftdzl2003%2Freact-native-web-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdzl2003%2Freact-native-web-platform/lists"}