Skip to content

Commit a4e4491

Browse files
committed
New documentation site and examples app
Replaces the old storybook with static HTML documentation and an interactive examples app. The documentation is now easier to customize, easier to maintain, and faster to load. The interactive examples are a dedicated Next.js app that can be loaded and edited in codesandbox, as well as embedded in the documentation where needed.
1 parent 2e7e563 commit a4e4491

File tree

235 files changed

+15391
-7773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+15391
-7773
lines changed

.github/CONTRIBUTING.md

+13-6
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,23 @@ yarn compile
7070
yarn compile --watch
7171
```
7272

73-
## Documentation and visual tests
73+
## Documentation
7474

75-
To run the interactive storybook:
75+
To run the documentation website:
7676

7777
```
78-
yarn docs
78+
yarn docs:dev
7979
```
8080

81-
When you're also making changes to the 'react-native-web' source files, run this
82-
command in another process:
81+
## Examples
82+
83+
To run the examples app:
84+
85+
```
86+
yarn examples:dev
87+
```
88+
89+
When you're also making changes to the 'react-native-web' source files, run this command in another process:
8390

8491
```
8592
yarn compile --watch
@@ -90,7 +97,7 @@ yarn compile --watch
9097
To run the benchmarks locally:
9198

9299
```
93-
yarn benchmarks
100+
yarn benchmarks:dev
94101
open ./packages/benchmarks/dist/index.html
95102
```
96103

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.next
2+
build
13
coverage
24
node_modules
35
dist

README.md

+12-159
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,15 @@
22

33
[![npm version][package-badge]][package-url] [![Build Status][ci-badge]][ci-url] [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)
44

