Browse Source

fixing android

Daniel Zlotin 7 years ago
parent
commit
8cebd2238a

+ 4
- 4
android/app/build.gradle View File

3
 
3
 
4
 android {
4
 android {
5
     compileSdkVersion 25
5
     compileSdkVersion 25
6
-    buildToolsVersion "25.0.1"
6
+    buildToolsVersion "25.0.2"
7
 
7
 
8
     defaultConfig {
8
     defaultConfig {
9
         minSdkVersion 16
9
         minSdkVersion 16
10
-        targetSdkVersion 23
10
+        targetSdkVersion 25
11
         versionCode 1
11
         versionCode 1
12
         versionName "1.0"
12
         versionName "1.0"
13
     }
13
     }
47
 dependencies {
47
 dependencies {
48
     compile fileTree(dir: "libs", include: ["*.jar"])
48
     compile fileTree(dir: "libs", include: ["*.jar"])
49
 
49
 
50
-	  compile 'com.android.support:design:25.0.1'
50
+    compile 'com.android.support:design:25.0.1'
51
     compile "com.android.support:appcompat-v7:25.0.1"
51
     compile "com.android.support:appcompat-v7:25.0.1"
52
 
52
 
53
     // node_modules
53
     // node_modules
59
 
59
 
60
     // tests
60
     // tests
61
     testCompile "junit:junit:4.12"
61
     testCompile "junit:junit:4.12"
62
-    testCompile "org.robolectric:robolectric:3.1.4"
62
+    testCompile "org.robolectric:robolectric:3.2.2"
63
     testCompile 'org.assertj:assertj-core:2.5.0'
63
     testCompile 'org.assertj:assertj-core:2.5.0'
64
 }
64
 }

+ 0
- 1
android/app/src/main/AndroidManifest.xml View File

13
             android:name="com.facebook.react.devsupport.DevSettingsActivity"
13
             android:name="com.facebook.react.devsupport.DevSettingsActivity"
14
             android:exported="false" />
14
             android:exported="false" />
15
     </application>
15
     </application>
16
-
17
 </manifest>
16
 </manifest>

+ 1
- 1
android/build.gradle View File

5
         jcenter()
5
         jcenter()
6
     }
6
     }
