Skip to content

Commit 866e8ad

Browse files
committed
Full upgrade to RN 0.59.2
1 parent dbea288 commit 866e8ad

File tree

19 files changed

+963
-61
lines changed

19 files changed

+963
-61
lines changed

.eslintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"prettier"
66
],
77
"parserOptions": {
8-
"ecmaVersion": 2017,
8+
"ecmaVersion": 2018,
99
"ecmaFeatures": {
1010
"jsx": true,
1111
"modules": true
1212
},
13-
"sourceType": "module"
13+
"sourceType": "module",
14+
"useJSXTextNode": false
1415
},
1516
"env": {
1617
"react-native/react-native": true

.flowconfig

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore unexpected extra "@providesModule"
9+
.*/node_modules/.*/node_modules/fbjs/.*
10+
11+
; Ignore duplicate module providers
12+
; For RN Apps installed via npm, "Libraries" folder is inside
13+
; "node_modules/react-native" but in the source repo it is in the root
14+
.*/Libraries/react-native/React.js
15+
16+
; Ignore polyfills
17+
.*/Libraries/polyfills/.*
18+
19+
; Ignore metro
20+
.*/node_modules/metro/.*
21+
22+
[include]
23+
24+
[libs]
25+
node_modules/react-native/Libraries/react-native/react-native-interface.js
26+
node_modules/react-native/flow/
27+
28+
[options]
29+
emoji=true
30+
31+
esproposal.optional_chaining=enable
32+
esproposal.nullish_coalescing=enable
33+
34+
module.system=haste
35+
module.system.haste.use_name_reducers=true
36+
# get basename
37+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
38+
# strip .js or .js.flow suffix
39+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
40+
# strip .ios suffix
41+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
42+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
43+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
44+
module.system.haste.paths.blacklist=.*/__tests__/.*
45+
module.system.haste.paths.blacklist=.*/__mocks__/.*
46+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
47+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
48+
49+
munge_underscores=true
50+
51+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
52+
53+
module.file_ext=.js
54+
module.file_ext=.jsx
55+
module.file_ext=.json
56+
module.file_ext=.native.js
57+
58+
suppress_type=$FlowIssue
59+
suppress_type=$FlowFixMe
60+
suppress_type=$FlowFixMeProps
61+
suppress_type=$FlowFixMeState
62+
63+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
64+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
65+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
66+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
67+
68+
[version]
69+
^0.92.0

App/Containers/Example/ExampleScreen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ ExampleScreen.propsTypes = {
6060
}
6161

6262
const mapStateToProps = (state) => ({
63-
user: state.example.get('user').toJS(),
64-
userIsLoading: state.example.get('userIsLoading'),
65-
userErrorMessage: state.example.get('userErrorMessage'),
63+
user: state.example.user,
64+
userIsLoading: state.example.userIsLoading,
65+
userErrorMessage: state.example.userErrorMessage,
6666
liveInEurope: liveInEurope(state),
6767
})
6868

App/Stores/CreateStore.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { applyMiddleware, compose, createStore } from 'redux'
22
import createSagaMiddleware from 'redux-saga'
33
import { persistReducer, persistStore } from 'redux-persist'
4-
import immutableTransform from 'redux-persist-transform-immutable'
54

65
/**
76
* This import defaults to localStorage for web and AsyncStorage for react-native.
@@ -15,13 +14,6 @@ import immutableTransform from 'redux-persist-transform-immutable'
1514
import storage from 'redux-persist/lib/storage'
1615

1716
const persistConfig = {
18-
transforms: [
19-
/**
20-
* This is necessary to support immutable reducers.
21-
* @see https://github.com/rt2zz/redux-persist-transform-immutable
22-
*/
23-
immutableTransform(),
24-
],
2517
key: 'root',
2618
storage: storage,
2719
/**

App/Stores/Example/InitialState.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import { Map, List } from 'immutable'
2-
31
/**
42
* The initial values for the redux state.
53
*/
6-
export const INITIAL_STATE = Map({
7-
user: List(),
4+
export const INITIAL_STATE = {
5+
user: {},
86
userIsLoading: false,
97
userErrorMessage: null,
10-
})
8+
}

App/Stores/Example/Reducers.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,26 @@
77
import { INITIAL_STATE } from './InitialState'
88
import { createReducer } from 'reduxsauce'
99
import { ExampleTypes } from './Actions'
10-
import { List } from 'immutable'
1110

12-
export const fetchUserLoading = (state) =>
13-
state.merge({
14-
userIsLoading: true,
15-
userErrorMessage: '',
16-
})
11+
export const fetchUserLoading = (state) => ({
12+
...state,
13+
userIsLoading: true,
14+
userErrorMessage: null,
15+
})
1716

18-
export const fetchUserSuccess = (state, { user }) =>
19-
state.merge({
20-
user: user,
21-
userIsLoading: false,
22-
userErrorMessage: null,
23-
})
17+
export const fetchUserSuccess = (state, { user }) => ({
18+
...state,
19+
user: user,
20+
userIsLoading: false,
21+
userErrorMessage: null,
22+
})
2423

25-
export const fetchUserFailure = (state, { errorMessage }) =>
26-
state.merge({
27-
user: List(),
28-
userIsLoading: false,
29-
userErrorMessage: errorMessage,
30-
})
24+
export const fetchUserFailure = (state, { errorMessage }) => ({
25+
...state,
26+
user: {},
27+
userIsLoading: false,
28+
userErrorMessage: errorMessage,
29+
})
3130

3231
/**
3332
* @see https://github.com/infinitered/reduxsauce#createreducer

App/Stores/Example/Selectors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
*/
88

99
export const liveInEurope = (state) => {
10-
if (state.example.get('user').isEmpty()) return null
10+
if (Object.entries(state.example.user).length <= 0) return null
1111

1212
// For this example, we imagine this cities are european cities
1313
let europeanCities = ['Gwenborough', 'Wisokyburgh', 'McKenziehaven', 'South Elvis', 'Roscoeview']
1414

15-
return europeanCities.includes(state.example.get('user').toJS().address.city)
15+
return europeanCities.includes(state.example.user.address.city)
1616
}

__tests__/App-test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

android/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ android {
138138
}
139139

140140
dependencies {
141+
implementation project(':react-native-gesture-handler')
141142
implementation fileTree(dir: "libs", include: ["*.jar"])
142143
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
143144
implementation "com.facebook.react:react-native:+" // From node_modules

android/app/build_defs.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Helper definitions to glob .aar and .jar targets"""
2+
3+
def create_aar_targets(aarfiles):
4+
for aarfile in aarfiles:
5+
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6+
lib_deps.append(":" + name)
7+
android_prebuilt_aar(
8+
name = name,
9+
aar = aarfile,
10+
)
11+
12+
def create_jar_targets(jarfiles):
13+
for jarfile in jarfiles:
14+
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15+
lib_deps.append(":" + name)
16+
prebuilt_jar(
17+
name = name,
18+
binary_jar = jarfile,
19+
)

0 commit comments

Comments
 (0)