5-
**Compatibility: React Native >= 0.63**.
6-
7-
"React Native for Web" makes it possible to run [React
8-
Native][react-native-url] components and APIs on the web using React DOM.
9-
10-
* **High-quality web interfaces**: makes it easy to
11-
create [fast](https://github.com/necolas/react-native-web/blob/master/packages/benchmarks/README.md),
12-
adaptive web UIs in JavaScript. It provides native-quality interactions, support
13-
for multiple input modes (touch, mouse, keyboard), optimized vendor-prefixed
14-
styles, built-in support for RTL layout, built-in accessibility, and integrates
15-
with React Dev Tools.
16-
17-
* **Write once, render anywhere**: interoperates with existing React DOM
18-
components and is compatible with the majority of the React Native API. You can
19-
develop new components for native and web without rewriting existing code.
20-
React Native for Web can also render to HTML and critical CSS on the server
21-
using Node.js.
22-
23-
Who is using React Native for Web in production?
24-
[Twitter](https://mobile.twitter.com),
25-
[Expo](https://docs.expo.io/workflow/web/),
26-
[Major League Soccer](https://matchcenter.mlssoccer.com),
27-
[Flipkart](https://twitter.com/naqvitalha/status/969577892991549440),
28-
[Uber](https://www.youtube.com/watch?v=RV9rxrNIxnY),
29-
[The Times](https://github.com/newsuk/times-components),
30-
[DataCamp](https://www.datacamp.com/community/tech/porting-practice-to-web-part1).
31-
32-
Browser support: Chrome, Firefox, Edge, Safari 7+, IE 10+.
33-
34-
Components and APIs deprecated in React Native are not supported by React Native for Web.
35-
36-
## Quick start
37-
38-
The easiest way to get started is to edit this
39-
[CodeSandbox](https://codesandbox.io/s/q4qymyp2l6) template. You don’t need to
40-
install anything to try it out.
5+
"React Native for Web" makes it possible to run [React Native][react-native-url] components and APIs on the web using React DOM.
416

427
## Documentation
438

44-
The [documentation app](https://necolas.github.com/react-native-web/docs) covers
45-
installation, configuration, APIs, and guides.
46-
47-
The [React Native documentation][react-native-url] contains more information
48-
about the [Gesture Responder
49-
system](https://facebook.github.io/react-native/docs/gesture-responder-system.html),
50-
[animations](https://facebook.github.io/react-native/docs/animations.html), and
51-
other design details.
52-
53-
## Libraries and integrations
54-
55-
List of React Native packages with known web compatibility:
56-
57-
* [React Native Directory](https://reactnative.directory/?web=true)
58-
59-
Examples of using React Native for Web with other web tools:
60-
61-
* [Docz](https://github.com/doczjs/docz/tree/master/examples/react-native)
62-
* [Gatsby](https://github.com/slorber/gatsby-plugin-react-native-web)
63-
* [Next.js](https://github.com/zeit/next.js/tree/master/examples/with-react-native-web)
64-
(and [example recipes](https://gist.github.com/necolas/f9034091723f1b279be86c7429eb0c96))
65-
* [Phenomic](https://github.com/phenomic/phenomic/tree/master/examples/react-native-web-app)
66-
* [Razzle](https://github.com/jaredpalmer/razzle/tree/master/examples/with-react-native-web)
67-
* [Storybook](https://github.com/necolas/react-native-web/tree/master/packages/docs/)
68-
* [Styleguidist](https://github.com/styleguidist/react-styleguidist/tree/master/examples/react-native)
9+
The [documentation site](https://necolas.github.com/react-native-web/) covers installation, guides, and APIs.
6910

70-
## Examples
11+
## Example
7112

72-
And here is a simple example to get you started. The documentation includes
73-
interactive examples and the [source
74-
code](https://github.com/necolas/react-native-web/blob/master/packages/docs) is
75-
also available.
13+
And here is a simple example to get you started. The example app includes interactive examples and the [source code](https://github.com/necolas/react-native-web/blob/master/packages/docs) is also available.
7614

7715
```js
7816
import React from 'react';
@@ -99,116 +37,31 @@ AppRegistry.runApplication('App', { rootTag: document.getElementById('react-root
9937

10038
This example will render the `App` into a container on the page.
10139

102-
You'll notice that there is no reference to `react-dom`; the `App` component is
103-
defined using the platform-agnostic APIs and Components introduced by React
104-
Native. This allows the app to be rendered to web and native platforms.
105-
106-
## Compatibility with React Native
107-
108-
React Native v0.60
109-
110-
### Components
111-
112-
| Name | Status | Notes |
113-
| :----------------------- | :----- | :---- |
114-
| ActivityIndicator || |
115-
| Button || |
116-
| CheckBox || |
117-
| FlatList || |
118-
| Image || Missing multiple sources ([#515](https://github.com/necolas/react-native-web/issues/515)) and HTTP headers ([#1019](https://github.com/necolas/react-native-web/issues/1019)). |
119-
| ImageBackground || |
120-
| KeyboardAvoidingView | (✓) | Mock. No equivalent web APIs. |
121-
| Modal || |
122-
| Picker || |
123-
| Pressable || |
124-
| RefreshControl || Not started ([#1027](https://github.com/necolas/react-native-web/issues/1027)). |
125-
| SafeAreaView || |
126-
| ScrollView || Missing momentum scroll events ([#1021](https://github.com/necolas/react-native-web/issues/1021)). |
127-
| SectionList || |
128-
| StatusBar | (✓) | Mock. No equivalent web APIs. |
129-
| Switch || |
130-
| Text || Missing `onLongPress` ([#1011](https://github.com/necolas/react-native-web/issues/1011)) support. |
131-
| TextInput || Missing rich text features ([#1023](https://github.com/necolas/react-native-web/issues/1023)), and auto-expanding behaviour ([#795](https://github.com/necolas/react-native-web/issues/795)). |
132-
| Touchable || Includes additional support for mouse and keyboard interactions. |
133-
| TouchableHighlight || |
134-
| TouchableNativeFeedback || Not started ([#1024](https://github.com/necolas/react-native-web/issues/1024)). |
135-
| TouchableOpacity || |
136-
| TouchableWithoutFeedback || |
137-
| View || |
138-
| VirtualizedList || |
139-
| YellowBox | (✓) | Mock. No YellowBox functionality. |
140-
141-
### Modules
142-
143-
| Name | Status | Notes |
144-
| :----------------------- | :----- | :---- |
145-
| AccessibilityInfo | (✓) | Mock. No equivalent web APIs. |
146-
| Alert || Not started ([#1026](https://github.com/necolas/react-native-web/issues/1026)). |
147-
| Animated || Missing `useNativeDriver` support. |
148-
| Appearance || |
149-
| AppRegistry || Includes additional support for server rendering with `getApplication`. |
150-
| AppState || |
151-
| BackHandler | (✓) | Mock. No equivalent web APIs. |
152-
| Clipboard || |
153-
| DeviceInfo | (✓) | Limited information. |
154-
| Dimensions || |
155-
| Easing || |
156-
| Geolocation || |
157-
| I18nManager || Includes additional support for runtime switch to RTL. |
158-
| InteractionManager | (✓) | |
159-
| Keyboard | (✓) | Mock. |
160-
| LayoutAnimation | (✓) | Missing translation to web animations. |
161-
| Linking || |
162-
| NativeEventEmitter || |
163-
| NativeMethodsMixin || |
164-
| NativeModules | (✓) | Mocked. Missing ability to load native modules. |
165-
| PanResponder || |
166-
| PixelRatio || |
167-
| Platform || |
168-
| Settings || No equivalent web APIs. |
169-
| Share || Only available over HTTPS. Read about the [Web Share API](https://wicg.github.io/web-share/). |
170-
| StyleSheet || |
171-
| UIManager || |
172-
| Vibration || |
173-
| useColorScheme || |
174-
| useWindowDimensions || |
40+
You'll notice that there is no reference to `react-dom`; the `App` component is defined using the platform-agnostic APIs and Components introduced by React Native. This allows the app to be rendered to web and native platforms.
17541

17642
## Contributing
17743

178-
The main purpose of this repository is to help evolve React web and native
179-
development towards the platform-agnostic design of React Native, and in the
180-
process make it faster and easier to build high-quality experiences for the web
181-
with React. Development happens in the open on GitHub, and we are grateful for
182-
contributing bugfixes and improvements. Read below to learn how you can take
183-
part in improving React Native for Web.
44+
The main purpose of this repository is to help evolve React web and native development towards the platform-agnostic design of React Native, and in the process make it faster and easier to build high-quality experiences for the web with React. Development happens in the open on GitHub, and we are grateful for contributing bugfixes and improvements. Read below to learn how you can take part in improving React Native for Web.
18445

18546
### Code of conduct
18647

187-
Facebook has adopted a [Code of Conduct][code-of-conduct] that this project
188-
expects all participants to adhere to. Please read the full text so that you
189-
can understand what actions will and will not be tolerated.
48+
Facebook has adopted a [Code of Conduct][code-of-conduct] that this project expects all participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
19049

19150
### Contributing guide
19251

193-
Read the [contributing guide][contributing-url] to learn about the
194-
development process, how to propose bugfixes and improvements, and how to build
195-
and test your changes to React Native for Web.
52+
Read the [contributing guide][contributing-url] to learn about the development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native for Web.
19653

19754
### Good first issues
19855

199-
To help you get you familiar with the contribution process, there is a list of
200-
[good first issues][good-first-issue-url] that contain bugs which have a
201-
relatively limited scope. This is a great place to get started.
56+
To help you get you familiar with the contribution process, there is a list of [good first issues][good-first-issue-url] that contain bugs which have a relatively limited scope. This is a great place to get started.
20257

20358
## License
20459

205-
React Native for Web is [MIT licensed](./LICENSE). By contributing to React
206-
Native for Web, you agree that your contributions will be licensed under its
207-
MIT license.
60+
React Native for Web is [MIT licensed](./LICENSE). By contributing to React Native for Web, you agree that your contributions will be licensed under its MIT license.
20861

20962
[package-badge]: https://img.shields.io/npm/v/react-native-web.svg?style=flat
210-
[package-url]: https://yarnpkg.com/en/package/react-native-web
211-
[ci-badge]: https://github.com/necolas/react-native-web/workflows/test/badge.svg
63+
[package-url]: https://www.npmjs.com/package/react-native-web
64+
[ci-badge]: https://github.com/necolas/react-native-web/workflows/tests/badge.svg
21265
[ci-url]: https://github.com/necolas/react-native-web/actions
21366
[react-native-url]: https://facebook.github.io/react-native/
21467
[contributing-url]: https://github.com/necolas/react-native-web/blob/master/.github/CONTRIBUTING.md

package.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
"compile": "npm-run-all clean -p \"compile:* -- {@}\" --",
88
"compile:commonjs": "cd packages/react-native-web && cross-env BABEL_ENV=commonjs babel --root-mode upward src --out-dir dist/cjs --ignore \"**/__tests__\"",
99
"compile:es": "cd packages/react-native-web && babel --root-mode upward src --out-dir dist --ignore \"**/__tests__\"",
10-
"benchmarks": "cd packages/benchmarks && yarn build",
11-
"benchmarks:release": "cd packages/benchmarks && yarn release",
12-
"docs": "cd packages/docs && yarn start",
13-
"docs:release": "cd packages/docs && yarn release",
10+
"benchmarks": "cd packages/benchmarks && yarn dev",
11+
"benchmarks:build": "cd packages/benchmarks && yarn build",
12+
"benchmarks:release": "yarn benchmarks:build && git checkout gh-pages && rm -rf ./docs/benchmarks && mv packages/benchmarks/dist ./docs/benchmarks && git add -A && git commit -m \"Deploy benchmarks\" && git push origin gh-pages && git checkout -",
13+
"docs": "cd packages/docs && yarn dev",
14+
"docs:build": "cd packages/docs && yarn build",
15+
"docs:release": "yarn docs:build && git checkout gh-pages && rm -rf ./docs && mv packages/docs/dist ./docs && git add ./docs && git commit -m \"Deploy documentation\" && git push origin gh-pages && git checkout -",
16+
"examples": "cd packages/examples && yarn dev",
17+
"examples:build": "cd packages/examples && yarn build",
1418
"flow": "flow",
1519
"fmt": "prettier --write \"**/*.js\"",
1620
"fmt:report": "prettier --check \"**/*.js\"",
@@ -20,7 +24,7 @@
2024
"precommit": "lint-staged",
2125
"prerelease": "yarn test && yarn compile && yarn compile:commonjs",
2226
"release": "node ./scripts/release/publish.js",
23-
"postrelease": "yarn benchmarks:release && yarn docs:release",
27+
"postrelease": "yarn docs:release && yarn benchmarks:release && ",
2428
"test": "yarn flow && yarn lint:report && yarn jest --runInBand"
2529
},
2630
"devDependencies": {

packages/benchmarks/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# benchmarks
1+
# Benchmarks
22

33
Try the [benchmarks app](https://necolas.github.io/react-native-web/benchmarks) online.
44

packages/benchmarks/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"name": "benchmarks",
44
"version": "0.14.13",
55
"scripts": {
6-
"build": "mkdir -p dist && cp -f index.html dist/index.html && ./node_modules/.bin/webpack-cli --config ./webpack.config.js",
7-
"release": "NODE_ENV=production yarn build && git checkout gh-pages && rm -rf ../../benchmarks && mv dist ../../benchmarks && git add -A && git commit -m \"Benchmarks deploy\" && git push origin gh-pages && git checkout -"
6+
"dev": "mkdir -p dist && cp -f index.html dist/index.html && ./node_modules/.bin/webpack-cli --config ./webpack.config.js",
7+
"build": "NODE_ENV=production yarn dev"
88
},
99
"dependencies": {
1010
"aphrodite": "^2.4.0",

0 commit comments

Comments
 (0)