Daniel Zlotin 8 years ago
parent
commit
b1c32da6ec

+ 8
- 2
README.md View File

1
 # React Native Navigation
1
 # React Native Navigation
2
 
2
 
3
+[![NPM Version](https://img.shields.io/npm/v/react-native-navigation.svg?style=flat)](https://www.npmjs.com/package/react-native-navigation)
4
+[![NPM Downloads](https://img.shields.io/npm/dm/react-native-navigation.svg?style=flat)](https://www.npmjs.com/package/react-native-navigation)
5
+[![Build Status](https://travis-ci.org/wix/react-native-navigation.svg?branch=master)](https://travis-ci.org/wix/react-native-navigation)
6
+[![Join us on Discord](https://img.shields.io/badge/discord-react--native--navigation-738bd7.svg?style=flat)](https://discord.gg/DhkZjq2)
7
+
8
+
3
 App-wide support for 100% native navigation with an easy cross-platform interface. For iOS, this package is a wrapper around [react-native-controllers](https://github.com/wix/react-native-controllers), but provides a simplified more abstract API over it. This abstract API will be unified with the Android solution which is currently work in progress. It also fully supports redux if you use it.
9
 App-wide support for 100% native navigation with an easy cross-platform interface. For iOS, this package is a wrapper around [react-native-controllers](https://github.com/wix/react-native-controllers), but provides a simplified more abstract API over it. This abstract API will be unified with the Android solution which is currently work in progress. It also fully supports redux if you use it.
4
 
10
 
5
 <img src="https://github.com/wix/react-native/blob/master/assets/themes/bootstrap-3/images/demo.gif?raw=true" width="240">
11
 <img src="https://github.com/wix/react-native/blob/master/assets/themes/bootstrap-3/images/demo.gif?raw=true" width="240">
7
 ----
13
 ----
8
 
14
 
9
 > ### Important
15
 > ### Important
10
-> We are currently working hard on redesigning and refactoring this project with high quality and robustness in mind. As a result, issues and pull requests will take more time to process. 
16
+> We are currently working hard on redesigning and refactoring this project with high quality and robustness in mind. As a result, issues and pull requests will take more time to process.
11
 
17
 
12
 > To avoid any confusion and breaking existing projects, all continuous development is published under the npm tag `next`, with version `2.0.0-experimental.x`. Once stable, we will publish it as `2.0.0`. **This version supports react-native `0.37.0`**.
18
 > To avoid any confusion and breaking existing projects, all continuous development is published under the npm tag `next`, with version `2.0.0-experimental.x`. Once stable, we will publish it as `2.0.0`. **This version supports react-native `0.37.0`**.
13
 
19
 
14
-> The last stable version is `1.30.x` with npm tag `latest`. **This version supports react-native `0.25.1`**. It's installation instructions are [here](https://github.com/wix/react-native-navigation/blob/v1.x.x/README.md#installation---ios). 
20
+> The last stable version is `1.30.x` with npm tag `latest`. **This version supports react-native `0.25.1`**. It's installation instructions are [here](https://github.com/wix/react-native-navigation/blob/v1.x.x/README.md#installation---ios).
15
 
21
 
16
 >If you don't want your code to break on a daily basis and don't need the new features ASAP please use the `latest` version or just specify a specific version number.
22
 >If you don't want your code to break on a daily basis and don't need the new features ASAP please use the `latest` version or just specify a specific version number.
17
 
23
 

+ 19
- 1
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java View File

1
 package com.reactnativenavigation.controllers;
1
 package com.reactnativenavigation.controllers;
2
 
2
 
3
+import android.annotation.TargetApi;
3
 import android.content.Intent;
4
 import android.content.Intent;
5
+import android.os.Build;
4
 import android.os.Bundle;
6
 import android.os.Bundle;
7
+import android.support.annotation.Nullable;
5
 import android.support.v7.app.AppCompatActivity;
8
 import android.support.v7.app.AppCompatActivity;
6
 import android.view.KeyEvent;
9
 import android.view.KeyEvent;
7
 
10
 
8
 import com.facebook.react.bridge.Callback;
11
 import com.facebook.react.bridge.Callback;
9
 import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
12
 import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
13
+import com.facebook.react.modules.core.PermissionAwareActivity;
14
+import com.facebook.react.modules.core.PermissionListener;
10
 import com.reactnativenavigation.NavigationApplication;
15
 import com.reactnativenavigation.NavigationApplication;
11
 import com.reactnativenavigation.events.Event;
16
 import com.reactnativenavigation.events.Event;
12
 import com.reactnativenavigation.events.EventBus;
17
 import com.reactnativenavigation.events.EventBus;
27
 
32
 
28
 import java.util.List;
33
 import java.util.List;
29
 
34
 
30
-public class NavigationActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler, Subscriber {
35
+public class NavigationActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler, Subscriber, PermissionAwareActivity {
31
 
36
 
32
     /**
37
     /**
33
      * Although we start multiple activities, we make sure to pass Intent.CLEAR_TASK | Intent.NEW_TASK
38
      * Although we start multiple activities, we make sure to pass Intent.CLEAR_TASK | Intent.NEW_TASK
42
     private ActivityParams activityParams;
47
     private ActivityParams activityParams;
43
     private ModalController modalController;
48
     private ModalController modalController;
44
     private Layout layout;
49
     private Layout layout;
50
+    @Nullable private PermissionListener mPermissionListener;
45
 
51
 
46
     @Override
52
     @Override
47
     protected void onCreate(Bundle savedInstanceState) {
53
     protected void onCreate(Bundle savedInstanceState) {
312
         modalController.destroy();
318
         modalController.destroy();
313
         layout.destroy();
319
         layout.destroy();
314
     }
320
     }
321
+
322
+    @TargetApi(Build.VERSION_CODES.M)
323
+    public void requestPermissions(String[] permissions, int requestCode, PermissionListener listener) {
324
+        mPermissionListener = listener;
325
+        requestPermissions(permissions, requestCode);
326
+    }
327
+
328
+    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
329
+        if (mPermissionListener != null && mPermissionListener.onRequestPermissionsResult(requestCode, permissions, grantResults)) {
330
+            mPermissionListener = null;
331
+        }
332
+    }
315
 }
333
 }

+ 2
- 0
src/deprecated/platformSpecificDeprecated.android.js View File

202
 
202
 
203
   const newTabs = [];
203
   const newTabs = [];
204
 
204
 
205
+  params.tabs = _.cloneDeep(params.tabs);
206
+
205
   params.tabs.forEach(function(tab, idx) {
207
   params.tabs.forEach(function(tab, idx) {
206
     addNavigatorParams(tab, null, idx);
208
     addNavigatorParams(tab, null, idx);
207
     addNavigatorButtons(tab, params.drawer);
209
     addNavigatorButtons(tab, params.drawer);