Skip to content

Commit c47e632

Browse files
authored
Merge pull request #37 from thecodingmachine/upgrade/react-native-0592
Upgrade to React Native 0.59.2
2 parents 5902e6b + cb43be2 commit c47e632

Some content is hidden

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

48 files changed

+3312
-1693
lines changed

.babelrc

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

.eslintrc

Lines changed: 9 additions & 14 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
@@ -21,18 +22,12 @@
2122
"plugin:react-native/all",
2223
"plugin:prettier/recommended"
2324
],
25+
"settings": {
26+
"react": {
27+
"version": "detect",
28+
},
29+
},
2430
"rules": {
25-
"prettier/prettier": "error",
26-
"comma-dangle" : ["error", "always-multiline"],
27-
"space-before-function-paren": ["error", {
28-
"anonymous": "never",
29-
"named": "never",
30-
"asyncArrow": "always"
31-
}],
32-
"no-fallthrough": ["error", { "commentPattern": "break[\\s\\w]*omitted" }],
33-
"react/jsx-uses-vars": 2,
34-
"react/jsx-indent-props": [2, 2],
35-
"react/prop-types": [2,{ "skipUndeclared": true}],
36-
"react/display-name": [0, { "ignoreTranspilerName": false }]
31+
"react-native/no-raw-text": 0 // Avoid false positive, wait for fix
3732
}
3833
}

.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

