Skip to content

Commit cd71d27

Browse files
dev-sebSébastien Biziou
authored andcommitted
Merge branch 'master' into feature/tv-support
2 parents 67fc47f + 6739ab9 commit cd71d27

File tree

294 files changed

+17905
-7093
lines changed

Some content is hidden

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

294 files changed

+17905
-7093
lines changed

.eslintrc

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,24 @@
1717
"sourceType": "module"
1818
},
1919
"extends": [
20+
"plugin:flowtype/recommended",
2021
"prettier",
2122
"prettier/react"
2223
],
2324
"plugins": [
25+
"flowtype",
2426
"promise",
25-
"react"
27+
"react",
28+
"react-hooks"
2629
],
2730
"env": {
31+
"browser": true,
2832
"es6": true,
33+
"jest": true,
2934
"node": true
3035
},
3136
"globals": {
32-
"document": false,
33-
"navigator": false,
34-
"window": false,
35-
// Flow global types,
36-
"$Enum": false,
37-
"$PropertyType": false,
38-
"$ReadOnly": false,
39-
"$ReadOnlyArray": false,
40-
"CSSStyleSheet": false,
41-
"HTMLInputElement": false,
42-
"ReactClass": false,
43-
"ReactComponent": false,
44-
"ReactElement": false,
45-
"ReactPropsChainableTypeChecker": false,
46-
"ReactPropsCheckType": false,
47-
"ReactPropTypes": false,
48-
"SyntheticEvent": false
37+
4938
},
5039
"rules": {
5140
"camelcase": 0,
@@ -135,6 +124,10 @@
135124
"valid-typeof": 2,
136125
"yoda": [2, "never"],
137126

127+
// flow
128+
"flowtype/generic-spacing": 0,
129+
"flowtype/space-after-type-colon": 0,
130+
138131
// promise
139132
"promise/param-names": 2,
140133

@@ -159,6 +152,10 @@
159152
"react/self-closing-comp": 2,
160153
"react/sort-comp": 0,
161154
"react/sort-prop-types": 2,
162-
"react/wrap-multilines": 0
155+
"react/wrap-multilines": 0,
156+
157+
// react-hooks
158+
"react-hooks/rules-of-hooks": "error",
159+
"react-hooks/exhaustive-deps": "warn"
163160
}
164161
}

.flowconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<PROJECT_ROOT>/.*/__tests__/.*
66
<PROJECT_ROOT>/packages/.*/dist/.*
77
<PROJECT_ROOT>/packages/docs/.*
8+
.*/node_modules/@emotion/css/*
89
.*/node_modules/babel-plugin-transform-react-remove-prop-types/*
910

1011
[include]

.github/workflows/performance.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: performance
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
compressed-size:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: necolas/compressed-size-action@master
11+
with:
12+
build-script: "compile"
13+
exclude: "./packages/react-native-web/dist/cjs/{index.js,**/*.js}"
14+
pattern: "./packages/react-native-web/dist/{index.js,**/*.js}"
15+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/test.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
format:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: '14.x'
18+
- run: npm install -g yarn
19+
- run: yarn install
20+
- run: yarn fmt:report
21+
22+
type-check:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v1
27+
with:
28+
node-version: '14.x'
29+
- run: npm install -g yarn
30+
- run: yarn install
31+
- run: yarn flow
32+
33+
lint:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: actions/setup-node@v1
38+
with:
39+
node-version: '14.x'
40+
- run: npm install -g yarn
41+
- run: yarn install
42+
- run: yarn lint:report
43+
44+
unit-test:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: actions/setup-node@v1
49+
with:
50+
node-version: '14.x'
51+
- run: npm install -g yarn
52+
- run: yarn install
53+
- run: yarn jest

.travis.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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.60**.
5+
**Compatibility: React Native >= 0.63**.
66

77
"React Native for Web" makes it possible to run [React
88
Native][react-native-url] components and APIs on the web using React DOM.
@@ -20,8 +20,9 @@ develop new components for native and web without rewriting existing code.
2020
React Native for Web can also render to HTML and critical CSS on the server
2121
using Node.js.
2222

