Parcourir la source

merged from master

Daniel Zlotin il y a 8 ans
Parent
révision
821b798902
33 fichiers modifiés avec 736 ajouts et 126 suppressions
  1. 3
    0
      android/app/src/main/AndroidManifest.xml
  2. 13
    5
      android/app/src/main/java/com/reactnativenavigation/bridge/NavigationReactModule.java
  3. 4
    0
      android/app/src/main/java/com/reactnativenavigation/controllers/LandscapeNavigationActivity.java
  4. 6
    6
      android/app/src/main/java/com/reactnativenavigation/controllers/Modal.java
  5. 5
    4
      android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java
  6. 9
    5
      android/app/src/main/java/com/reactnativenavigation/controllers/NavigationCommandsHandler.java
  7. 12
    9
      android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java
  8. 3
    2
      android/app/src/main/java/com/reactnativenavigation/layouts/Layout.java
  9. 1
    1
      android/app/src/main/java/com/reactnativenavigation/layouts/LayoutFactory.java
  10. 4
    5
      android/app/src/main/java/com/reactnativenavigation/layouts/ModalScreenLayout.java
  11. 14
    10
      android/app/src/main/java/com/reactnativenavigation/layouts/SingleScreenLayout.java
  12. 2
    1
      android/app/src/main/java/com/reactnativenavigation/params/ActivityParams.java
  13. 3
    3
      android/app/src/main/java/com/reactnativenavigation/params/NavigationParams.java
  14. 3
    0
      android/app/src/main/java/com/reactnativenavigation/params/SideMenuParams.java
  15. 5
    1
      android/app/src/main/java/com/reactnativenavigation/params/parsers/ActivityParamsParser.java
  16. 14
    2
      android/app/src/main/java/com/reactnativenavigation/params/parsers/SideMenuParamsParser.java
  17. 52
    25
      android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java
  18. 2
    2
      android/app/src/main/java/com/reactnativenavigation/views/utils/ViewMeasurer.java
  19. 17
    0
      example/e2e/init.js
  20. 2
    0
      example/e2e/mocha.opts
  21. 9
    0
      example/e2e/sanity.test.js
  22. 228
    24
      example/ios/example.xcodeproj/project.pbxproj
  23. 7
    4
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme
  24. 115
    0
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example_Detox.xcscheme
  25. 105
    0
      example/ios/example.xcodeproj/xcshareddata/xcschemes/example_release.xcscheme
  26. 4
    1
      example/ios/example/AppDelegate.m
  27. 18
    3
      example/package.json
  28. 44
    0
      example/scripts/e2e.ios.js
  29. 4
    0
      example/scripts/postinstall.js
  30. 0
    0
      ios/ReactNativeNavigation.xcodeproj/xcshareddata/xcschemes/ReactNativeNavigation.xcscheme
  31. 3
    0
      package.json
  32. 16
    7
      src/deprecated/platformSpecificDeprecated.android.js
  33. 9
    6
      src/platformSpecific.android.js

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

@@ -6,6 +6,9 @@
6 6
         <activity
7 7
             android:name=".controllers.PortraitNavigationActivity"
8 8
             android:screenOrientation="portrait" />
9
+        <activity
10
+            android:name=".controllers.LandscapeNavigationActivity"
11
+            android:screenOrientation="landscape" />
9 12
         <activity
10 13
             android:name="com.facebook.react.devsupport.DevSettingsActivity"
11 14
             android:exported="false" />

+ 13
- 5
android/app/src/main/java/com/reactnativenavigation/bridge/NavigationReactModule.java Voir le fichier

@@ -15,6 +15,7 @@ import com.reactnativenavigation.params.parsers.ContextualMenuParamsParser;
15 15
 import com.reactnativenavigation.params.parsers.SnackbarParamsParser;
16 16
 import com.reactnativenavigation.params.parsers.TitleBarButtonParamsParser;
17 17
 import com.reactnativenavigation.params.parsers.TitleBarLeftButtonParamsParser;
18
+import com.reactnativenavigation.views.SideMenu.Side;
18 19
 
19 20
 import java.util.List;
20 21
 