7
     dependencies {
7
     dependencies {
8
-        classpath 'com.android.tools.build:gradle:2.2.2'
8
+        classpath 'com.android.tools.build:gradle:2.3.0-beta3'
9
 
9
 
10
         // NOTE: Do not place your application dependencies here; they belong
10
         // NOTE: Do not place your application dependencies here; they belong
11
         // in the individual module build.gradle files
11
         // in the individual module build.gradle files

+ 1
- 1
android/gradle/wrapper/gradle-wrapper.properties View File

3
 distributionPath=wrapper/dists
3
 distributionPath=wrapper/dists
4
 zipStoreBase=GRADLE_USER_HOME
4
 zipStoreBase=GRADLE_USER_HOME
5
 zipStorePath=wrapper/dists
5
 zipStorePath=wrapper/dists
6
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

+ 2
- 4
android/prepare-robolectric.gradle View File

3
 configurations.create('robolectricRuntime')
3
 configurations.create('robolectricRuntime')
4
 
4
 
5
 dependencies {
5
 dependencies {
6
-    robolectricRuntime "org.ccil.cowan.tagsoup:tagsoup:1.2"
7
-    robolectricRuntime "org.robolectric:android-all:6.0.0_r1-robolectric-0"
8
-    robolectricRuntime "org.robolectric:shadows-core-v23:3.1.4"
9
-    robolectricRuntime "org.json:json:20080701"
6
+    robolectricRuntime "org.robolectric:android-all:6.0.1_r3-robolectric-0"
7
+    robolectricRuntime "org.robolectric:shadows-core:3.2.2"
10
 }
8
 }
11
 
9
 
12
 rootProject.task(type: Copy, overwrite: true, "downloadRobolectricDependencies") {
10
 rootProject.task(type: Copy, overwrite: true, "downloadRobolectricDependencies") {

+ 1
- 0
ios/RNNRootViewController.m View File

34
 	[RNN.instance.eventEmitter sendContainerStop:self.containerId];
34
 	[RNN.instance.eventEmitter sendContainerStop:self.containerId];
35
 }
35
 }
36
 
36
 
37
+
37
 @end
38
 @end

+ 4
- 21
playground/android/app/build.gradle View File

1
 apply plugin: "com.android.application"
1
 apply plugin: "com.android.application"
2
-
3
-import com.android.build.OutputFile
4
 apply from: "../../node_modules/react-native/react.gradle"
2
 apply from: "../../node_modules/react-native/react.gradle"
5
 
3
 
6
-/**
7
- * Set this to true to create two separate APKs instead of one:
8
- *   - An APK that only works on ARM devices
9
- *   - An APK that only works on x86 devices
10
- * The advantage is the size of the APK is reduced by about 4MB.
11
- * Upload all the APKs to the Play Store and people will download
12
- * the correct one based on the CPU architecture of their device.
13
- */
14
-def enableSeparateBuildPerCPUArchitecture = false
15
-
16
-/**
17
- * Run Proguard to shrink the Java bytecode in release builds.
18
- */
19
-def enableProguardInReleaseBuilds = false
20
-
21
 android {
4
 android {
22
     compileSdkVersion 25
5
     compileSdkVersion 25
23
-    buildToolsVersion "25.0.1"
6
+    buildToolsVersion "25.0.2"
24
 
7
 
25
     defaultConfig {
8
     defaultConfig {
26
         applicationId "com.example"
9
         applicationId "com.example"
27
         minSdkVersion 16
10
         minSdkVersion 16
28
-        targetSdkVersion 23
11
+        targetSdkVersion 25
29
         versionCode 1
12
         versionCode 1
30
         versionName "1.0"
13
         versionName "1.0"
31
         ndk {
14
         ndk {
35
     splits {
18
     splits {
36
         abi {
19
         abi {
37
             reset()
20
             reset()
38
-            enable enableSeparateBuildPerCPUArchitecture
21
+            enable false
39
             universalApk false  // If true, also generate a universal APK
22
             universalApk false  // If true, also generate a universal APK
40
             include "armeabi-v7a", "x86"
23
             include "armeabi-v7a", "x86"
41
         }
24
         }
42
     }
25
     }
43
     buildTypes {
26
     buildTypes {
44
         release {
27
         release {
45
-            minifyEnabled enableProguardInReleaseBuilds
28
+            minifyEnabled false
46
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
29
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
47
         }
30
         }
48
     }
31
     }

+ 1
- 2
playground/android/app/src/main/AndroidManifest.xml View File

1
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
1
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
-    package="com.example">
2
+    package="com.reactnativenavigation.playground">
3
 
3
 
4
     <uses-permission android:name="android.permission.INTERNET" />
4
     <uses-permission android:name="android.permission.INTERNET" />
5
 
5
 
18
             </intent-filter>
18
             </intent-filter>
19
         </activity>
19
         </activity>
20
     </application>
20
     </application>
21
-
22
 </manifest>
21
 </manifest>

playground/android/app/src/main/java/com/example/MainActivity.java → playground/android/app/src/main/java/com/reactnativenavigation/playground/MainActivity.java View File

1
-package com.example;
1
+package com.reactnativenavigation.playground;
2
 
2
 
3
 import com.reactnativenavigation.controllers.SplashActivity;
3
 import com.reactnativenavigation.controllers.SplashActivity;
4
 
4
 

playground/android/app/src/main/java/com/example/MainApplication.java → playground/android/app/src/main/java/com/reactnativenavigation/playground/MainApplication.java View File

1
-package com.example;
1
+package com.reactnativenavigation.playground;
2
 
2
 
3
 import android.support.annotation.Nullable;
3
 import android.support.annotation.Nullable;
4
 
4
 

+ 1
- 1
playground/android/build.gradle View File

5
         jcenter()
5
         jcenter()
6
     }
6
     }
7
     dependencies {
7
     dependencies {
8
-        classpath 'com.android.tools.build:gradle:2.2.2'
8
+        classpath 'com.android.tools.build:gradle:2.3.0-beta3'
9
 
9
 
10
         // NOTE: Do not place your application dependencies here; they belong
10
         // NOTE: Do not place your application dependencies here; they belong
11
         // in the individual module build.gradle files
11
         // in the individual module build.gradle files

+ 1
- 1
playground/android/gradle/wrapper/gradle-wrapper.properties View File

3
 distributionPath=wrapper/dists
3
 distributionPath=wrapper/dists
4
 zipStoreBase=GRADLE_USER_HOME
4
 zipStoreBase=GRADLE_USER_HOME
5
 zipStorePath=wrapper/dists
5
 zipStorePath=wrapper/dists
6
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip

+ 2
- 3
playground/android/settings.gradle View File

1
-rootProject.name = 'example'
1
+rootProject.name = 'playground'
2
 
2
 
3
 include ':app'
3
 include ':app'
4
 include ':react-native-navigation'
4
 include ':react-native-navigation'
5
-project(':react-native-navigation').projectDir = new File(
6
-        rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')
5
+project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/android/app/')

+ 3
- 0
playground/e2e/app.test.js View File

27
   it('screen lifecycle', () => {
27
   it('screen lifecycle', () => {
28
     elementByLabel('Switch to lifecycle screen').tap();
28
     elementByLabel('Switch to lifecycle screen').tap();
29
     expect(elementByLabel('onStart!')).toBeVisible();
29
     expect(elementByLabel('onStart!')).toBeVisible();
30
+    elementByLabel('Push to test onStop').tap();
31
+    expect(elementByLabel('Alert')).toBeVisible();
32
+    expect(elementByLabel('onStop!')).toBeVisible();
30
   });
33
   });
31
 });
34
 });
32
 
35
 

+ 1
- 1
playground/src/app.js View File

8
   Navigation.events().onAppLaunched(() => {
8
   Navigation.events().onAppLaunched(() => {
9
     Navigation.setRoot({
9
     Navigation.setRoot({
10
       container: {
10
       container: {
11
-        name: 'com.example.WelcomeScreen'
11
+        name: 'navigation.playground.WelcomeScreen'
12
       }
12
       }
13
     });
13
     });
14
   });
14
   });

+ 12
- 2
playground/src/containers/LifecycleScreen.js View File

1
 import React, { Component } from 'react';
1
 import React, { Component } from 'react';
2
-import { View, Text } from 'react-native';
2
+import { View, Text, Button } from 'react-native';
3
+
4
+import Navigation from 'react-native-navigation';
3
 
5
 
4
 class LifecycleScreen extends Component {
6
 class LifecycleScreen extends Component {
5
   constructor(props) {
7
   constructor(props) {
6
     super(props);
8
     super(props);
9
+    this.onClickPush = this.onClickPush.bind(this);
7
     this.state = {
10
     this.state = {
8
       text: 'nothing yet'
11
       text: 'nothing yet'
9
     };
12
     };
14
   }
17
   }
15
 
18
 
16
   onStop() {
19
   onStop() {
17
-    this.setState({ text: 'onStop!' });
20
+    alert('onStop!'); //eslint-disable-line
18
   }
21
   }
19
 
22
 
20
   render() {
23
   render() {
21
     return (
24
     return (
22
       <View style={styles.root}>
25
       <View style={styles.root}>
23
         <Text style={styles.h1}>{this.state.text}</Text>
26
         <Text style={styles.h1}>{this.state.text}</Text>
27
+        <Button title="Push to test onStop" onPress={this.onClickPush} />
24
       </View>
28
       </View>
25
     );
29
     );
26
   }
30
   }
31
+
32
+  onClickPush() {
33
+    Navigation.on(this.props.id).push({
34
+      name: 'navigation.playground.SimpleScreen'
35
+    });
36
+  }
27
 }
37
 }
28
 export default LifecycleScreen;
38
 export default LifecycleScreen;
29
 
39
 

+ 9
- 9
playground/src/containers/WelcomeScreen.js View File

27
       tabs: [
27
       tabs: [
28
         {
28
         {
29
           container: {
29
           container: {
30
-            name: 'com.example.SimpleScreen',
30
+            name: 'navigation.playground.SimpleScreen',
31
             passProps: {
31
             passProps: {
32
               text: 'This is tab 1',
32
               text: 'This is tab 1',
33
               myFunction: () => 'Hello from a function!'
33
               myFunction: () => 'Hello from a function!'
36
         },
36
         },
37
         {
37
         {
38
           container: {
38
           container: {
39
-            name: 'com.example.SimpleScreen',
39
+            name: 'navigation.playground.SimpleScreen',
40
             passProps: {
40
             passProps: {
41
               text: 'This is tab 2'
41
               text: 'This is tab 2'
42
             }
42
             }
51
       tabs: [
51
       tabs: [
52
         {
52
         {
53
           container: {
53
           container: {
54
-            name: 'com.example.SimpleScreen'
54
+            name: 'navigation.playground.SimpleScreen'
55
           }
55
           }
56
         },
56
         },
57
         {
57
         {
58
           container: {
58
           container: {
59
-            name: 'com.example.SimpleScreen'
59
+            name: 'navigation.playground.SimpleScreen'
60
           }
60
           }
61
         },
61
         },
62
         {
62
         {
63
           container: {
63
           container: {
64
-            name: 'com.example.SimpleScreen'
64
+            name: 'navigation.playground.SimpleScreen'
65
           }
65
           }
66
         }
66
         }
67
       ],
67
       ],
68
       sideMenu: {
68
       sideMenu: {
69
         left: {
69
         left: {
70
           container: {
70
           container: {
71
-            name: 'com.example.SimpleScreen'
71
+            name: 'navigation.playground.SimpleScreen'
72
           }
72
           }
73
         },
73
         },
74
         right: {
74
         right: {
75
           container: {
75
           container: {
76
-            name: 'com.example.SimpleScreen'
76
+            name: 'navigation.playground.SimpleScreen'
77
           }
77
           }
78
         }
78
         }
79
       }
79
       }
82
 
82
 
83
   onClickPush() {
83
   onClickPush() {
84
     Navigation.on(this.props.id).push({
84
     Navigation.on(this.props.id).push({
85
-      name: 'com.example.SimpleScreen',
85
+      name: 'navigation.playground.SimpleScreen',
86
       passProps: {
86
       passProps: {
87
         text: 'Pushed screen'
87
         text: 'Pushed screen'
88
       }
88
       }
92
   onClickLifecycleScreen() {
92
   onClickLifecycleScreen() {
93
     Navigation.setRoot({
93
     Navigation.setRoot({
94
       container: {
94
       container: {
95
-        name: 'com.example.LifecycleScreen'
95
+        name: 'navigation.playground.LifecycleScreen'
96
       }
96
       }
97
     });
97
     });
98
   }
98
   }

+ 3
- 3
playground/src/containers/index.js View File

5
 import LifecycleScreen from './LifecycleScreen';
5
 import LifecycleScreen from './LifecycleScreen';
6
 
6
 
7
 export function registerContainers() {
7
 export function registerContainers() {
8
-  Navigation.registerContainer(`com.example.WelcomeScreen`, () => WelcomeScreen);
9
-  Navigation.registerContainer(`com.example.SimpleScreen`, () => SimpleScreen);
10
-  Navigation.registerContainer(`com.example.LifecycleScreen`, () => LifecycleScreen);
8
+  Navigation.registerContainer(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
9
+  Navigation.registerContainer(`navigation.playground.SimpleScreen`, () => SimpleScreen);
10
+  Navigation.registerContainer(`navigation.playground.LifecycleScreen`, () => LifecycleScreen);
11
 }
11
 }