23-
Who is using React Native in production web apps?
23+
Who is using React Native for Web in production?
2424
[Twitter](https://mobile.twitter.com),
25+
[Expo](https://docs.expo.io/workflow/web/),
2526
[Major League Soccer](https://matchcenter.mlssoccer.com),
2627
[Flipkart](https://twitter.com/naqvitalha/status/969577892991549440),
2728
[Uber](https://www.youtube.com/watch?v=RV9rxrNIxnY),
@@ -49,7 +50,11 @@ system](https://facebook.github.io/react-native/docs/gesture-responder-system.ht
4950
[animations](https://facebook.github.io/react-native/docs/animations.html), and
5051
other design details.
5152

52-
## Integrations
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)
5358

5459
Examples of using React Native for Web with other web tools:
5560

@@ -64,7 +69,7 @@ Examples of using React Native for Web with other web tools:
6469

6570
## Examples
6671

67-
And here is a simple example to get you started. The documentation include
72+
And here is a simple example to get you started. The documentation includes
6873
interactive examples and the [source
6974
code](https://github.com/necolas/react-native-web/blob/master/packages/docs) is
7075
also available.
@@ -113,8 +118,9 @@ React Native v0.60
113118
| 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)). |
114119
| ImageBackground || |
115120
| KeyboardAvoidingView | (✓) | Mock. No equivalent web APIs. |
116-
| Modal | | Not started ([#1020](https://github.com/necolas/react-native-web/issues/1020)). |
121+
| Modal | | |
117122
| Picker || |
123+
| Pressable || |
118124
| RefreshControl || Not started ([#1027](https://github.com/necolas/react-native-web/issues/1027)). |
119125
| SafeAreaView || |
120126
| ScrollView || Missing momentum scroll events ([#1021](https://github.com/necolas/react-native-web/issues/1021)). |
@@ -139,6 +145,7 @@ React Native v0.60
139145
| AccessibilityInfo | (✓) | Mock. No equivalent web APIs. |
140146
| Alert || Not started ([#1026](https://github.com/necolas/react-native-web/issues/1026)). |
141147
| Animated || Missing `useNativeDriver` support. |
148+
| Appearance || |
142149
| AppRegistry || Includes additional support for server rendering with `getApplication`. |
143150
| AppState || |
144151
| BackHandler | (✓) | Mock. No equivalent web APIs. |
@@ -163,6 +170,8 @@ React Native v0.60
163170
| StyleSheet || |
164171
| UIManager || |
165172
| Vibration || |
173+
| useColorScheme || |
174+
| useWindowDimensions || |
166175

167176
## Contributing
168177

@@ -199,8 +208,8 @@ MIT license.
199208

200209
[package-badge]: https://img.shields.io/npm/v/react-native-web.svg?style=flat
201210
[package-url]: https://yarnpkg.com/en/package/react-native-web
202-
[ci-badge]: https://travis-ci.org/necolas/react-native-web.svg?branch=master
203-
[ci-url]: https://travis-ci.org/necolas/react-native-web
211+
[ci-badge]: https://github.com/necolas/react-native-web/workflows/test/badge.svg
212+
[ci-url]: https://github.com/necolas/react-native-web/actions
204213
[react-native-url]: https://facebook.github.io/react-native/
205214
[contributing-url]: https://github.com/necolas/react-native-web/blob/master/.github/CONTRIBUTING.md
206215
[good-first-issue-url]: https://github.com/necolas/react-native-web/labels/good%20first%20issue

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"version": "0.12.2",
3+
"version": "0.14.10",
44
"name": "monorepo",
55
"scripts": {
66
"clean": "del-cli ./packages/*/dist",
@@ -13,14 +13,15 @@
1313
"docs:release": "cd packages/docs && yarn release",
1414
"flow": "flow",
1515
"fmt": "prettier --write \"**/*.js\"",
16+
"fmt:report": "prettier --check \"**/*.js\"",
1617
"jest": "jest --config ./scripts/jest/config.js",
17-
"lint": "yarn lint:check --fix",
18-
"lint:check": "eslint packages scripts",
18+
"lint": "yarn lint:report --fix",
19+
"lint:report": "eslint packages scripts",
1920
"precommit": "lint-staged",
2021
"prerelease": "yarn test && yarn compile && yarn compile:commonjs",
2122
"release": "node ./scripts/release/publish.js",
2223
"postrelease": "yarn benchmarks:release && yarn docs:release",
23-
"test": "yarn flow && yarn lint:check && yarn jest --runInBand"
24+
"test": "yarn flow && yarn lint:report && yarn jest --runInBand"
2425
},
2526
"devDependencies": {
2627
"@babel/cli": "^7.8.4",
@@ -41,13 +42,12 @@
4142
"caniuse-api": "^3.0.0",
4243
"cross-env": "^6.0.3",
4344
"del-cli": "^3.0.0",
44-
"enzyme": "^3.10.0",
45-
"enzyme-adapter-react-16": "^1.14.0",
46-
"enzyme-to-json": "^3.4.2",
4745
"eslint": "^6.5.1",
4846
"eslint-config-prettier": "^6.4.0",
47+
"eslint-plugin-flowtype": "^4.7.0",
4948
"eslint-plugin-promise": "^4.2.1",
5049
"eslint-plugin-react": "^7.16.0",
50+
"eslint-plugin-react-hooks": "^2.3.0",
5151
"flow-bin": "^0.109.0",
5252
"glob": "^7.1.4",
5353
"husky": "^3.0.8",

packages/babel-plugin-react-native-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"registry": "https://registry.npmjs.org/"
44
},
55
"name": "babel-plugin-react-native-web",
6-
"version": "0.12.2",
6+
"version": "0.14.10",
77
"description": "Babel plugin for React Native for Web",
88
"main": "index.js",
99
"devDependencies": {

packages/babel-plugin-react-native-web/src/moduleMap.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ module.exports = {
44
ActivityIndicator: true,
55
Alert: true,
66
Animated: true,
7+
Appearance: true,
78
AppRegistry: true,
89
AppState: true,
910
BackHandler: true,
1011
Button: true,
1112
CheckBox: true,
1213
Clipboard: true,
14+
createElement: true,
1315
DeviceEventEmitter: true,
1416
DeviceInfo: true,
1517
Dimensions: true,
1618
DrawerLayoutAndroid: true,
1719
Easing: true,
20+
findNodeHandle: true,
1821
FlatList: true,
1922
I18nManager: true,
2023
Image: true,
@@ -25,6 +28,7 @@ module.exports = {
2528
KeyboardAvoidingView: true,
2629
LayoutAnimation: true,
2730
Linking: true,
31+
LogBox: true,
2832
Modal: true,
2933
NativeEventEmitter: true,
3034
NativeModules: true,
@@ -33,8 +37,11 @@ module.exports = {
3337
Picker: true,
3438
PixelRatio: true,
3539
Platform: true,
40+
Pressable: true,
41+
processColor: true,
3642
ProgressBar: true,
3743
RefreshControl: true,
44+
render: true,
3845
SafeAreaView: true,
3946
ScrollView: true,
4047
SectionList: true,
@@ -44,26 +51,21 @@ module.exports = {
4451
StyleSheet: true,
4552
Switch: true,
4653
Systrace: true,
47-
TVEventHandler: true,
48-
TabBarIOS: true,
4954
Text: true,
5055
TextInput: true,
51-
TimePickerAndroid: true,
5256
ToastAndroid: true,
5357
Touchable: true,
5458
TouchableHighlight: true,
5559
TouchableNativeFeedback: true,
5660
TouchableOpacity: true,
5761
TouchableWithoutFeedback: true,
62+
TVEventHandler: true,
5863
UIManager: true,
64+
unmountComponentAtNode: true,
65+
useColorScheme: true,
66+
useWindowDimensions: true,
5967
Vibration: true,
6068
View: true,
6169
VirtualizedList: true,
62-
YellowBox: true,
63-
createElement: true,
64-
findNodeHandle: true,
65-
processColor: true,
66-
render: true,
67-
unmountComponentAtNode: true,
68-
useWindowDimensions: true
70+
YellowBox: true
6971
};

0 commit comments

Comments
 (0)