.gitattributes

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
11
*.pbxproj -text
2+
* text=auto
3+
4+
# Force the following filetypes to have unix eols, so Windows does not break them
5+
**/*.* text eol=lf
6+
7+
# Windows forced line-endings
8+
/.idea/* text eol=crlf
9+
10+
#
11+
## These files are binary and should be left untouched
12+
#
13+
14+
# (binary is a macro for -text -diff)
15+
*.png binary
16+
*.jpg binary
17+
*.jpeg binary
18+
*.gif binary
19+
*.ico binary
20+
*.mov binary
21+
*.mp4 binary
22+
*.mp3 binary
23+
*.flv binary
24+
*.fla binary
25+
*.swf binary
26+
*.gz binary
27+
*.zip binary
28+
*.7z binary
29+
*.ttf binary
30+
*.eot binary
31+
*.woff binary
32+
*.woff2 binary
33+
*.pyc binary
34+
*.pdf binary
35+
*.ez binary
36+
*.bz2 binary
37+
*.swp binary
38+
*.swp binary
39+
*.ipa binary
40+
*.apk binary
41+
*.jar binary
42+
*gradlew binary
43+
*BUCK binary

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
jsxBracketSameLine : false,
1010
arrowParens : "always",
1111
rangeStart : 0,
12-
parser : "babylon",
12+
parser : "babel",
1313
requirePragma : false,
1414
insertPragma : false,
1515
proseWrap : "preserve"

App/Containers/Example/ExampleScreen.js

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react'
2-
import { Platform, Text, View, Button } from 'react-native'
2+
import { Platform, Text, View, Button, ActivityIndicator, Image } from 'react-native'
33
import { connect } from 'react-redux'
44
import { PropTypes } from 'prop-types'
55
import ExampleActions from 'App/Stores/Example/Actions'
66
import { liveInEurope } from 'App/Stores/Example/Selectors'
77
import Style from './ExampleScreenStyle'
8+
import { Images } from 'App/Theme'
89

910
/**
1011
* This is an example of a container component.
@@ -24,45 +25,50 @@ class ExampleScreen extends React.Component {
2425
}
2526

2627
render() {
27-
let isLoading = this.props.userIsLoading ? 'Data are loading...' : ''
28-
let user = this.props.user
29-
let error = this.props.userErrorMessage
30-
let result = null
31-
if (user && !error) {
32-
result =
33-
"I'm a fake user, my name is " +
34-
user.name +
35-
'.\n' +
36-
(this.props.liveInEurope ? 'I live in Europe !' : "I don't live in Europe.")
37-
}
38-
3928
return (
4029
<View style={Style.container}>
41-
<Text style={Style.title}>TheCodingMachine boilerplate</Text>
42-
<Text style={Style.text}>To get started, edit App.js</Text>
43-
<Text style={Style.instructions}>{instructions}</Text>
44-
<Text style={Style.loading}>{isLoading}</Text>
45-
{user && !error ? (
46-
<Text style={Style.result}>{result}</Text>
30+
{this.props.userIsLoading ? (
31+
<ActivityIndicator size="large" color="#0000ff" />
4732
) : (
48-
<Text style={Style.error}>{error}</Text>
33+
<View>
34+
<View style={Style.logoContainer}>
35+
<Image style={Style.logo} source={Images.logo} resizeMode={'contain'} />
36+
</View>
37+
<Text style={Style.text}>To get started, edit App.js</Text>
38+
<Text style={Style.instructions}>{instructions}</Text>
39+
{this.props.userErrorMessage ? (
40+
<Text style={Style.error}>{this.props.userErrorMessage}</Text>
41+
) : (
42+
<View>
43+
<Text style={Style.result}>
44+
{"I'm a fake user, my name is "}
45+
{this.props.user.name}
46+
</Text>
47+
<Text style={Style.result}>
48+
{this.props.liveInEurope ? 'I live in Europe !' : "I don't live in Europe."}
49+
</Text>
50+
</View>
51+
)}
52+
<Button onPress={this.props.fetchUser} title="Refresh" />
53+
</View>
4954
)}
50-
<Button onPress={this.props.fetchUser} title="Refresh" />
5155
</View>
5256
)
5357
}
5458
}
5559

56-
ExampleScreen.propsTypes = {
57-
user: PropTypes.number,
60+
ExampleScreen.propTypes = {
61+
user: PropTypes.object,
5862
userIsLoading: PropTypes.bool,
5963
userErrorMessage: PropTypes.string,
64+
fetchUser: PropTypes.func,
65+
liveInEurope: PropTypes.bool,
6066
}
6167

6268
const mapStateToProps = (state) => ({
63-
user: state.example.get('user').toJS(),
64-
userIsLoading: state.example.get('userIsLoading'),
65-
userErrorMessage: state.example.get('userErrorMessage'),
69+
user: state.example.user,
70+
userIsLoading: state.example.userIsLoading,
71+
userErrorMessage: state.example.userErrorMessage,
6672
liveInEurope: liveInEurope(state),
6773
})
6874

App/Containers/Example/ExampleScreenStyle.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,13 @@ export default StyleSheet.create({
4141
marginBottom: 5,
4242
color: 'red',
4343
},
44+
logoContainer: {
45+
width: '100%',
46+
height: 300,
47+
marginBottom: 25,
48+
},
49+
logo: {
50+
width: '100%',
51+
height: '100%',
52+
},
4453
})

App/Containers/Root/RootScreen.js

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
11
import React, { Component } from 'react'
2-
import { createStackNavigator, createAppContainer } from 'react-navigation'
32
import NavigationService from 'App/Services/NavigationService'
3+
import AppNavigator from 'App/Navigators/AppNavigator'
44
import { View } from 'react-native'
55
import styles from './RootScreenStyle'
6-
import ExampleScreen from 'App/Containers/Example/ExampleScreen'
7-
import SplashScreen from 'App/Containers/SplashScreen/SplashScreen'
86
import { connect } from 'react-redux'
97
import StartupActions from 'App/Stores/Startup/Actions'
10-
11-
/**
12-
* The root screen contains the application's navigation.
13-
*
14-
* @see https://reactnavigation.org/docs/en/hello-react-navigation.html#creating-a-stack-navigator
15-
*/
16-
const AppNav = createStackNavigator(
17-
{
18-
// Create the application routes here (the key is the route name, the value is the target screen)
19-
// See https://reactnavigation.org/docs/en/stack-navigator.html#routeconfigs
20-
SplashScreen: SplashScreen,
21-
// The main application screen is our "ExampleScreen". Feel free to replace it with your
22-
// own screen and remove the example.
23-
MainScreen: ExampleScreen,
24-
},
25-
{
26-
// By default the application will show the splash screen
27-
initialRouteName: 'SplashScreen',
28-
// See https://reactnavigation.org/docs/en/stack-navigator.html#stacknavigatorconfig
29-
headerMode: 'none',
30-
}
31-
)
32-
33-
const App = createAppContainer(AppNav)
8+
import { PropTypes } from 'prop-types'
349

3510
class RootScreen extends Component {
3611
componentDidMount() {
@@ -41,7 +16,7 @@ class RootScreen extends Component {
4116
render() {
4217
return (
4318
<View style={styles.container}>
44-
<App
19+
<AppNavigator
4520
// Initialize the NavigationService (see https://reactnavigation.org/docs/en/navigating-without-navigation-prop.html)
4621
ref={(navigatorRef) => {
4722
NavigationService.setTopLevelNavigator(navigatorRef)
@@ -52,6 +27,10 @@ class RootScreen extends Component {
5227
}
5328
}
5429

30+
RootScreen.propTypes = {
31+
startup: PropTypes.func,
32+
}
33+
5534
const mapStateToProps = (state) => ({})
5635

5736
const mapDispatchToProps = (dispatch) => ({

App/Images/TOM-Legend.png

2.7 MB
Loading

App/Images/TOM.png

2.22 MB
Loading

0 commit comments

Comments
 (0)