Skip to content

Commit cd74da5

Browse files
authored
hotfix: Example, ReduxExample and depencies fixes for Android (#3195)
1 parent ddd90cc commit cd74da5

39 files changed

+1240
-2895
lines changed

.circleci/config.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ jobs:
77
steps:
88
- checkout
99
- restore_cache:
10-
key: dependency-cache-{{ checksum "package.json" }}
10+
key: dependency-cache-{{ checksum "yarn.lock" }}
1111
- run:
1212
name: install-dependencies
1313
command: yarn install --frozen-lockfile
1414
- save_cache:
15-
key: dependency-cache-{{ checksum "package.json" }}
15+
key: dependency-cache-{{ checksum "yarn.lock" }}
1616
paths:
17-
- ./node_modules
1817
- ~/.cache/yarn
1918
- run:
2019
name: test
2120
command: yarn test
2221
- run:
2322
name: linter
24-
command: yarn eslint
23+
command: yarn lint

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ module.exports = {
5757
},
5858
},
5959
node: true,
60+
react: {
61+
version: '16.4.2',
62+
},
6063
},
6164
};

Example/android/app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ def enableSeparateBuildPerCPUArchitecture = false
8383
def enableProguardInReleaseBuilds = false
8484

8585
android {
86-
compileSdkVersion 23
87-
buildToolsVersion "23.0.1"
86+
compileSdkVersion rootProject.ext.compileSdkVersion
87+
buildToolsVersion rootProject.ext.buildToolsVersion
8888

8989
defaultConfig {
9090
applicationId "com.example"
91-
minSdkVersion 16
92-
targetSdkVersion 22
91+
minSdkVersion rootProject.ext.minSdkVersion
92+
targetSdkVersion rootProject.ext.targetSdkVersion
9393
versionCode 1
9494
versionName "1.0"
9595
ndk {
@@ -127,7 +127,7 @@ android {
127127

128128
dependencies {
129129
compile fileTree(dir: "libs", include: ["*.jar"])
130-
compile "com.android.support:appcompat-v7:23.0.1"
130+
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
131131
compile "com.facebook.react:react-native:+" // From node_modules
132132
}
133133

Example/android/build.gradle

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,59 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.3'
9+
classpath 'com.android.tools.build:gradle:3.0.0'
910

1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
1213
}
1314
}
1415

16+
task clean(type: Delete) {
17+
delete rootProject.buildDir
18+
}
19+
1520
allprojects {
1621
repositories {
1722
mavenLocal()
1823
jcenter()
24+
google()
25+
maven { url "https://maven.google.com" }
1926
maven {
2027
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
2128
url "$rootDir/../node_modules/react-native/android"
2229
}
2330
}
2431
}
32+
33+
ext {
34+
googlePlayServicesVersion = "12.0.1"
35+
buildToolsVersion = "26.0.2"
36+
minSdkVersion = 16
37+
compileSdkVersion = 26
38+
targetSdkVersion = 26
39+
supportLibVersion = "27.1.0"
40+
}
41+
42+
43+
subprojects {
44+
project.configurations.all {
45+
resolutionStrategy.eachDependency { details ->
46+
if (details.requested.group == 'com.android.support'
47+
&& !details.requested.name.contains('multidex') ) {
48+
details.useVersion rootProject.ext.supportLibVersion
49+
}
50+
}
51+
}
52+
53+
afterEvaluate {
54+
project -> if (project.hasProperty("android")) {
55+
android {
56+
compileSdkVersion rootProject.ext.compileSdkVersion
57+
buildToolsVersion rootProject.ext.buildToolsVersion
58+
}
59+
}
60+
}
61+
}

Example/android/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
1919

20+
org.gradle.daemon=false
21+
org.gradle.parallel=false
22+
org.gradle.configureondemand=false
2023
android.useDeprecatedNdk=true
24+
android.enableAapt2=false

Example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

Example/babel.config.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
module.exports = {
2-
presets: [
3-
'react-native',
4-
'module:metro-react-native-babel-preset',
2+
"presets": [
3+
"babel-preset-react-native"
54
],
6-
plugins: [
7-
['@babel/plugin-proposal-decorators', { legacy: true }],
8-
],
9-
};
5+
"plugins": [
6+
["@babel/plugin-proposal-decorators", { "legacy": true }]
7+
]
8+
}

Example/components/CustomNavBar2.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import {
2-
Image, Platform, StyleSheet, Text, TouchableOpacity, View,
3-
} from 'react-native';
1+
import { Image, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
42
import React from 'react';
53
import { Actions } from 'react-native-router-flux';
64

75
const styles = StyleSheet.create({
86
container: {
9-
height: (Platform.OS === 'ios') ? 64 : 54,
7+
height: Platform.OS === 'ios' ? 64 : 54,
108
flexDirection: 'row',
119
paddingTop: 20,
1210
backgroundColor: 'green',
@@ -24,32 +22,25 @@ export default class CustomNavBar extends React.Component {
2422

2523
_renderLeft() {
2624
return (
27-
<TouchableOpacity
28-
onPress={Actions.pop}
29-
style={[styles.navBarItem, { paddingLeft: 10 }]}
30-
>
31-
<Image
32-
style={{ width: 30, height: 50 }}
33-
resizeMode="contain"
34-
source={{ uri: 'https://image.flaticon.com/icons/png/512/0/340.png' }}
35-
/>
25+
<TouchableOpacity onPress={Actions.pop} style={[styles.navBarItem, { paddingLeft: 10 }]}>
26+
<Image style={{ width: 30, height: 50 }} resizeMode="contain" source={{ uri: 'https://image.flaticon.com/icons/png/512/0/340.png' }} />
3627
</TouchableOpacity>
3728
);
3829
}
3930

4031
_renderMiddle() {
4132
return (
4233
<View style={styles.navBarItem}>
43-
<Text>{ this.props.title }</Text>
34+
<Text>{this.props.title}</Text>
4435
</View>
4536
);
4637
}
4738

4839
render() {
4940
return (
5041
<View style={styles.container}>
51-
{ this._renderLeft() }
52-
{ this._renderMiddle() }
42+
{this._renderLeft()}
43+
{this._renderMiddle()}
5344
</View>
5445
);
5546
}

Example/components/CustomNavBarView.js

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import {
4-
StyleSheet, Text, View, ViewPropTypes,
5-
} from 'react-native';
3+
import { StyleSheet, Text, View, ViewPropTypes } from 'react-native';
64
import Button from 'react-native-button';
75
import { Actions } from 'react-native-router-flux';
86

@@ -29,10 +27,34 @@ class TabView extends React.Component {
2927
<View style={[styles.container, this.props.sceneStyle]}>
3028
<Button onPress={Actions.pop}>Back</Button>
3129
<Button onPress={() => Actions.replace('launch')}>Welcome Page</Button>
32-
<Button onPress={() => { Actions.customNavBar1(); }}>Switch to Scene with CustomNavBar #1</Button>
33-
<Button onPress={() => { Actions.customNavBar2(); }}>Switch to Scene with CustomNavBar #2</Button>
34-
<Button onPress={() => { Actions.customNavBar3(); }}>Switch to Scene with different CustomNavBar </Button>
35-
<Button onPress={() => { Actions.hiddenNavBar(); }}>Switch to Scene with a navBar hidden</Button>
30+
<Button
31+
onPress={() => {
32+
Actions.customNavBar1();
33+
}}
34+
>
35+
Switch to Scene with CustomNavBar #1
36+
</Button>
37+
<Button
38+
onPress={() => {
39+
Actions.customNavBar2();
40+
}}
41+
>
42+
Switch to Scene with CustomNavBar #2
43+
</Button>
44+
<Button
45+
onPress={() => {
46+
Actions.customNavBar3();
47+
}}
48+
>
49+
Switch to Scene with different CustomNavBar{' '}
50+
</Button>
51+
<Button
52+
onPress={() => {
53+
Actions.hiddenNavBar();
54+
}}
55+
>
56+
Switch to Scene with a navBar hidden
57+
</Button>
3658
</View>
3759
);
3860
}

Example/components/EchoView.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const styles = StyleSheet.create({
2323
},
2424
});
2525

26-
2726
export default class extends React.Component {
2827
onEnter() {
2928
console.log('EchoView onEnter');

Example/components/Error.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from 'react';
2-
import {
3-
View, Text, StyleSheet, Animated, Dimensions,
4-
} from 'react-native';
2+
import { View, Text, StyleSheet, Animated, Dimensions } from 'react-native';
53
import Button from 'react-native-button';
64
import { Actions } from 'react-native-router-flux';
75

@@ -45,16 +43,15 @@ export default class extends React.Component {
4543

4644
render() {
4745
return (
48-
<Animated.View style={[styles.container, { backgroundColor: 'rgba(52,52,52,0.5)' },
49-
{ transform: [{ translateY: this.state.offset }] }]}
50-
>
51-
<View style={{
52-
width: 250,
53-
height: 250,
54-
justifyContent: 'center',
55-
alignItems: 'center',
56-
backgroundColor: 'white',
57-
}}
46+
<Animated.View style={[styles.container, { backgroundColor: 'rgba(52,52,52,0.5)' }, { transform: [{ translateY: this.state.offset }] }]}>
47+
<View
48+
style={{
49+
width: 250,
50+
height: 250,
51+
justifyContent: 'center',
52+
alignItems: 'center',
53+
backgroundColor: 'white',
54+
}}
5855
>
5956
<Text>{this.props.data}</Text>
6057
<Button onPress={this.closeModal.bind(this)}>Close</Button>

Example/components/Launch.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from 'react';
2-
import {
3-
View, Text, StyleSheet, Button,
4-
} from 'react-native';
2+
import { View, Text, StyleSheet, Button } from 'react-native';
53
import { Actions } from 'react-native-router-flux';
64
import { MessageBarManager } from 'react-native-message-bar';
75

@@ -26,13 +24,15 @@ class Launch extends React.Component {
2624
<Button title="Go to CustomNavBar page" onPress={() => Actions.customNavBar()} />
2725
<Button
2826
title="MessageBar alert"
29-
onPress={() => MessageBarManager.showAlert({
30-
title: 'Your alert title goes here',
31-
message: 'Your alert message goes here',
32-
alertType: 'success',
33-
// See Properties section for full customization
34-
// Or check `index.ios.js` or `index.android.js` for a complete example
35-
})}
27+
onPress={() =>
28+
MessageBarManager.showAlert({
29+
title: 'Your alert title goes here',
30+
message: 'Your alert message goes here',
31+
alertType: 'success',
32+
// See Properties section for full customization
33+
// Or check `index.ios.js` or `index.android.js` for a complete example
34+
})
35+
}
3636
/>
3737
<Button title="Go to TabBar page" onPress={Actions.drawer} />
3838
</View>

Example/components/Login2.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ export default class extends React.Component {
2121
<Text>Login page 2</Text>
2222
<Text>Title: {title}</Text>
2323
<Text>Data: {data}</Text>
24-
<Button onPress={() => { Actions.pop({ refresh: { data: 'Data after pop', title: 'title after pop' } }); }}>Back and refresh</Button>
24+
<Button
25+
onPress={() => {
26+
Actions.pop({ refresh: { data: 'Data after pop', title: 'title after pop' } });
27+
}}
28+
>
29+
Back and refresh
30+
</Button>
2531
<Button onPress={() => Actions.loginModal3({ data: 'Custom data3', title: 'Custom title3' })}>Login 3</Button>
2632
</View>
2733
);

Example/components/TabIcon.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import {
4-
Text,
5-
} from 'react-native';
3+
import { Text } from 'react-native';
64

75
const propTypes = {
86
focused: PropTypes.bool,
@@ -14,11 +12,7 @@ const defaultProps = {
1412
title: '',
1513
};
1614

17-
const TabIcon = props => (
18-
<Text style={{ color: props.focused ? 'red' : 'black' }}>
19-
{props.title}
20-
</Text>
21-
);
15+
const TabIcon = props => <Text style={{ color: props.focused ? 'red' : 'black' }}>{props.title}</Text>;
2216

2317
TabIcon.propTypes = propTypes;
2418
TabIcon.defaultProps = defaultProps;

Example/components/TabView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class TabView extends React.Component {
3737
return (
3838
<View style={[styles.container, this.props.sceneStyle]}>
3939
<Text>
40-
Tab title:{this.props.title} name:{this.props.name}
40+
Tab title:
41+
{this.props.title} name:
42+
{this.props.name}
4143
</Text>
4244
<Text>Tab data: {this.props.data}</Text>
4345
{this.props.name === 'tab_1_1' && <Button onPress={() => Actions.tab_1_2()}>next screen for tab1_1</Button>}

Example/components/modal/BaseModal.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import {
4-
View, Text, TouchableOpacity, StyleSheet, Dimensions,
5-
} from 'react-native';
3+
import { View, Text, TouchableOpacity, StyleSheet, Dimensions } from 'react-native';
64
import { Actions } from 'react-native-router-flux';
75

86
const { height: deviceHeight, width: deviceWidth } = Dimensions.get('window');
97

10-
const BaseModal = ({
11-
children, verticalPercent, horizontalPercent, hideClose,
12-
}) => {
8+
const BaseModal = ({ children, verticalPercent, horizontalPercent, hideClose }) => {
139
const height = verticalPercent ? deviceHeight * verticalPercent : deviceHeight;
1410
const width = horizontalPercent ? deviceHeight * horizontalPercent : deviceWidth;
1511

0 commit comments

Comments
 (0)