Parcourir la source

fixing android

Daniel Zlotin il y a 7 ans
Parent
révision
8cebd2238a

+ 4
- 4
android/app/build.gradle Voir le fichier

@@ -3,11 +3,11 @@ apply from: '../prepare-robolectric.gradle'
3 3
 
4 4
 android {
5 5
     compileSdkVersion 25
6
-    buildToolsVersion "25.0.1"
6
+    buildToolsVersion "25.0.2"
7 7
 
8 8
     defaultConfig {
9 9
         minSdkVersion 16
10
-        targetSdkVersion 23
10
+        targetSdkVersion 25
11 11
         versionCode 1
12 12
         versionName "1.0"
13 13
     }
@@ -47,7 +47,7 @@ android {
47 47
 dependencies {
48 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 51
     compile "com.android.support:appcompat-v7:25.0.1"
52 52
 
53 53
     // node_modules
@@ -59,6 +59,6 @@ dependencies {
59 59
 
60 60
     // tests
61 61
     testCompile "junit:junit:4.12"
62
-    testCompile "org.robolectric:robolectric:3.1.4"
62
+    testCompile "org.robolectric:robolectric:3.2.2"
63 63
     testCompile 'org.assertj:assertj-core:2.5.0'
64 64
 }

+ 0
- 1
android/app/src/main/AndroidManifest.xml Voir le fichier

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

+ 1
- 1
android/build.gradle Voir le fichier

@@ -5,7 +5,7 @@ buildscript {
5 5
         jcenter()
6 6
     }
7 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 10
         // NOTE: Do not place your application dependencies here; they belong
11 11
         // in the individual module build.gradle files

+ 1
- 1
android/gradle/wrapper/gradle-wrapper.properties Voir le fichier

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
3 3
 distributionPath=wrapper/dists
4 4
 zipStoreBase=GRADLE_USER_HOME
5 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 Voir le fichier

@@ -3,10 +3,8 @@ def robolectricDependenciesFolder = rootProject.buildDir.path + "/robolectric-de
3 3
 configurations.create('robolectricRuntime')
4 4
 
5 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 10
 rootProject.task(type: Copy, overwrite: true, "downloadRobolectricDependencies") {

+ 1
- 0
ios/RNNRootViewController.m Voir le fichier

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

+ 4
- 21
playground/android/app/build.gradle Voir le fichier

@@ -1,31 +1,14 @@
1 1
 apply plugin: "com.android.application"
2
-
3
-import com.android.build.OutputFile
4 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 4
 android {
22 5
     compileSdkVersion 25
23
-    buildToolsVersion "25.0.1"
6
+    buildToolsVersion "25.0.2"
24 7
 
25 8
     defaultConfig {
26 9
         applicationId "com.example"
27 10
         minSdkVersion 16
28
-        targetSdkVersion 23
11
+        targetSdkVersion 25
29 12
         versionCode 1
30 13
         versionName "1.0"
31 14
         ndk {
@@ -35,14 +18,14 @@ android {
35 18
     splits {
36 19
         abi {
37 20
             reset()
38
-            enable enableSeparateBuildPerCPUArchitecture
21
+            enable false
39 22
             universalApk false  // If true, also generate a universal APK
40 23
             include "armeabi-v7a", "x86"
41 24
         }
42 25
     }
43 26
     buildTypes {
44 27
         release {
45
-            minifyEnabled enableProguardInReleaseBuilds
28
+            minifyEnabled false
46 29
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
47 30
         }
48 31
     }

+ 1
- 2
playground/android/app/src/main/AndroidManifest.xml Voir le fichier

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

playground/android/app/src/main/java/com/example/MainActivity.java → playground/android/app/src/main/java/com/reactnativenavigation/playground/MainActivity.java Voir le fichier

@@ -1,4 +1,4 @@
1
-package com.example;
1
+package com.reactnativenavigation.playground;
2 2
 
3 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 Voir le fichier

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

+ 1
- 1
playground/android/build.gradle Voir le fichier

@@ -5,7 +5,7 @@ buildscript {
5 5
         jcenter()
6 6
     }
7 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 10
         // NOTE: Do not place your application dependencies here; they belong
11 11
         // in the individual module build.gradle files

+ 1
- 1
playground/android/gradle/wrapper/gradle-wrapper.properties Voir le fichier

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
3 3
 distributionPath=wrapper/dists
4 4
 zipStoreBase=GRADLE_USER_HOME
5 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 Voir le fichier

@@ -1,6 +1,5 @@
1
-rootProject.name = 'example'
1
+rootProject.name = 'playground'
2 2
 
3 3
 include ':app'
4 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 Voir le fichier

@@ -27,6 +27,9 @@ describe('app', () => {
27 27
   it('screen lifecycle', () => {
28 28
     elementByLabel('Switch to lifecycle screen').tap();
29 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 Voir le fichier

@@ -8,7 +8,7 @@ export function start() {
8 8
   Navigation.events().onAppLaunched(() => {
9 9
     Navigation.setRoot({
10 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 Voir le fichier

@@ -1,9 +1,12 @@
1 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 6
 class LifecycleScreen extends Component {
5 7
   constructor(props) {
6 8
     super(props);
9
+    this.onClickPush = this.onClickPush.bind(this);
7 10
     this.state = {
8 11
       text: 'nothing yet'
9 12
     };
@@ -14,16 +17,23 @@ class LifecycleScreen extends Component {
14 17
   }
15 18
 
16 19
   onStop() {
17
-    this.setState({ text: 'onStop!' });
20
+    alert('onStop!'); //eslint-disable-line
18 21
   }
19 22
 
20 23
   render() {
21 24
     return (
22 25
       <View style={styles.root}>
23 26
         <Text style={styles.h1}>{this.state.text}</Text>
27
+        <Button title="Push to test onStop" onPress={this.onClickPush} />
24 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 38
 export default LifecycleScreen;
29 39
 

+ 9
- 9
playground/src/containers/WelcomeScreen.js Voir le fichier

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

@@ -5,7 +5,7 @@ import SimpleScreen from './SimpleScreen';
5 5
 import LifecycleScreen from './LifecycleScreen';
6 6
 
7 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
 }