Skip to content

Commit 7b23bb2

Browse files
committed
Merge branch 'refactor'
* refactor: refactor internals [part 1/2]
2 parents 5f29885 + 1c8fda6 commit 7b23bb2

32 files changed

+301
-113
lines changed

.eslintrc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,19 @@
2222
"$Exports": false,
2323
"$FlowIssue": false,
2424
"$FlowFixMe": false,
25-
"$FixMe": false
25+
"$FixMe": false,
26+
// Polyfill
27+
"requestAnimationFrame": false,
2628
},
2729
"rules": {
28-
'no-underscore-dangle': [2, { allowAfterThis: true }]
30+
// TODO: Remove this override when airbnb bumps `import` to v1.14.0
31+
"import/no-extraneous-dependencies": [
32+
"error", {
33+
"devDependencies": true,
34+
"peerDependencies": true
35+
},
36+
],
37+
"react/jsx-filename-extension": ["error", { "extensions": [".js"] }],
38+
"no-underscore-dangle": [2, { allowAfterThis: true }]
2939
}
3040
}

.flowconfig

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@
4949
.*\.buckd/
5050

5151
# Ignore RNPM
52-
.*/local-cli/rnpm/.*
52+
.*/local-cli/commands.js
53+
.*/local-cli/cliEntry.js
54+
55+
# Ignore duplicate module providers
56+
.*/Libraries/react-native/ReactNative.js
5357

5458
.*/node_modules/is-my-json-valid/test/.*\.json
5559
.*/node_modules/iconv-lite/encodings/tables/.*\.json
@@ -75,7 +79,7 @@
7579
# modules/
7680
node_modules/react-native/Libraries/react-native/react-native-interface.js
7781
node_modules/react-native/flow/
78-
node_modules/fbjs/flow/lib/
82+
flow/
7983

8084
[options]
8185
module.system=haste
@@ -92,9 +96,11 @@ suppress_type=$FlowIssue
9296
suppress_type=$FlowFixMe
9397
suppress_type=$FixMe
9498

95-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
96-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
99+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
100+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
97101
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
98102

103+
unsafe.enable_getters_and_setters=true
104+
99105
[version]
100-
^0.27.0
106+
^0.30.0

examples/Aviato/.flowconfig

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@
99
# Ignore malformed json
1010
.*/node_modules/y18n/test/.*\.json
1111

12+
# Ignore the website subdir
13+
<PROJECT_ROOT>/website/.*
14+
15+
# Ignore BUCK generated dirs
16+
<PROJECT_ROOT>/\.buckd/
17+
18+
# Ignore unexpected extra @providesModule
19+
.*/node_modules/commoner/test/source/widget/share.js
20+
21+
# Ignore duplicate module providers
22+
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
23+
.*/Libraries/react-native/React.js
24+
.*/Libraries/react-native/ReactNative.js
25+
.*/node_modules/jest-runtime/build/__tests__/.*
26+
1227
[include]
1328

1429
[libs]
@@ -33,9 +48,11 @@ suppress_type=$FlowIssue
3348
suppress_type=$FlowFixMe
3449
suppress_type=$FixMe
3550

36-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
37-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
51+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
52+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
3853
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
3954

55+
unsafe.enable_getters_and_setters=true
56+
4057
[version]
41-
^0.27.0
58+
^0.30.0

examples/Aviato/app/components/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export const component = (backgroundColor) => (props) => (
2525
</View>
2626
);
2727