@@ -45,10 +46,17 @@ public class NavigationReactModule extends ReactContextBaseJavaModule {
45 46
     @ReactMethod
46 47
     public void startApp(final ReadableMap params) {
47 48
         boolean portraitOnlyMode = false;
49
+        boolean landscapeOnlyMode = false;
50
+
48 51
         if (params.hasKey("portraitOnlyMode")) {
49 52
             portraitOnlyMode = params.getBoolean("portraitOnlyMode");
50 53
         }
51
-        NavigationCommandsHandler.startApp(BundleConverter.toBundle(params), portraitOnlyMode);
54
+
55
+        if (params.hasKey(("landscapeOnlyMode"))) {
56
+            landscapeOnlyMode = params.getBoolean("landscapeOnlyMode");
57
+        }
58
+
59
+        NavigationCommandsHandler.startApp(BundleConverter.toBundle(params), portraitOnlyMode, landscapeOnlyMode);
52 60
     }
53 61
 
54 62
     @ReactMethod
@@ -106,13 +114,13 @@ public class NavigationReactModule extends ReactContextBaseJavaModule {
106 114
     }
107 115
 
108 116
     @ReactMethod
109
-    public void toggleSideMenuVisible(boolean animated) {
110
-        NavigationCommandsHandler.toggleSideMenuVisible(animated);
117
+    public void toggleSideMenuVisible(boolean animated, String side) {
118
+        NavigationCommandsHandler.toggleSideMenuVisible(animated, Side.fromString(side));
111 119
     }
112 120
 
113 121
     @ReactMethod
114
-    public void setSideMenuVisible(boolean animated, boolean visible) {
115
-        NavigationCommandsHandler.setSideMenuVisible(animated, visible);
122
+    public void setSideMenuVisible(boolean animated, boolean visible, String side) {
123
+        NavigationCommandsHandler.setSideMenuVisible(animated, visible, Side.fromString(side));
116 124
     }
117 125
 
118 126
     @ReactMethod

+ 4
- 0
android/app/src/main/java/com/reactnativenavigation/controllers/LandscapeNavigationActivity.java Voir le fichier

@@ -0,0 +1,4 @@
1
+package com.reactnativenavigation.controllers;
2
+
3
+public class LandscapeNavigationActivity extends NavigationActivity {
4
+}

+ 6
- 6
android/app/src/main/java/com/reactnativenavigation/controllers/Modal.java Voir le fichier

@@ -29,15 +29,15 @@ public class Modal extends Dialog implements DialogInterface.OnDismissListener,
29 29
         layout.setTopBarVisible(screenInstanceId, hidden, animated);
30 30
     }
31 31
 
32
-    public void setTitleBarTitle(String screenInstanceId, String title) {
32
+    void setTitleBarTitle(String screenInstanceId, String title) {
33 33
         layout.setTitleBarTitle(screenInstanceId, title);
34 34
     }
35 35
 
36
-    public void setTitleBarSubtitle(String screenInstanceId, String subtitle) {
36
+    void setTitleBarSubtitle(String screenInstanceId, String subtitle) {
37 37
         layout.setTitleBarSubtitle(screenInstanceId, subtitle);
38 38
     }
39 39
 
40
-    public void setTitleBarRightButtons(String screenInstanceId, String navigatorEventId, List<TitleBarButtonParams> titleBarButtons) {
40
+    void setTitleBarRightButtons(String screenInstanceId, String navigatorEventId, List<TitleBarButtonParams> titleBarButtons) {
41 41
         layout.setTitleBarRightButtons(screenInstanceId, navigatorEventId, titleBarButtons);
42 42
     }
43 43
 
@@ -64,7 +64,7 @@ public class Modal extends Dialog implements DialogInterface.OnDismissListener,
64 64
     public void onSideMenuButtonClick() {
65 65
     }
66 66
 
67
-    public interface OnModalDismissedListener {
67
+    interface OnModalDismissedListener {
68 68
         void onModalDismissed(Modal modal);
69 69
     }
70 70
 
@@ -84,7 +84,7 @@ public class Modal extends Dialog implements DialogInterface.OnDismissListener,
84 84
         setCancelable(true);
85 85
         setOnDismissListener(this);
86 86
         requestWindowFeature(Window.FEATURE_NO_TITLE);
87
-        layout = new ModalScreenLayout(getActivity(), null, screenParams, this);
87
+        layout = new ModalScreenLayout(getActivity(), screenParams, this);
88 88
         getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
89 89
         setContentView(layout.asView());
90 90
     }
@@ -131,7 +131,7 @@ public class Modal extends Dialog implements DialogInterface.OnDismissListener,
131 131
         onModalDismissedListener.onModalDismissed(this);
132 132
     }
133 133
 
134
-    public void onModalDismissed() {
134
+    void onModalDismissed() {
135 135
         layout.onModalDismissed();
136 136
     }
137 137
 }

+ 5
- 4
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationActivity.java Voir le fichier

@@ -29,6 +29,7 @@ import com.reactnativenavigation.params.SnackbarParams;
29 29
 import com.reactnativenavigation.params.TitleBarButtonParams;
30 30
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
31 31
 import com.reactnativenavigation.react.JsDevReloadHandler;
32
+import com.reactnativenavigation.views.SideMenu.Side;
32 33
 
33 34
 import java.util.List;
34 35
 
@@ -253,12 +254,12 @@ public class NavigationActivity extends AppCompatActivity implements DefaultHard
253 254
         modalController.setTitleBarLeftButton(screenInstanceId, navigatorEventId, titleBarLeftButton);
254 255
     }
255 256
 
256
-    public void toggleSideMenuVisible(boolean animated) {
257
-        layout.toggleSideMenuVisible(animated);
257
+    public void toggleSideMenuVisible(boolean animated, Side side) {
258
+        layout.toggleSideMenuVisible(animated, side);
258 259
     }
259 260
 
260
-    public void setSideMenuVisible(boolean animated, boolean visible) {
261
-        layout.setSideMenuVisible(animated, visible);
261
+    public void setSideMenuVisible(boolean animated, boolean visible, Side side) {
262
+        layout.setSideMenuVisible(animated, visible, side);
262 263
     }
263 264
 
264 265
     public void selectBottomTabByTabIndex(Integer index) {

+ 9
- 5
android/app/src/main/java/com/reactnativenavigation/controllers/NavigationCommandsHandler.java Voir le fichier

@@ -13,6 +13,7 @@ import com.reactnativenavigation.params.TitleBarButtonParams;
13 13
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
14 14
 import com.reactnativenavigation.params.parsers.ActivityParamsParser;
15 15
 import com.reactnativenavigation.params.parsers.ScreenParamsParser;
16
+import com.reactnativenavigation.views.SideMenu.Side;
16 17
 
17 18
 import java.util.List;
18 19
 
@@ -29,10 +30,13 @@ public class NavigationCommandsHandler {
29 30
      *
30 31
      * @param params ActivityParams as bundle
31 32
      */
32
-    public static void startApp(Bundle params, boolean portraitOnlyMode) {
33
+
34
+    public static void startApp(Bundle params, boolean portraitOnlyMode, boolean landscapeOnlyMode) {
33 35
         Intent intent;
34 36
         if (portraitOnlyMode) {
35 37
             intent = new Intent(NavigationApplication.instance, PortraitNavigationActivity.class);
38
+        } else if (landscapeOnlyMode) {
39
+            intent = new Intent(NavigationApplication.instance, LandscapeNavigationActivity.class);
36 40
         } else {
37 41
             intent = new Intent(NavigationApplication.instance, NavigationActivity.class);
38 42
         }
@@ -234,7 +238,7 @@ public class NavigationCommandsHandler {
234 238
         });
235 239
     }
236 240
 
237
-    public static void toggleSideMenuVisible(final boolean animated) {
241
+    public static void toggleSideMenuVisible(final boolean animated, final Side side) {
238 242
         final NavigationActivity currentActivity = NavigationActivity.currentActivity;
239 243
         if (currentActivity == null) {
240 244
             return;
@@ -243,12 +247,12 @@ public class NavigationCommandsHandler {
243 247
         NavigationApplication.instance.runOnMainThread(new Runnable() {
244 248
             @Override
245 249
             public void run() {
246
-                currentActivity.toggleSideMenuVisible(animated);
250
+                currentActivity.toggleSideMenuVisible(animated, side);
247 251
             }
248 252
         });
249 253
     }
250 254
 
251
-    public static void setSideMenuVisible(final boolean animated, final boolean visible) {
255
+    public static void setSideMenuVisible(final boolean animated, final boolean visible, final Side side) {
252 256
         final NavigationActivity currentActivity = NavigationActivity.currentActivity;
253 257
         if (currentActivity == null) {
254 258
             return;
@@ -257,7 +261,7 @@ public class NavigationCommandsHandler {
257 261
         NavigationApplication.instance.runOnMainThread(new Runnable() {
258 262
             @Override
259 263
             public void run() {
260
-                currentActivity.setSideMenuVisible(animated, visible);
264
+                currentActivity.setSideMenuVisible(animated, visible, side);
261 265
             }
262 266
         });
263 267
     }

+ 12
- 9
android/app/src/main/java/com/reactnativenavigation/layouts/BottomTabsLayout.java Voir le fichier

@@ -21,6 +21,7 @@ import com.reactnativenavigation.params.TitleBarLeftButtonParams;
21 21
 import com.reactnativenavigation.screens.ScreenStack;
22 22
 import com.reactnativenavigation.views.BottomTabs;
23 23
 import com.reactnativenavigation.views.SideMenu;
24
+import com.reactnativenavigation.views.SideMenu.Side;
24 25
 import com.reactnativenavigation.views.SnackbarAndFabContainer;
25 26
 
26 27
 import java.util.List;
@@ -35,7 +36,8 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
35 36
     private SnackbarAndFabContainer snackbarAndFabContainer;
36 37
     private BottomTabs bottomTabs;
37 38
     private ScreenStack[] screenStacks;
38
-    private final SideMenuParams sideMenuParams;
39
+    private final SideMenuParams leftSideMenuParams;
40
+    private final SideMenuParams rightSideMenuParams;
39 41
     private @Nullable SideMenu sideMenu;
40 42
     private int currentStackIndex = 0;
41 43
 
@@ -43,7 +45,8 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
43 45
         super(activity);
44 46
         this.activity = activity;
45 47
         this.params = params;
46
-        this.sideMenuParams = params.sideMenuParams;
48
+        leftSideMenuParams = params.leftSideMenuParams;
49
+        rightSideMenuParams = params.rightSideMenuParams;
47 50
         screenStacks = new ScreenStack[params.tabParams.size()];
48 51
         createLayout();
49 52
     }
@@ -58,10 +61,10 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
58 61
     }
59 62
 
60 63
     private void createSideMenu() {
61
-        if (sideMenuParams == null) {
64
+        if (leftSideMenuParams == null && rightSideMenuParams == null) {
62 65
             return;
63 66
         }
64
-        sideMenu = new SideMenu(getContext(), sideMenuParams);
67
+        sideMenu = new SideMenu(getContext(), leftSideMenuParams, rightSideMenuParams);
65 68
         RelativeLayout.LayoutParams lp = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
66 69
         addView(sideMenu, lp);
67 70
     }
@@ -176,16 +179,16 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
176 179
     }
177 180
 
178 181
     @Override
179
-    public void toggleSideMenuVisible(boolean animated) {
182
+    public void toggleSideMenuVisible(boolean animated, Side side) {
180 183
         if (sideMenu != null) {
181
-            sideMenu.toggleVisible(animated);
184
+            sideMenu.toggleVisible(animated, side);
182 185
         }
183 186
     }
184 187
 
185 188
     @Override
186
-    public void setSideMenuVisible(boolean animated, boolean visible) {
189
+    public void setSideMenuVisible(boolean animated, boolean visible, Side side) {
187 190
         if (sideMenu != null) {
188
-            sideMenu.setVisible(visible, animated);
191
+            sideMenu.setVisible(visible, animated, side);
189 192
         }
190 193
     }
191 194
 
@@ -363,7 +366,7 @@ public class BottomTabsLayout extends RelativeLayout implements Layout, AHBottom
363 366
     @Override
364 367
     public void onSideMenuButtonClick() {
365 368
         if (sideMenu != null) {
366
-            sideMenu.openDrawer();
369
+            sideMenu.openDrawer(Side.Left);
367 370
         } else {
368 371
             final String navigatorEventId = getCurrentScreenStack().peek().getNavigatorEventId();
369 372
             NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);

+ 3
- 2
android/app/src/main/java/com/reactnativenavigation/layouts/Layout.java Voir le fichier

@@ -7,6 +7,7 @@ import com.reactnativenavigation.params.ContextualMenuParams;
7 7
 import com.reactnativenavigation.params.SnackbarParams;
8 8
 import com.reactnativenavigation.params.TitleBarButtonParams;
9 9
 import com.reactnativenavigation.params.TitleBarLeftButtonParams;
10
+import com.reactnativenavigation.views.SideMenu.Side;
10 11
 
11 12
 import java.util.List;
12 13
 
@@ -25,9 +26,9 @@ public interface Layout extends ScreenStackContainer {
25 26
 
26 27
     void setTitleBarLeftButton(String screenInstanceId, String navigatorEventId, TitleBarLeftButtonParams titleBarLeftButtonParams);
27 28
 
28
-    void toggleSideMenuVisible(boolean animated);
29
+    void toggleSideMenuVisible(boolean animated, Side side);
29 30
 
30
-    void setSideMenuVisible(boolean animated, boolean visible);
31
+    void setSideMenuVisible(boolean animated, boolean visible, Side side);
31 32
 
32 33
     void showSnackbar(SnackbarParams params);
33 34
 

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/layouts/LayoutFactory.java Voir le fichier

@@ -17,7 +17,7 @@ public class LayoutFactory {
17 17
     }
18 18
 
19 19
     private static Layout createSingleScreenLayout(AppCompatActivity activity, ActivityParams params) {
20
-        return new SingleScreenLayout(activity, params.sideMenuParams, params.screenParams);
20
+        return new SingleScreenLayout(activity, params.leftSideMenuParams, params.rightSideMenuParams, params.screenParams);
21 21
     }
22 22
 
23 23
     private static Layout createBottomTabsScreenLayout(AppCompatActivity activity, ActivityParams params) {

+ 4
- 5
android/app/src/main/java/com/reactnativenavigation/layouts/ModalScreenLayout.java Voir le fichier

@@ -1,17 +1,16 @@
1 1
 package com.reactnativenavigation.layouts;
2 2
 
3
-import android.support.annotation.Nullable;
4 3
 import android.support.v7.app.AppCompatActivity;
5 4
 
6 5
 import com.reactnativenavigation.params.ScreenParams;
7
-import com.reactnativenavigation.params.SideMenuParams;
8 6
 import com.reactnativenavigation.views.LeftButtonOnClickListener;
9 7
 
10 8
 public class ModalScreenLayout extends SingleScreenLayout {
11 9
 
12
-    public ModalScreenLayout(AppCompatActivity activity, @Nullable SideMenuParams sideMenuParams,
13
-                             ScreenParams screenParams, LeftButtonOnClickListener leftButtonOnClickListener) {
14
-        super(activity, sideMenuParams, screenParams);
10
+    public ModalScreenLayout(AppCompatActivity activity,
11
+                             ScreenParams screenParams,
12
+                             LeftButtonOnClickListener leftButtonOnClickListener) {
13
+        super(activity, null, null, screenParams);
15 14
         this.leftButtonOnClickListener = leftButtonOnClickListener;
16 15
     }
17 16
 

+ 14
- 10
android/app/src/main/java/com/reactnativenavigation/layouts/SingleScreenLayout.java Voir le fichier

@@ -18,6 +18,7 @@ import com.reactnativenavigation.params.TitleBarLeftButtonParams;
18 18
 import com.reactnativenavigation.screens.ScreenStack;
19 19
 import com.reactnativenavigation.views.LeftButtonOnClickListener;
20 20
 import com.reactnativenavigation.views.SideMenu;
21
+import com.reactnativenavigation.views.SideMenu.Side;
21 22
 import com.reactnativenavigation.views.SnackbarAndFabContainer;
22 23
 
23 24
 import java.util.List;
@@ -28,22 +29,25 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
28 29
 
29 30
     private final AppCompatActivity activity;
30 31
     protected final ScreenParams screenParams;
31
-    private final SideMenuParams sideMenuParams;
32
+    private final SideMenuParams leftSideMenuParams;
33
+    private final SideMenuParams rightSideMenuParams;
32 34
     protected ScreenStack stack;
33 35
     private SnackbarAndFabContainer snackbarAndFabContainer;
34 36
     protected LeftButtonOnClickListener leftButtonOnClickListener;
35 37
     private @Nullable SideMenu sideMenu;
36 38
 
37
-    public SingleScreenLayout(AppCompatActivity activity, @Nullable SideMenuParams sideMenuParams, ScreenParams screenParams) {
39
+    public SingleScreenLayout(AppCompatActivity activity, SideMenuParams leftSideMenuParams,
40
+                              SideMenuParams rightSideMenuParams, ScreenParams screenParams) {
38 41
         super(activity);
39 42
         this.activity = activity;
40 43
         this.screenParams = screenParams;
41
-        this.sideMenuParams = sideMenuParams;
44
+        this.leftSideMenuParams = leftSideMenuParams;
45
+        this.rightSideMenuParams = rightSideMenuParams;
42 46
         createLayout();
43 47
     }
44 48
 
45 49
     private void createLayout() {
46
-        if (sideMenuParams == null) {
50
+        if (leftSideMenuParams == null) {
47 51
             createStack(getScreenStackParent());
48 52
         } else {
49 53
             sideMenu = createSideMenu();
@@ -58,7 +62,7 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
58 62
     }
59 63
 
60 64
     private SideMenu createSideMenu() {
61
-        SideMenu sideMenu = new SideMenu(getContext(), sideMenuParams);
65
+        SideMenu sideMenu = new SideMenu(getContext(), leftSideMenuParams, rightSideMenuParams);
62 66
         RelativeLayout.LayoutParams lp = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
63 67
         addView(sideMenu, lp);
64 68
         return sideMenu;
@@ -182,16 +186,16 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
182 186
     }
183 187
 
184 188
     @Override
185
-    public void toggleSideMenuVisible(boolean animated) {
189
+    public void toggleSideMenuVisible(boolean animated, Side side) {
186 190
         if (sideMenu != null) {
187
-            sideMenu.toggleVisible(animated);
191
+            sideMenu.toggleVisible(animated, side);
188 192
         }
189 193
     }
190 194
 
191 195
     @Override
192
-    public void setSideMenuVisible(boolean animated, boolean visible) {
196
+    public void setSideMenuVisible(boolean animated, boolean visible, Side side) {
193 197
         if (sideMenu != null) {
194
-            sideMenu.setVisible(visible, animated);
198
+            sideMenu.setVisible(visible, animated, side);
195 199
         }
196 200
     }
197 201
 
@@ -233,7 +237,7 @@ public class SingleScreenLayout extends RelativeLayout implements Layout {
233 237
     @Override
234 238
     public void onSideMenuButtonClick() {
235 239
         if (sideMenu != null) {
236
-            sideMenu.openDrawer();
240
+            sideMenu.openDrawer(Side.Left);
237 241
         } else {
238 242
             final String navigatorEventId = stack.peek().getNavigatorEventId();
239 243
             NavigationApplication.instance.getEventEmitter().sendNavigatorEvent("sideMenu", navigatorEventId);

+ 2
- 1
android/app/src/main/java/com/reactnativenavigation/params/ActivityParams.java Voir le fichier

@@ -10,6 +10,7 @@ public class ActivityParams {
10 10
     public Type type;
11 11
     public ScreenParams screenParams;
12 12
     public List<ScreenParams> tabParams;
13
-    public SideMenuParams sideMenuParams;
13
+    public SideMenuParams leftSideMenuParams;
14
+    public SideMenuParams rightSideMenuParams;
14 15
     public boolean animateShow;
15 16
 }

+ 3
- 3
android/app/src/main/java/com/reactnativenavigation/params/NavigationParams.java Voir le fichier

@@ -3,9 +3,9 @@ package com.reactnativenavigation.params;
3 3
 import android.os.Bundle;
4 4
 
5 5
 public class NavigationParams {
6
-    public static final String SCREEN_INSTANCE_ID = "screenInstanceID";
7
-    public static final String NAVIGATOR_ID = "navigatorID";
8
-    public static final String NAVIGATOR_EVENT_ID = "navigatorEventID";
6
+    private static final String SCREEN_INSTANCE_ID = "screenInstanceID";
7
+    private static final String NAVIGATOR_ID = "navigatorID";
8
+    private static final String NAVIGATOR_EVENT_ID = "navigatorEventID";
9 9
 
10 10
     public String screenInstanceId;
11 11
     public String navigatorId;

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/params/SideMenuParams.java Voir le fichier

@@ -1,7 +1,10 @@
1 1
 package com.reactnativenavigation.params;
2 2
 
3
+import com.reactnativenavigation.views.SideMenu;
4
+
3 5
 public class SideMenuParams {
4 6
     public String screenId;
5 7
     public NavigationParams navigationParams;
6 8
     public boolean disableOpenGesture;
9
+    public SideMenu.Side side;
7 10
 }

+ 5
- 1
android/app/src/main/java/com/reactnativenavigation/params/parsers/ActivityParamsParser.java Voir le fichier

@@ -4,6 +4,8 @@ import android.os.Bundle;
4 4
 
5 5
 import com.reactnativenavigation.params.ActivityParams;
6 6
 import com.reactnativenavigation.params.AppStyle;
7
+import com.reactnativenavigation.params.SideMenuParams;
8
+import com.reactnativenavigation.views.SideMenu;
7 9
 
8 10
 public class ActivityParamsParser extends Parser {
9 11
     public static ActivityParams parse(Bundle params) {
@@ -22,7 +24,9 @@ public class ActivityParamsParser extends Parser {
22 24
         }
23 25
 
24 26
         if (hasKey(params, "sideMenu")) {
25
-            result.sideMenuParams = SideMenuParamsParser.parse(params.getBundle("sideMenu"));
27
+            SideMenuParams[] sideMenus = SideMenuParamsParser.parse(params.getBundle("sideMenu"));
28
+            result.leftSideMenuParams = sideMenus[SideMenu.Side.Left.ordinal()];
29
+            result.rightSideMenuParams = sideMenus[SideMenu.Side.Right.ordinal()];
26 30
         }
27 31
 
28 32
         result.animateShow = params.getBoolean("animateShow", true);

+ 14
- 2
android/app/src/main/java/com/reactnativenavigation/params/parsers/SideMenuParamsParser.java Voir le fichier

@@ -1,17 +1,29 @@
1 1
 package com.reactnativenavigation.params.parsers;
2 2
 
3 3
 import android.os.Bundle;
4
+import android.support.annotation.Nullable;
4 5
 
5 6
 import com.reactnativenavigation.params.NavigationParams;
6 7
 import com.reactnativenavigation.params.SideMenuParams;
8
+import com.reactnativenavigation.views.SideMenu.Side;
7 9
 
8
-public class SideMenuParamsParser extends Parser {
10
+class SideMenuParamsParser extends Parser {
11
+    public static SideMenuParams[] parse(Bundle sideMenues) {
12
+        SideMenuParams[] result = new SideMenuParams[2];
13
+        result[Side.Left.ordinal()] = parseSideMenu(sideMenues.getBundle("left"), Side.Left);
14
+        result[Side.Right.ordinal()] = parseSideMenu(sideMenues.getBundle("right"), Side.Right);
15
+        return result;
16
+    }
9 17
 
10
-    public static SideMenuParams parse(Bundle sideMenu) {
18
+    private static SideMenuParams parseSideMenu(@Nullable Bundle sideMenu, Side side) {
19
+        if (sideMenu == null || sideMenu.isEmpty()) {
20
+            return null;
21
+        }
11 22
         SideMenuParams result = new SideMenuParams();
12 23
         result.screenId = sideMenu.getString("screenId");
13 24
         result.navigationParams = new NavigationParams(sideMenu.getBundle("navigationParams"));
14 25
         result.disableOpenGesture = sideMenu.getBoolean("disableOpenGesture", false);
26
+        result.side = side;
15 27
         return result;
16 28
     }
17 29
 }

+ 52
- 25
android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java Voir le fichier

@@ -1,7 +1,7 @@
1 1
 package com.reactnativenavigation.views;
2 2
 
3 3
 import android.content.Context;
4
-import android.support.v4.view.GravityCompat;
4
+import android.support.annotation.Nullable;
5 5
 import android.support.v4.widget.DrawerLayout;
6 6
 import android.view.Gravity;
7 7
 import android.view.ViewGroup;
@@ -12,8 +12,22 @@ import com.reactnativenavigation.screens.Screen;
12 12
 import com.reactnativenavigation.utils.ViewUtils;
13 13
 
14 14
 public class SideMenu extends DrawerLayout {
15
+    public enum Side {
16
+        Left(Gravity.LEFT), Right(Gravity.RIGHT);
15 17
 
16
-    private ContentView sideMenuView;
18
+        int gravity;
19
+
20
+        Side(int gravity) {
21
+            this.gravity = gravity;
22
+        }
23
+
24
+        public static Side fromString(String side) {
25
+            return "left".equals(side.toLowerCase()) ? Left : Right;
26
+        }
27
+    }
28
+
29
+    private ContentView leftSideMenuView;
30
+    private ContentView rightSideMenuView;
17 31
     private RelativeLayout contentContainer;
18 32
 
19 33
     public RelativeLayout getContentContainer() {
@@ -21,45 +35,54 @@ public class SideMenu extends DrawerLayout {
21 35
     }
22 36
 
23 37
     public void destroy() {
38
+        destroySideMenu(leftSideMenuView);
39
+        destroySideMenu(rightSideMenuView);
40
+    }
41
+
42
+    private void destroySideMenu(ContentView sideMenuView) {
43
+        if (sideMenuView == null) {
44
+            return;
45
+        }
24 46
         sideMenuView.unmountReactView();
25 47
         removeView(sideMenuView);
26 48
     }
27 49
 
28
-    public void setVisible(boolean visible, boolean animated) {
50
+    public void setVisible(boolean visible, boolean animated, Side side) {
29 51
         if (!isShown() && visible) {
30
-            openDrawer(animated);
52
+            openDrawer(animated, side);
31 53
         }
32 54
 
33 55
         if (isShown() && !visible) {
34
-            closeDrawer(animated);
56
+            closeDrawer(animated, side);
35 57
         }
36 58
     }
37 59
 
38
-    public void openDrawer() {
39
-        openDrawer(Gravity.LEFT);
40
-    }
41
-
42
-    public void openDrawer(boolean animated) {
43
-        openDrawer(Gravity.LEFT, animated);
60
+    public void openDrawer(Side side) {
61
+        openDrawer(side.gravity);
44 62
     }
45 63
 
46
-    public void closeDrawer(boolean animated) {
47
-        closeDrawer(Gravity.LEFT, animated);
64
+    public void openDrawer(boolean animated, Side side) {
65
+        openDrawer(side.gravity, animated);
48 66
     }
49 67
 
50
-    public void toggleVisible(boolean animated) {
51
-        if (isDrawerOpen(GravityCompat.START)) {
52
-            closeDrawer(animated);
68
+    public void toggleVisible(boolean animated, Side side) {
69
+        if (isDrawerOpen(side.gravity)) {
70
+            closeDrawer(animated, side);
53 71
         } else {
54
-            openDrawer(animated);
72
+            openDrawer(animated, side);
55 73
         }
56 74
     }
57 75
 
58
-    public SideMenu(Context context, SideMenuParams sideMenuParams) {
76
+    public void closeDrawer(boolean animated, Side side) {
77
+        closeDrawer(side.gravity, animated);
78
+    }
79
+
80
+    public SideMenu(Context context, SideMenuParams leftMenuParams, SideMenuParams rightMenuParams) {
59 81
         super(context);
60 82
         createContentContainer();
61
-        createSideMenu(sideMenuParams);
62
-        setStyle(sideMenuParams);
83
+        leftSideMenuView = createSideMenu(leftMenuParams);
84
+        rightSideMenuView = createSideMenu(rightMenuParams);
85
+        setStyle(leftMenuParams);
63 86
     }
64 87
 
65 88
     private void createContentContainer() {
@@ -69,15 +92,19 @@ public class SideMenu extends DrawerLayout {
69 92
         addView(contentContainer, lp);
70 93
     }
71 94
 
72
-    private void createSideMenu(SideMenuParams sideMenuParams) {
73
-        sideMenuView = new ContentView(getContext(), sideMenuParams.screenId, sideMenuParams.navigationParams);
95
+    private ContentView createSideMenu(@Nullable SideMenuParams params) {
96
+        if (params == null) {
97
+            return null;
98
+        }
99
+        ContentView sideMenuView = new ContentView(getContext(), params.screenId, params.navigationParams);
74 100
         LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
75
-        lp.gravity = Gravity.START;
76
-        setSideMenuWidth();
101
+        lp.gravity = params.side.gravity;
102
+        setSideMenuWidth(sideMenuView);
77 103
         addView(sideMenuView, lp);
104
+        return sideMenuView;
78 105
     }
79 106
 
80
-    private void setSideMenuWidth() {
107
+    private void setSideMenuWidth(final ContentView sideMenuView) {
81 108
         sideMenuView.setOnDisplayListener(new Screen.OnDisplayListener() {
82 109
             @Override
83 110
             public void onDisplay() {

+ 2
- 2
android/app/src/main/java/com/reactnativenavigation/views/utils/ViewMeasurer.java Voir le fichier

@@ -4,8 +4,8 @@ import static android.view.View.MeasureSpec;
4 4
 
5 5
 public class ViewMeasurer {
6 6
 
7
-    public int getMeasuredHeight(int heightMeasuerSpec) {
8
-        return MeasureSpec.getSize(heightMeasuerSpec);
7
+    public int getMeasuredHeight(int heightMeasureSpec) {
8
+        return MeasureSpec.getSize(heightMeasureSpec);
9 9
     }
10 10
 
11 11
     public int getMeasuredWidth(int widthMeasureSpec) {

+ 17
- 0
example/e2e/init.js Voir le fichier

@@ -0,0 +1,17 @@
1
+/*eslint-disable*/
2
+const detox = require('detox');
3
+const config = require('../package.json').detox;
4
+
5
+before(function(done) {
6
+  this.timeout(120000);
7
+  detox.config(config);
8
+  detox.start(done);
9
+});
10
+
11
+afterEach(function(done) {
12
+  detox.waitForTestResult(done);
13
+});
14
+
15
+after(function(done) {
16
+  detox.cleanup(done);
17
+});

+ 2
- 0
example/e2e/mocha.opts Voir le fichier

@@ -0,0 +1,2 @@
1
+--recursive
2
+--timeout 120000

+ 9
- 0
example/e2e/sanity.test.js Voir le fichier

@@ -0,0 +1,9 @@
1
+describe('sanity', function() {
2
+  beforeEach(function(done) {
3
+    global.simulator.reloadReactNativeApp(done);
4
+  });
5
+
6
+  it('should have screen one showing', function() {
7
+    expect(element(by.label('Screen One'))).toBeVisible();
8
+  });
9
+});

+ 228
- 24
example/ios/example.xcodeproj/project.pbxproj Voir le fichier

@@ -7,23 +7,23 @@
7 7
 	objects = {
8 8
 
9 9
 /* Begin PBXBuildFile section */
10
-		00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11
-		00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
12
-		00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
13
-		00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
14
-		00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
10
+		00C302E51ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11
+		00C302E71ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
12
+		00C302E81ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
13
+		00C302E91ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
14
+		00C302EA1ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
15 15
 		00E356F31AD99517003FC87E /* exampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* exampleTests.m */; };
16
-		133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
17
-		139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
18
-		139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
16
+		133E29F31AD74F7200F7D852 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
17
+		139105C61AF99C1200B5F7CC /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
18
+		139FDEF61B0652A700C62182 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
19 19
 		13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
20 20
 		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
21 21
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
22 22
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
23
-		146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24
-		2647D65F1DB175C200B23722 /* libReactNativeNavigation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2647D65E1DB175B300B23722 /* libReactNativeNavigation.a */; };
25
-		7B9B39861DEB4091004A6281 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B9B39631DEB4076004A6281 /* libRCTAnimation.a */; };
26
-		832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
23
+		146834051AC3E58100842450 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24
+		2647D65F1DB175C200B23722 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 2647D65E1DB175B300B23722 /* libReactNativeNavigation.a */; };
25
+		7B9B39861DEB4091004A6281 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B9B39631DEB4076004A6281 /* libRCTAnimation.a */; };
26
+		832341BD1AAA6AB300B99B32 /* ReferenceProxy in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
27 27
 /* End PBXBuildFile section */
28 28
 
29 29
 /* Begin PBXContainerItemProxy section */
@@ -214,18 +214,18 @@
214 214
 			isa = PBXFrameworksBuildPhase;
215 215
 			buildActionMask = 2147483647;
216 216
 			files = (
217
-				7B9B39861DEB4091004A6281 /* libRCTAnimation.a in Frameworks */,
218
-				2647D65F1DB175C200B23722 /* libReactNativeNavigation.a in Frameworks */,
219
-				146834051AC3E58100842450 /* libReact.a in Frameworks */,
220
-				00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
221
-				00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
222
-				00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
223
-				133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
224
-				00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
225
-				139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
226
-				832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
227
-				00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
228
-				139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
217
+				7B9B39861DEB4091004A6281 /* ReferenceProxy in Frameworks */,
218
+				2647D65F1DB175C200B23722 /* ReferenceProxy in Frameworks */,
219
+				146834051AC3E58100842450 /* ReferenceProxy in Frameworks */,
220
+				00C302E51ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
221
+				00C302E71ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
222
+				00C302E81ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
223
+				133E29F31AD74F7200F7D852 /* ReferenceProxy in Frameworks */,
224
+				00C302E91ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
225
+				139105C61AF99C1200B5F7CC /* ReferenceProxy in Frameworks */,
226
+				832341BD1AAA6AB300B99B32 /* ReferenceProxy in Frameworks */,
227
+				00C302EA1ABCBA2D00DB3ED1 /* ReferenceProxy in Frameworks */,
228
+				139FDEF61B0652A700C62182 /* ReferenceProxy in Frameworks */,
229 229
 			);
230 230
 			runOnlyForDeploymentPostprocessing = 0;
231 231
 		};
@@ -436,6 +436,7 @@
436 436
 				13B07F8C1A680F5B00A75B9A /* Frameworks */,
437 437
 				13B07F8E1A680F5B00A75B9A /* Resources */,
438 438
 				00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
439
+				6956ED03EAA1831C238A5BB4 /* Copy Detox Framework */,
439 440
 			);
440 441
 			buildRules = (
441 442
 			);
@@ -707,6 +708,21 @@
707 708
 			shellPath = /bin/sh;
708 709
 			shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
709 710
 		};
711
+		6956ED03EAA1831C238A5BB4 /* Copy Detox Framework */ = {
712
+			isa = PBXShellScriptBuildPhase;
713
+			buildActionMask = 2147483647;
714
+			files = (
715
+			);
716
+			inputPaths = (
717
+			);
718
+			name = "Copy Detox Framework";
719
+			outputPaths = (
720
+			);
721
+			runOnlyForDeploymentPostprocessing = 0;
722
+			shellPath = /bin/bash;
723
+			shellScript = "if [ -n \"$DEPLOY_DETOX_FRAMEWORK\" ]; then\nmkdir -p \"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\ncp -r \"${PROJECT_DIR}\"/../node_modules/detox/Detox.framework \"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\nfi";
724
+			showEnvVarsInLog = 1;
725
+		};
710 726
 /* End PBXShellScriptBuildPhase section */
711 727
 
712 728
 /* Begin PBXSourcesBuildPhase section */
@@ -830,6 +846,73 @@
830 846
 			};
831 847
 			name = Release;
832 848
 		};
849
+		2C24A1398D388E120DDC2CA1 /* Debug_Detox */ = {
850
+			isa = XCBuildConfiguration;
851
+			buildSettings = {
852
+				ALWAYS_SEARCH_USER_PATHS = NO;
853
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
854
+				CLANG_CXX_LIBRARY = "libc++";
855
+				CLANG_ENABLE_MODULES = YES;
856
+				CLANG_ENABLE_OBJC_ARC = YES;
857
+				CLANG_WARN_BOOL_CONVERSION = YES;
858
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
859
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
860
+				CLANG_WARN_EMPTY_BODY = YES;
861
+				CLANG_WARN_ENUM_CONVERSION = YES;
862
+				CLANG_WARN_INT_CONVERSION = YES;
863
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
864
+				CLANG_WARN_UNREACHABLE_CODE = YES;
865
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
866
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
867
+				COPY_PHASE_STRIP = NO;
868
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
869
+				GCC_C_LANGUAGE_STANDARD = gnu99;
870
+				GCC_DYNAMIC_NO_PIC = NO;
871
+				GCC_OPTIMIZATION_LEVEL = 0;
872
+				GCC_PREPROCESSOR_DEFINITIONS = (
873
+					"DEBUG=1",
874
+					"$(inherited)",
875
+				);
876
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
877
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
878
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
879
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
880
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
881
+				GCC_WARN_UNUSED_FUNCTION = YES;
882
+				GCC_WARN_UNUSED_VARIABLE = YES;
883
+				HEADER_SEARCH_PATHS = (
884
+					"$(inherited)",
885
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
886
+					"$(SRCROOT)/../node_modules/react-native/React/**",
887
+				);
888
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
889
+				MTL_ENABLE_DEBUG_INFO = YES;
890
+				ONLY_ACTIVE_ARCH = YES;
891
+				OTHER_LDFLAGS = "";
892
+				SDKROOT = iphoneos;
893
+			};
894
+			name = Debug_Detox;
895
+		};
896
+		5627D4C51CEC610E1744267F /* Debug_Detox */ = {
897
+			isa = XCBuildConfiguration;
898
+			buildSettings = {
899
+				BUNDLE_LOADER = "$(TEST_HOST)";
900
+				FRAMEWORK_SEARCH_PATHS = (
901
+					"$(SDKROOT)/Developer/Library/Frameworks",
902
+					"$(inherited)",
903
+				);
904
+				GCC_PREPROCESSOR_DEFINITIONS = (
905
+					"DEBUG=1",
906
+					"$(inherited)",
907
+				);
908
+				INFOPLIST_FILE = exampleTests/Info.plist;
909
+				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
910
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
911
+				PRODUCT_NAME = "$(TARGET_NAME)";
912
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example";
913
+			};
914
+			name = Debug_Detox;
915
+		};
833 916
 		83CBBA201A601CBA00E9B192 /* Debug */ = {
834 917
 			isa = XCBuildConfiguration;
835 918
 			buildSettings = {
@@ -918,6 +1001,121 @@
918 1001
 			};
919 1002
 			name = Release;
920 1003
 		};
1004
+		96FA810D67E56FD9D43906E6 /* Release_Detox */ = {
1005
+			isa = XCBuildConfiguration;
1006
+			buildSettings = {
1007
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1008
+				DEPLOY_DETOX_FRAMEWORK = YES;
1009
+				FRAMEWORK_SEARCH_PATHS = (
1010
+					"$(inherited)",
1011
+					"$(PROJECT_DIR)/../node_modules/detox",
1012
+				);
1013
+				HEADER_SEARCH_PATHS = (
1014
+					"$(inherited)",
1015
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
1016
+					"$(SRCROOT)/../node_modules/react-native/React/**",
1017
+					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
1018
+				);
1019
+				INFOPLIST_FILE = example/Info.plist;
1020
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1021
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1022
+				OTHER_LDFLAGS = (
1023
+					"-ObjC",
1024
+					"-l\"c++\"",
1025
+					"-framework",
1026
+					Detox,
1027
+				);
1028
+				PRODUCT_NAME = example;
1029
+			};
1030
+			name = Release_Detox;
1031
+		};
1032
+		BEB8EFA9FD7A9DCE32773C1C /* Debug_Detox */ = {
1033
+			isa = XCBuildConfiguration;
1034
+			buildSettings = {
1035
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1036
+				DEAD_CODE_STRIPPING = NO;
1037
+				DEPLOY_DETOX_FRAMEWORK = YES;
1038
+				FRAMEWORK_SEARCH_PATHS = (
1039
+					"$(inherited)",
1040
+					"$(PROJECT_DIR)/../node_modules/detox",
1041
+				);
1042
+				HEADER_SEARCH_PATHS = (
1043
+					"$(inherited)",
1044
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
1045
+					"$(SRCROOT)/../node_modules/react-native/React/**",
1046
+					"$(SRCROOT)/../node_modules/react-native-navigation/ios/**",
1047
+				);
1048
+				INFOPLIST_FILE = example/Info.plist;
1049
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1050
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
1051
+				OTHER_LDFLAGS = (
1052
+					"-ObjC",
1053
+					"-l\"c++\"",
1054
+					"-framework",
1055
+					Detox,
1056
+				);
1057
+				PRODUCT_NAME = example;
1058
+			};
1059
+			name = Debug_Detox;
1060
+		};
1061
+		E53E50BD43A56CF67FAAD3A5 /* Release_Detox */ = {
1062
+			isa = XCBuildConfiguration;
1063
+			buildSettings = {
1064
+				BUNDLE_LOADER = "$(TEST_HOST)";
1065
+				COPY_PHASE_STRIP = NO;
1066
+				FRAMEWORK_SEARCH_PATHS = (
1067
+					"$(SDKROOT)/Developer/Library/Frameworks",
1068
+					"$(inherited)",
1069
+				);
1070
+				INFOPLIST_FILE = exampleTests/Info.plist;
1071
+				IPHONEOS_DEPLOYMENT_TARGET = 8.2;
1072
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1073
+				PRODUCT_NAME = "$(TARGET_NAME)";
1074
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/example";
1075
+			};
1076
+			name = Release_Detox;
1077
+		};
1078
+		EAA4DC359BE7739594666868 /* Release_Detox */ = {
1079
+			isa = XCBuildConfiguration;
1080
+			buildSettings = {
1081
+				ALWAYS_SEARCH_USER_PATHS = NO;
1082
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
1083
+				CLANG_CXX_LIBRARY = "libc++";
1084
+				CLANG_ENABLE_MODULES = YES;
1085
+				CLANG_ENABLE_OBJC_ARC = YES;
1086
+				CLANG_WARN_BOOL_CONVERSION = YES;
1087
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
1088
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
1089
+				CLANG_WARN_EMPTY_BODY = YES;
1090
+				CLANG_WARN_ENUM_CONVERSION = YES;
1091
+				CLANG_WARN_INT_CONVERSION = YES;
1092
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
1093
+				CLANG_WARN_UNREACHABLE_CODE = YES;
1094
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
1095
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1096
+				COPY_PHASE_STRIP = YES;
1097
+				ENABLE_NS_ASSERTIONS = NO;
1098
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
1099
+				GCC_C_LANGUAGE_STANDARD = gnu99;
1100
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
1101
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
1102
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
1103
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
1104
+				GCC_WARN_UNUSED_FUNCTION = YES;
1105
+				GCC_WARN_UNUSED_VARIABLE = YES;
1106
+				HEADER_SEARCH_PATHS = (
1107
+					"$(inherited)",
1108
+					/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
1109
+					"$(SRCROOT)/../node_modules/react-native/React/**",
1110
+				);
1111
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1112
+				MTL_ENABLE_DEBUG_INFO = NO;
1113
+				OTHER_LDFLAGS = "";
1114
+				SDKROOT = iphoneos;
1115
+				VALIDATE_PRODUCT = YES;
1116
+			};
1117
+			name = Release_Detox;
1118
+		};
921 1119
 /* End XCBuildConfiguration section */
922 1120
 
923 1121
 /* Begin XCConfigurationList section */
@@ -926,6 +1124,8 @@
926 1124
 			buildConfigurations = (
927 1125
 				00E356F61AD99517003FC87E /* Debug */,
928 1126
 				00E356F71AD99517003FC87E /* Release */,
1127
+				5627D4C51CEC610E1744267F /* Debug_Detox */,
1128
+				E53E50BD43A56CF67FAAD3A5 /* Release_Detox */,
929 1129
 			);
930 1130
 			defaultConfigurationIsVisible = 0;
931 1131
 			defaultConfigurationName = Release;
@@ -935,6 +1135,8 @@
935 1135
 			buildConfigurations = (
936 1136
 				13B07F941A680F5B00A75B9A /* Debug */,
937 1137
 				13B07F951A680F5B00A75B9A /* Release */,
1138
+				BEB8EFA9FD7A9DCE32773C1C /* Debug_Detox */,
1139
+				96FA810D67E56FD9D43906E6 /* Release_Detox */,
938 1140
 			);
939 1141
 			defaultConfigurationIsVisible = 0;
940 1142
 			defaultConfigurationName = Release;
@@ -944,6 +1146,8 @@
944 1146
 			buildConfigurations = (
945 1147
 				83CBBA201A601CBA00E9B192 /* Debug */,
946 1148
 				83CBBA211A601CBA00E9B192 /* Release */,
1149
+				2C24A1398D388E120DDC2CA1 /* Debug_Detox */,
1150
+				EAA4DC359BE7739594666868 /* Release_Detox */,
947 1151
 			);
948 1152
 			defaultConfigurationIsVisible = 0;
949 1153
 			defaultConfigurationName = Release;

+ 7
- 4
example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme Voir le fichier

@@ -37,10 +37,10 @@
37 37
       </BuildActionEntries>
38 38
    </BuildAction>
39 39
    <TestAction
40
+      buildConfiguration = "Debug"
40 41
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41 42
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42
-      shouldUseLaunchSchemeArgsEnv = "YES"
43
-      buildConfiguration = "Debug">
43
+      shouldUseLaunchSchemeArgsEnv = "YES">
44 44
       <Testables>
45 45
          <TestableReference
46 46
             skipped = "NO">
@@ -62,15 +62,18 @@
62 62
             ReferencedContainer = "container:example.xcodeproj">
63 63
          </BuildableReference>
64 64
       </MacroExpansion>
65
+      <AdditionalOptions>
66
+      </AdditionalOptions>
65 67
    </TestAction>
66 68
    <LaunchAction
69
+      buildConfiguration = "Debug"
67 70
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
68 71
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
69 72
       launchStyle = "0"
70 73
       useCustomWorkingDirectory = "NO"
71
-      buildConfiguration = "Debug"
72 74
       ignoresPersistentStateOnLaunch = "NO"
73 75
       debugDocumentVersioning = "YES"
76
+      debugServiceExtension = "internal"
74 77
       allowLocationSimulation = "YES">
75 78
       <BuildableProductRunnable
76 79
          runnableDebuggingMode = "0">
@@ -86,10 +89,10 @@
86 89
       </AdditionalOptions>
87 90
    </LaunchAction>
88 91
    <ProfileAction
92
+      buildConfiguration = "Release"
89 93
       shouldUseLaunchSchemeArgsEnv = "YES"
90 94
       savedToolIdentifier = ""
91 95
       useCustomWorkingDirectory = "NO"
92
-      buildConfiguration = "Release"
93 96
       debugDocumentVersioning = "YES">
94 97
       <BuildableProductRunnable
95 98
          runnableDebuggingMode = "0">

+ 115
- 0
example/ios/example.xcodeproj/xcshareddata/xcschemes/example_Detox.xcscheme Voir le fichier

@@ -0,0 +1,115 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0620"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "YES"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
18
+               BuildableName = "example.app"
19
+               BlueprintName = "example"
20
+               ReferencedContainer = "container:example.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "NO"
27
+            buildForArchiving = "NO"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
32
+               BuildableName = "exampleTests.xctest"
33
+               BlueprintName = "exampleTests"
34
+               ReferencedContainer = "container:example.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+      </BuildActionEntries>
38
+   </BuildAction>
39
+   <TestAction
40
+      buildConfiguration = "Debug"
41
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43
+      shouldUseLaunchSchemeArgsEnv = "YES">
44
+      <Testables>
45
+         <TestableReference
46
+            skipped = "NO">
47
+            <BuildableReference
48
+               BuildableIdentifier = "primary"
49
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
50
+               BuildableName = "exampleTests.xctest"
51
+               BlueprintName = "exampleTests"
52
+               ReferencedContainer = "container:example.xcodeproj">
53
+            </BuildableReference>
54
+         </TestableReference>
55
+      </Testables>
56
+      <MacroExpansion>
57
+         <BuildableReference
58
+            BuildableIdentifier = "primary"
59
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
60
+            BuildableName = "example.app"
61
+            BlueprintName = "example"
62
+            ReferencedContainer = "container:example.xcodeproj">
63
+         </BuildableReference>
64
+      </MacroExpansion>
65
+      <AdditionalOptions>
66
+      </AdditionalOptions>
67
+   </TestAction>
68
+   <LaunchAction
69
+      buildConfiguration = "Debug_Detox"
70
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
71
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
72
+      launchStyle = "0"
73
+      useCustomWorkingDirectory = "NO"
74
+      ignoresPersistentStateOnLaunch = "NO"
75
+      debugDocumentVersioning = "YES"
76
+      debugServiceExtension = "internal"
77
+      allowLocationSimulation = "YES">
78
+      <BuildableProductRunnable
79
+         runnableDebuggingMode = "0">
80
+         <BuildableReference
81
+            BuildableIdentifier = "primary"
82
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
83
+            BuildableName = "example.app"
84
+            BlueprintName = "example"
85
+            ReferencedContainer = "container:example.xcodeproj">
86
+         </BuildableReference>
87
+      </BuildableProductRunnable>
88
+      <AdditionalOptions>
89
+      </AdditionalOptions>
90
+   </LaunchAction>
91
+   <ProfileAction
92
+      buildConfiguration = "Release"
93
+      shouldUseLaunchSchemeArgsEnv = "YES"
94
+      savedToolIdentifier = ""
95
+      useCustomWorkingDirectory = "NO"
96
+      debugDocumentVersioning = "YES">
97
+      <BuildableProductRunnable
98
+         runnableDebuggingMode = "0">
99
+         <BuildableReference
100
+            BuildableIdentifier = "primary"
101
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
102
+            BuildableName = "example.app"
103
+            BlueprintName = "example"
104
+            ReferencedContainer = "container:example.xcodeproj">
105
+         </BuildableReference>
106
+      </BuildableProductRunnable>
107
+   </ProfileAction>
108
+   <AnalyzeAction
109
+      buildConfiguration = "Debug">
110
+   </AnalyzeAction>
111
+   <ArchiveAction
112
+      buildConfiguration = "Release"
113
+      revealArchiveInOrganizer = "YES">
114
+   </ArchiveAction>
115
+</Scheme>

+ 105
- 0
example/ios/example.xcodeproj/xcshareddata/xcschemes/example_release.xcscheme Voir le fichier

@@ -0,0 +1,105 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0620"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "YES"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
18
+               BuildableName = "example.app"
19
+               BlueprintName = "example"
20
+               ReferencedContainer = "container:example.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "NO"
27
+            buildForArchiving = "NO"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "00E356ED1AD99517003FC87E"
32
+               BuildableName = "exampleTests.xctest"
33
+               BlueprintName = "exampleTests"
34
+               ReferencedContainer = "container:example.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+      </BuildActionEntries>
38
+   </BuildAction>
39
+   <TestAction
40
+      buildConfiguration = "Release"
41
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43
+      shouldUseLaunchSchemeArgsEnv = "YES">
44
+      <Testables>
45
+      </Testables>
46
+      <MacroExpansion>
47
+         <BuildableReference
48
+            BuildableIdentifier = "primary"
49
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
50
+            BuildableName = "example.app"
51
+            BlueprintName = "example"
52
+            ReferencedContainer = "container:example.xcodeproj">
53
+         </BuildableReference>
54
+      </MacroExpansion>
55
+      <AdditionalOptions>
56
+      </AdditionalOptions>
57
+   </TestAction>
58
+   <LaunchAction
59
+      buildConfiguration = "Release"
60
+      selectedDebuggerIdentifier = ""
61
+      selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
62
+      launchStyle = "0"
63
+      useCustomWorkingDirectory = "NO"
64
+      ignoresPersistentStateOnLaunch = "NO"
65
+      debugDocumentVersioning = "YES"
66
+      debugServiceExtension = "internal"
67
+      allowLocationSimulation = "YES">
68
+      <BuildableProductRunnable
69
+         runnableDebuggingMode = "0">
70
+         <BuildableReference
71
+            BuildableIdentifier = "primary"
72
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
73
+            BuildableName = "example.app"
74
+            BlueprintName = "example"
75
+            ReferencedContainer = "container:example.xcodeproj">
76
+         </BuildableReference>
77
+      </BuildableProductRunnable>
78
+      <AdditionalOptions>
79
+      </AdditionalOptions>
80
+   </LaunchAction>
81
+   <ProfileAction
82
+      buildConfiguration = "Release"
83
+      shouldUseLaunchSchemeArgsEnv = "YES"
84
+      savedToolIdentifier = ""
85
+      useCustomWorkingDirectory = "NO"
86
+      debugDocumentVersioning = "YES">
87
+      <BuildableProductRunnable
88
+         runnableDebuggingMode = "0">
89
+         <BuildableReference
90
+            BuildableIdentifier = "primary"
91
+            BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
92
+            BuildableName = "example.app"
93
+            BlueprintName = "example"
94
+            ReferencedContainer = "container:example.xcodeproj">
95
+         </BuildableReference>
96
+      </BuildableProductRunnable>
97
+   </ProfileAction>
98
+   <AnalyzeAction
99
+      buildConfiguration = "Release">
100
+   </AnalyzeAction>
101
+   <ArchiveAction
102
+      buildConfiguration = "Release"
103
+      revealArchiveInOrganizer = "YES">
104
+   </ArchiveAction>
105
+</Scheme>

+ 4
- 1
example/ios/example/AppDelegate.m Voir le fichier

@@ -15,8 +15,11 @@
15 15
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
16 16
 {
17 17
   NSURL *jsCodeLocation;
18
+#ifdef DEBUG
18 19
   jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
19
-  // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
20
+#else
21
+   jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
22
+#endif
20 23
 
21 24
 
22 25
   // **********************************************

+ 18
- 3
example/package.json Voir le fichier

@@ -3,14 +3,29 @@
3 3
   "version": "0.0.1",
4 4
   "private": true,
5 5
   "scripts": {
6
-    "postinstall": "rm -rf node_modules/react-native-navigation/node_modules && rm -rf node_modules/react-native-navigation/example && rm -rf yarn.lock",
7
-    "start": "watchman watch-del-all && (adb reverse tcp:8081 tcp:8081 || true) && node node_modules/react-native/local-cli/cli.js start",
6
+    "postinstall": "node ./scripts/postinstall.js",
7
+    "start": "watchman watch-del-all && (adb reverse tcp:8081 tcp:8081 || true) && node node_modules/react-native/local-cli/cli.js start --reset-cache",
8 8
     "xcode": "open ios/example.xcodeproj",
9
-    "android": "cd android && ./gradlew installDebug"
9
+    "android": "cd android && ./gradlew installDebug",
10
+    "e2e": "node ./scripts/e2e.ios.js"
10 11
   },
11 12
   "dependencies": {
12 13
     "react-native": "0.38.0",
13 14
     "react": "15.4.1",
14 15
     "react-native-navigation": "file:../"
16
+  },
17
+  "devDependencies": {
18
+    "detox": "4.x.x",
19
+    "detox-server": "1.x.x"
20
+  },
21
+  "detox": {
22
+    "session": {
23
+      "server": "ws://localhost:8099",
24
+      "sessionId": "example"
25
+    },
26
+    "ios-simulator": {
27
+      "app": "ios/DerivedData/example/Build/Products/Debug_Detox-iphonesimulator/example.app",
28
+      "device": "iPhone 7, iOS 10.1"
29
+    }
15 30
   }
16 31
 }

+ 44
- 0
example/scripts/e2e.ios.js Voir le fichier

@@ -0,0 +1,44 @@
1
+const cp = require('child_process');
2
+
3
+function exec(cmd) {
4
+  cp.execSync(cmd, {stdio: ['inherit', 'inherit', 'inherit']});
5
+}
6
+
7
+function execSilent(cmd) {
8
+  cp.execSync(cmd, {stdio: ['inherit', 'ignore', 'inherit']});
9
+}
10
+
11
+function kill(process) {
12
+  execSilent(`pkill -f "${process}" || true`);
13
+}
14
+
15
+function buildXcodeReleaseProj() {
16
+//exec(`RCT_NO_LAUNCH_PACKAGER=true cd ios && xcodebuild \
17
+//-scheme example_Detox clean build \
18
+//-project example.xcodeproj \
19
+//-destination "platform=iOS Simulator,name=iPhone 7,OS=10.1" \
20
+//-derivedDataPath ./DerivedData/example`);
21
+}
22
+
23
+function e2e() {
24
+  kill(`detox-server`);
25
+
26
+  try {
27
+    cp.exec(`./node_modules/.bin/detox-server > ./detox-server.log 2>&1`);
28
+    exec(`BABEL_ENV=test ./node_modules/mocha/bin/mocha e2e --opts ./e2e/mocha.opts`);
29
+  } finally {
30
+    kill(`detox-server`);
31
+    kill(`Simulator`);
32
+    kill(`CoreSimulator`);
33
+    exec(`cat ./detox-server.log`);
34
+    exec(`sleep 5`);
35
+  }
36
+}
37
+
38
+function run() {
39
+  buildXcodeReleaseProj();
40
+  e2e();
41
+}
42
+
43
+run();
44
+

+ 4
- 0
example/scripts/postinstall.js Voir le fichier

@@ -0,0 +1,4 @@
1
+const cp = require('child_process');
2
+cp.execSync(`rm -rf node_modules/react-native-navigation/node_modules`);
3
+cp.execSync(`rm -rf node_modules/react-native-navigation/example `);
4
+cp.execSync(`rm -rf yarn.lock`);

ios/ReactNativeNavigation.xcodeproj/xcshareddata/xcschemes/ReactNativeControllers.xcscheme → ios/ReactNativeNavigation.xcodeproj/xcshareddata/xcschemes/ReactNativeNavigation.xcscheme Voir le fichier


+ 3
- 0
package.json Voir le fichier

@@ -55,6 +55,9 @@
55 55
   },
56 56
   "jest": {
57 57
     "preset": "react-native",
58
+    "testPathDirs": [
59
+      "src"
60
+    ],
58 61
     "resetMocks": true,
59 62
     "resetModules": true
60 63
   }

+ 16
- 7
src/deprecated/platformSpecificDeprecated.android.js Voir le fichier

@@ -176,12 +176,21 @@ function convertDrawerParamsToSideMenuParams(drawerParams) {
176 176
     return null;
177 177
   }
178 178
 
179
-  let result = {};
179
+  let result = {
180
+    left: {},
181
+    right: {}
182
+  };
180 183
   result.disableOpenGesture = drawer.disableOpenGesture !== undefined;
181
-  result.screenId = drawer.left.screen;
182
-  addNavigatorParams(result);
183
-  result = adaptNavigationParams(result);
184
-  result.passProps = drawer.passProps;
184
+  result.left.screenId = drawer.left.screen;
185
+  addNavigatorParams(result.left);
186
+  result.left = adaptNavigationParams(result.left);
187
+  result.left.passProps = drawer.left.passProps;
188
+
189
+  result.right.screenId = drawer.right.screen;
190
+  addNavigatorParams(result.right);
191
+  result.right = adaptNavigationParams(result.right);
192
+  result.right.passProps = drawer.right.passProps;
193
+
185 194
   return result;
186 195
 }
187 196
 
@@ -301,9 +310,9 @@ function navigatorToggleDrawer(navigator, params) {
301 310
   const animated = !(params.animated === false);
302 311
   if (params.to) {
303 312
     const visible = params.to === 'open';
304
-    newPlatformSpecific.setSideMenuVisible(animated, visible);
313
+    newPlatformSpecific.setSideMenuVisible(animated, visible, params.side);
305 314
   } else {
306
-    newPlatformSpecific.toggleSideMenuVisible(animated);
315
+    newPlatformSpecific.toggleSideMenuVisible(animated, params.side);
307 316
   }
308 317
 }
309 318
 

+ 9
- 6
src/platformSpecific.android.js Voir le fichier

@@ -87,17 +87,20 @@ function savePassProps(params) {
87 87
     });
88 88
   }
89 89
 
90
-  if (params.sideMenu) {
91
-    PropRegistry.save(params.sideMenu.navigationParams.screenInstanceID, params.sideMenu.passProps);
90
+  if (params.sideMenu && params.sideMenu.left) {
91
+    PropRegistry.save(params.sideMenu.left.navigationParams.screenInstanceID, params.sideMenu.left.passProps);
92
+  }
93
+  if (params.sideMenu && params.sideMenu.right) {
94
+    PropRegistry.save(params.sideMenu.right.navigationParams.screenInstanceID, params.sideMenu.right.passProps);
92 95
   }
93 96
 }
94 97
 
95
-function toggleSideMenuVisible(animated) {
96
-  NativeReactModule.toggleSideMenuVisible(animated);
98
+function toggleSideMenuVisible(animated, side) {
99
+  NativeReactModule.toggleSideMenuVisible(animated, side);
97 100
 }
98 101
 
99
-function setSideMenuVisible(animated, visible) {
100
-  NativeReactModule.setSideMenuVisible(animated, visible);
102
+function setSideMenuVisible(animated, visible, side) {
103
+  NativeReactModule.setSideMenuVisible(animated, visible, side);
101 104
 }
102 105
 
103 106
 function selectBottomTabByNavigatorId(navigatorId) {