28-
export const stackHeaderComponent = (backgroundColor, marginTop = 0) => {
29-
const headerStyle = { backgroundColor, marginTop };
28+
export const stackHeaderComponent = (backgroundColor) => {
29+
const headerStyle = { backgroundColor };
3030

3131
return class extends Component {
3232

@@ -78,8 +78,8 @@ export const stackHeaderComponent = (backgroundColor, marginTop = 0) => {
7878
};
7979
};
8080

81-
export const tabHeaderComponent = (backgroundColor, marginTop = 0) => {
82-
const headerStyle = { backgroundColor, marginTop };
81+
export const tabHeaderComponent = (backgroundColor) => {
82+
const headerStyle = { backgroundColor };
8383

8484
return class extends Component {
8585

examples/Aviato/app/components/styles.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@
33
import {
44
StyleSheet,
55
Platform,
6-
NavigationExperimental,
76
} from 'react-native';
87

98
const { hairlineWidth } = StyleSheet;
109

11-
const {
12-
Header: NavigationHeader,
13-
} = NavigationExperimental;
14-
15-
export const NAVIGATION_HEADER_HEIGHT = NavigationHeader.HEIGHT;
1610
export const STATUSBAR_HEIGHT = Platform.OS === 'ios' ? 20 : 0;
1711

1812
export default StyleSheet.create({

examples/Aviato/app/routes.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ import { Notifications } from './components/Notifications';
1010
import { UserOverlay } from './components/User';
1111
import { ProfileHeader } from './components/Profile';
1212

13-
import { NAVIGATION_HEADER_HEIGHT } from './components/styles';
14-
15-
const SECOND_HEADER = NAVIGATION_HEADER_HEIGHT;
16-
const THIRD_HEADER = NAVIGATION_HEADER_HEIGHT * 2;
17-
1813
const redirectToNotifications = (nextState, replace) => {
1914
replace('/notifications');
2015
};
@@ -34,23 +29,23 @@ const routes = (
3429
<Route
3530
path="/"
3631
component={component('#F5807B')}
37-
overlayComponent={tabHeaderComponent('#89B2FD', SECOND_HEADER)}
32+
overlayComponent={tabHeaderComponent('#89B2FD')}
3833
/>
3934
<StackRoute
4035
path="private"
4136
component={component('#FFFFFF')}
42-
overlayComponent={tabHeaderComponent('#89B2FD', SECOND_HEADER)}
37+
overlayComponent={tabHeaderComponent('#89B2FD')}
4338
transition="horizontal-card-stack"
4439
>
4540
<Route
4641
path="settings"
4742
component={component('#FFF0D1')}
48-
overlayComponent={stackHeaderComponent('#C8D574', THIRD_HEADER)}
43+
overlayComponent={stackHeaderComponent('#C8D574')}
4944
/>
5045
<Route
5146
path="settings/info"
5247
component={component('#EF4E5E')}
53-
overlayComponent={stackHeaderComponent('#F5807B', THIRD_HEADER)}
48+
overlayComponent={stackHeaderComponent('#F5807B')}
5449
/>
5550
</StackRoute>
5651
</TabsRoute>
@@ -73,13 +68,13 @@ const routes = (
7368
<Route
7469
path="settings"
7570
component={component('#FFF0D1')}
76-
overlayComponent={stackHeaderComponent('beige', SECOND_HEADER)}
71+
overlayComponent={stackHeaderComponent('beige')}
7772
transition="horizontal-card-stack"
7873
/>
7974
<Route
8075
path="settings/info"
8176
component={component('#EF4E5E')}
82-
overlayComponent={stackHeaderComponent('#F5807B', SECOND_HEADER)}
77+
overlayComponent={stackHeaderComponent('#F5807B')}
8378
transition="vertical-card-stack"
8479
/>
8580
</StackRoute>

examples/Aviato/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"android": "./node_modules/.bin/react-native run-android"
99
},
1010
"dependencies": {
11-
"react": "^15.2.0",
12-
"react-native": "0.30.0-rc.0",
13-
"react-native-side-menu": "^0.19.0",
14-
"react-router": "3.0.0-alpha.1",
11+
"react": "~15.3.0",
12+
"react-native": "0.32.0",
13+
"react-native-side-menu": "^0.20.0",
14+
"react-router": "3.0.0-alpha.3",
1515
"react-router-native": "file:../../"
1616
}
1717
}

modules/AddressBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class AddressBar extends Component<DefaultProps, Props, State> {
105105
});
106106
}
107107

108-
render(): ?ReactElement {
108+
render(): ?ReactElement<any> {
109109
const { show } = this.props;
110110

111111
if (!show) {

modules/AddressBarHistory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class AddressBarHistory extends Component<any, Props, State> {
101101
);
102102
}
103103

104-
render(): ?ReactElement {
104+
render(): ?ReactElement<any> {
105105
const { historyType, onPressBackdrop, history } = this.props;
106106

107107
if (!historyType) {

modules/IndexRoute.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const { TABS_ROUTE } = RouteTypes;
1313

1414
type Props = {
1515
path: ?any,
16-
component: ReactClass,
17-
overlayComponent: ?ReactClass,
16+
component: ReactClass<any>,
17+
overlayComponent: ?ReactClass<any>,
1818
components: ?any,
1919
getComponent: ?any,
2020
getComponents: ?any,
@@ -52,7 +52,7 @@ class IndexRoute extends Component<any, Props, any> {
5252

5353
props: Props;
5454

55-
render(): ?ReactElement {
55+
render(): ?ReactElement<any> {
5656
invariant(
5757
false,
5858
'<IndexRoute> elements are for router configuration only and should not be rendered'

0 commit comments

Comments
 (0)