react-native-navigation 7.24.0 → 7.24.3-hotfix.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Mock/Components/ComponentScreen.tsx +1 -1
- package/lib/Mock/Components/NavigationButton.tsx +1 -1
- package/lib/Mock/Components/TopBar.tsx +6 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java +13 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt +3 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java +4 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +2 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java +6 -0
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/SystemUiUtilsTest.kt +27 -0
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.kt +17 -0
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewControllerTest.java +25 -0
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java +1 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewControllerTest.java +2 -0
- package/lib/dist/Mock/Components/ComponentScreen.js +2 -2
- package/lib/dist/Mock/Components/NavigationButton.d.ts +1 -1
- package/lib/dist/Mock/Components/NavigationButton.js +3 -3
- package/lib/dist/Mock/Components/TopBar.d.ts +1 -2
- package/lib/dist/Mock/Components/TopBar.js +3 -3
- package/lib/ios/RNNBridgeManager.mm +5 -3
- package/lib/ios/RNNComponentRootView.m +0 -14
- package/lib/ios/RNNModalHostViewManagerHandler.h +11 -0
- package/lib/ios/RNNModalHostViewManagerHandler.m +40 -0
- package/lib/ios/RNNModalManager.h +2 -2
- package/lib/ios/RNNModalManager.m +0 -26
- package/lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj +8 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Button, View, Text } from 'react-native';
|
|
3
|
-
import { Navigation } from '
|
|
3
|
+
import { Navigation } from 'react-native-navigation';
|
|
4
4
|
import { ComponentProps } from '../ComponentProps';
|
|
5
5
|
import { VISIBLE_SCREEN_TEST_ID } from '../constants';
|
|
6
6
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Button, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { Navigation, OptionsTopBarButton } from '
|
|
3
|
+
import { Navigation, OptionsTopBarButton } from 'react-native-navigation';
|
|
4
4
|
import { events } from '../Stores/EventsStore';
|
|
5
5
|
|
|
6
6
|
interface ButtonProps {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Button, View, Text } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
Navigation,
|
|
5
|
+
OptionsTopBar,
|
|
6
|
+
OptionsTopBarBackButton,
|
|
7
|
+
OptionsTopBarButton,
|
|
8
|
+
} from 'react-native-navigation';
|
|
5
9
|
import ParentNode from '../Layouts/ParentNode';
|
|
6
10
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
7
11
|
import { NavigationButton } from './NavigationButton';
|
|
@@ -66,18 +66,22 @@ public class ReactView extends ReactRootView implements IReactView, Renderable {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
public void sendComponentWillStart(ComponentType type) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
this.post(()->{
|
|
70
|
+
if (this.reactInstanceManager == null) return;
|
|
71
|
+
ReactContext currentReactContext = reactInstanceManager.getCurrentReactContext();
|
|
72
|
+
if (currentReactContext != null)
|
|
73
|
+
new EventEmitter(currentReactContext).emitComponentWillAppear(componentId, componentName, type);
|
|
74
|
+
});
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
public void sendComponentStart(ComponentType type) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
this.post(()->{
|
|
79
|
+
if (this.reactInstanceManager == null) return;
|
|
80
|
+
ReactContext currentReactContext = reactInstanceManager.getCurrentReactContext();
|
|
81
|
+
if (currentReactContext != null) {
|
|
82
|
+
new EventEmitter(currentReactContext).emitComponentDidAppear(componentId, componentName, type);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
public void sendComponentStop(ComponentType type) {
|
|
@@ -17,7 +17,7 @@ import kotlin.math.ceil
|
|
|
17
17
|
object SystemUiUtils {
|
|
18
18
|
private const val STATUS_BAR_HEIGHT_M = 24
|
|
19
19
|
private const val STATUS_BAR_HEIGHT_L = 25
|
|
20
|
-
|
|
20
|
+
internal const val STATUS_BAR_HEIGHT_TRANSLUCENCY = 0.65f
|
|
21
21
|
private var statusBarHeight = -1
|
|
22
22
|
var navigationBarDefaultColor = -1
|
|
23
23
|
private set
|
|
@@ -124,7 +124,8 @@ object SystemUiUtils {
|
|
|
124
124
|
val opaqueColor = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
125
125
|
Color.BLACK
|
|
126
126
|
}else{
|
|
127
|
-
val
|
|
127
|
+
val colorAlpha = Color.alpha(color)
|
|
128
|
+
val alpha = if (translucent && colorAlpha == 255) STATUS_BAR_HEIGHT_TRANSLUCENCY else colorAlpha/255.0f
|
|
128
129
|
val red: Int = Color.red(color)
|
|
129
130
|
val green: Int = Color.green(color)
|
|
130
131
|
val blue: Int = Color.blue(color)
|
|
@@ -274,6 +274,7 @@ public class BottomTabsController extends ParentController<BottomTabsLayout> imp
|
|
|
274
274
|
getCurrentView().setVisibility(View.INVISIBLE);
|
|
275
275
|
bottomTabs.setCurrentItem(newIndex, false);
|
|
276
276
|
getCurrentView().setVisibility(View.VISIBLE);
|
|
277
|
+
getCurrentChild().onViewWillAppear();
|
|
277
278
|
getCurrentChild().onViewDidAppear();
|
|
278
279
|
}
|
|
279
280
|
|
|
@@ -78,12 +78,14 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
78
78
|
if (view != null)
|
|
79
79
|
view.sendComponentWillStart();
|
|
80
80
|
super.onViewDidAppear();
|
|
81
|
+
view.requestApplyInsets();
|
|
81
82
|
if (view != null && lastVisibilityState == VisibilityState.Disappear) view.sendComponentStart();
|
|
82
83
|
lastVisibilityState = VisibilityState.Appear;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
@Override
|
|
86
87
|
public void onViewDisappear() {
|
|
88
|
+
if(lastVisibilityState == VisibilityState.Disappear)return;
|
|
87
89
|
lastVisibilityState = VisibilityState.Disappear;
|
|
88
90
|
if (view != null) view.sendComponentStop();
|
|
89
91
|
super.onViewDisappear();
|
|
@@ -90,12 +90,10 @@ public class ModalPresenter {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
private void onShowModalEnd(ViewController<?> toAdd, @Nullable ViewController<?> toRemove, CommandListener listener) {
|
|
93
|
-
toAdd.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
});
|
|
93
|
+
toAdd.onViewDidAppear();
|
|
94
|
+
if (toRemove != null && toAdd.resolveCurrentOptions(defaultOptions).modal.presentationStyle != ModalPresentationStyle.OverCurrentContext) {
|
|
95
|
+
toRemove.detachView();
|
|
96
|
+
}
|
|
99
97
|
listener.onSuccess(toAdd.getId());
|
|
100
98
|
}
|
|
101
99
|
|
|
@@ -190,10 +190,8 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
private void onPushAnimationComplete(ViewController<?> toAdd, ViewController<?> toRemove, CommandListener listener) {
|
|
193
|
-
toAdd.
|
|
194
|
-
|
|
195
|
-
if (!peek().equals(toRemove)) getView().removeView(toRemove.getView());
|
|
196
|
-
});
|
|
193
|
+
toAdd.onViewDidAppear();
|
|
194
|
+
if (!peek().equals(toRemove)) getView().removeView(toRemove.getView());
|
|
197
195
|
listener.onSuccess(toAdd.getId());
|
|
198
196
|
}
|
|
199
197
|
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java
CHANGED
|
@@ -88,6 +88,12 @@ public class BottomTabs extends AHBottomNavigation {
|
|
|
88
88
|
if (getDefaultBackgroundColor() != color) setDefaultBackgroundColor(color);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
@Override
|
|
92
|
+
public void restoreBottomNavigation(boolean withAnimation) {
|
|
93
|
+
super.restoreBottomNavigation(withAnimation);
|
|
94
|
+
if (!withAnimation) setVisibility(View.VISIBLE);
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
@Override
|
|
92
98
|
public void hideBottomNavigation(boolean withAnimation) {
|
|
93
99
|
super.hideBottomNavigation(withAnimation);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
package com.reactnativenavigation.utils
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import android.view.Window
|
|
5
|
+
import com.reactnativenavigation.BaseTest
|
|
6
|
+
import com.reactnativenavigation.utils.SystemUiUtils.STATUS_BAR_HEIGHT_TRANSLUCENCY
|
|
7
|
+
import org.junit.Test
|
|
8
|
+
import org.mockito.Mockito
|
|
9
|
+
import org.mockito.kotlin.verify
|
|
10
|
+
import kotlin.math.ceil
|
|
11
|
+
|
|
12
|
+
class SystemUiUtilsTest : BaseTest() {
|
|
13
|
+
|
|
14
|
+
@Test
|
|
15
|
+
fun `setStatusBarColor - should change color considering alpha`() {
|
|
16
|
+
val window = Mockito.mock(Window::class.java)
|
|
17
|
+
val alphaColor = Color.argb(44, 22, 255, 255)
|
|
18
|
+
val color = Color.argb(255, 22, 255, 255)
|
|
19
|
+
SystemUiUtils.setStatusBarColor(window, alphaColor, false)
|
|
20
|
+
|
|
21
|
+
verify(window).statusBarColor = alphaColor
|
|
22
|
+
|
|
23
|
+
SystemUiUtils.setStatusBarColor(window, color, true)
|
|
24
|
+
|
|
25
|
+
verify(window).statusBarColor = Color.argb(ceil(STATUS_BAR_HEIGHT_TRANSLUCENCY*255).toInt(), 22, 255, 255)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -316,7 +316,24 @@ class BottomTabsControllerTest : BaseTest() {
|
|
|
316
316
|
), ArgumentMatchers.any(Int::class.java)
|
|
317
317
|
)
|
|
318
318
|
}
|
|
319
|
+
@Test
|
|
320
|
+
fun `mergeOptions - select tab calls onViewWillAppear to apply options on the selected child`(){
|
|
321
|
+
uut.ensureViewIsCreated()
|
|
322
|
+
Java6Assertions.assertThat(uut.selectedIndex).isZero
|
|
323
|
+
|
|
324
|
+
val options = Options()
|
|
325
|
+
options.bottomTabsOptions.currentTabIndex = Number(1)
|
|
326
|
+
uut.mergeOptions(options)
|
|
327
|
+
Java6Assertions.assertThat(uut.selectedIndex).isOne
|
|
328
|
+
Mockito.verify(child2).onViewWillAppear()
|
|
329
|
+
Mockito.verify(child2).onViewDidAppear()
|
|
319
330
|
|
|
331
|
+
options.bottomTabsOptions.currentTabIndex = Number(0)
|
|
332
|
+
uut.mergeOptions(options)
|
|
333
|
+
Java6Assertions.assertThat(uut.selectedIndex).isZero
|
|
334
|
+
Mockito.verify(child1).onViewWillAppear()
|
|
335
|
+
Mockito.verify(child1).onViewDidAppear()
|
|
336
|
+
}
|
|
320
337
|
@Test
|
|
321
338
|
fun mergeOptions_drawBehind() {
|
|
322
339
|
Java6Assertions.assertThat(uut.getBottomInset(child1)).isEqualTo(uut.bottomTabs.height)
|
|
@@ -94,6 +94,24 @@ public class ComponentViewControllerTest extends BaseTest {
|
|
|
94
94
|
Mockito.verify(view, Mockito.times(1)).sendComponentStop();
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
@Test
|
|
98
|
+
public void shouldNotSendDidDisappearAboutDisappearedView() {
|
|
99
|
+
uut.ensureViewIsCreated();
|
|
100
|
+
uut.onViewDisappear();
|
|
101
|
+
Mockito.verify(view, Mockito.times(0)).sendComponentStart();
|
|
102
|
+
Mockito.verify(view, Mockito.times(0)).sendComponentStop();
|
|
103
|
+
|
|
104
|
+
uut.onViewWillAppear();
|
|
105
|
+
uut.onViewDidAppear();
|
|
106
|
+
uut.onViewDisappear();
|
|
107
|
+
Mockito.verify(view, Mockito.times(1)).sendComponentStart();
|
|
108
|
+
Mockito.verify(view, Mockito.times(1)).sendComponentStop();
|
|
109
|
+
|
|
110
|
+
uut.onViewDisappear();
|
|
111
|
+
Mockito.verify(view, Mockito.times(1)).sendComponentStart();
|
|
112
|
+
Mockito.verify(view, Mockito.times(1)).sendComponentStop();
|
|
113
|
+
}
|
|
114
|
+
|
|
97
115
|
@Test
|
|
98
116
|
public void onViewDidAppear_componentStartIsEmittedOnlyIfComponentIsNotAppeared() {
|
|
99
117
|
uut.ensureViewIsCreated();
|
|
@@ -109,6 +127,13 @@ public class ComponentViewControllerTest extends BaseTest {
|
|
|
109
127
|
Mockito.verify(view, Mockito.times(2)).sendComponentStart();
|
|
110
128
|
}
|
|
111
129
|
|
|
130
|
+
@Test
|
|
131
|
+
public void shouldCallApplyWindowInsetsWhenViewFullyAppeared(){
|
|
132
|
+
uut.ensureViewIsCreated();
|
|
133
|
+
uut.onViewDidAppear();
|
|
134
|
+
Mockito.verify(view).requestApplyInsets();
|
|
135
|
+
}
|
|
136
|
+
|
|
112
137
|
@Test
|
|
113
138
|
public void isViewShownOnlyIfComponentViewIsReady() {
|
|
114
139
|
Java6Assertions.assertThat(uut.isViewShown()).isFalse();
|
|
@@ -84,10 +84,9 @@ public class ModalStackTest extends BaseTest {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
@Test
|
|
87
|
-
public void
|
|
87
|
+
public void showModal_DidAppearEventShouldBeCallled(){
|
|
88
88
|
CommandListener listener = spy(new CommandListenerAdapter());
|
|
89
89
|
uut.showModal(modal1, root, listener);
|
|
90
|
-
verify(modal1).addOnAppearedListener(any());
|
|
91
90
|
verify(listener).onSuccess(modal1.getId());
|
|
92
91
|
idleMainLooper();
|
|
93
92
|
verify(modal1).onViewDidAppear();
|
|
@@ -24,6 +24,7 @@ import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
|
24
24
|
import com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator;
|
|
25
25
|
import com.reactnativenavigation.views.toptabs.TopTabsViewPager;
|
|
26
26
|
|
|
27
|
+
import org.junit.Ignore;
|
|
27
28
|
import org.junit.Test;
|
|
28
29
|
import org.mockito.Mockito;
|
|
29
30
|
|
|
@@ -123,6 +124,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
@Test
|
|
127
|
+
@Ignore("TopTabs not yet well supported")
|
|
126
128
|
public void lifecycleMethodsSentWhenSelectedTabChanges() {
|
|
127
129
|
stack.ensureViewIsCreated();
|
|
128
130
|
uut.ensureViewIsCreated();
|
|
@@ -4,7 +4,7 @@ exports.ComponentScreen = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const react_native_navigation_1 = require("react-native-navigation");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
10
10
|
const connect_1 = require("../connect");
|
|
@@ -43,7 +43,7 @@ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component
|
|
|
43
43
|
return react_1.default.createElement(react_native_1.View, { testID: bottomTabsOptions?.testID }, buttons);
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
|
-
const Component =
|
|
46
|
+
const Component = react_native_navigation_1.Navigation.mock.store.getWrappedComponent(this.props.layoutNode.data.name);
|
|
47
47
|
if (!Component)
|
|
48
48
|
throw new Error(`${this.props.layoutNode.data.name} has not been registered.`);
|
|
49
49
|
return (react_1.default.createElement(react_native_1.View, { testID: this.isVisible() ? constants_1.VISIBLE_SCREEN_TEST_ID : undefined },
|
|
@@ -4,7 +4,7 @@ exports.NavigationButton = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const react_native_navigation_1 = require("react-native-navigation");
|
|
8
8
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
9
9
|
const NavigationButton = class extends react_1.Component {
|
|
10
10
|
ref = undefined;
|
|
@@ -23,8 +23,8 @@ const NavigationButton = class extends react_1.Component {
|
|
|
23
23
|
//@ts-ignore
|
|
24
24
|
const buttonComponentId = button.component.componentId;
|
|
25
25
|
//@ts-ignore
|
|
26
|
-
const Component =
|
|
27
|
-
const props =
|
|
26
|
+
const Component = react_native_navigation_1.Navigation.mock.store.getComponentClassForName(button.component.name)();
|
|
27
|
+
const props = react_native_navigation_1.Navigation.mock.store.getPropsForId(buttonComponentId);
|
|
28
28
|
return (react_1.default.createElement(react_native_1.TouchableOpacity, { onPress: () => {
|
|
29
29
|
if (this.ref) {
|
|
30
30
|
// @ts-ignore
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OptionsTopBarButton } from '
|
|
3
|
-
import { OptionsTopBar, OptionsTopBarBackButton } from '../../src/interfaces/Options';
|
|
2
|
+
import { OptionsTopBar, OptionsTopBarBackButton, OptionsTopBarButton } from 'react-native-navigation';
|
|
4
3
|
import ParentNode from '../Layouts/ParentNode';
|
|
5
4
|
export interface TopBarProps {
|
|
6
5
|
layoutNode: ParentNode;
|
|
@@ -4,7 +4,7 @@ exports.TopBar = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const react_native_navigation_1 = require("react-native-navigation");
|
|
8
8
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
9
9
|
const NavigationButton_1 = require("./NavigationButton");
|
|
10
10
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
@@ -54,8 +54,8 @@ const TopBar = class extends react_1.Component {
|
|
|
54
54
|
} }));
|
|
55
55
|
}
|
|
56
56
|
renderComponent(id, name, testID) {
|
|
57
|
-
const Component =
|
|
58
|
-
const props =
|
|
57
|
+
const Component = react_native_navigation_1.Navigation.mock.store.getComponentClassForName(name)();
|
|
58
|
+
const props = react_native_navigation_1.Navigation.mock.store.getPropsForId(id);
|
|
59
59
|
return (react_1.default.createElement(react_native_1.View, { key: id, testID: testID },
|
|
60
60
|
react_1.default.createElement(Component, { ...props, componentId: id })));
|
|
61
61
|
}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
#import "RNNComponentViewCreator.h"
|
|
5
5
|
#import "RNNEventEmitter.h"
|
|
6
6
|
#import "RNNLayoutManager.h"
|
|
7
|
+
#import "RNNModalHostViewManagerHandler.h"
|
|
7
8
|
#import "RNNReactComponentRegistry.h"
|
|
8
9
|
#import "RNNReactRootViewCreator.h"
|
|
9
10
|
#import "RNNSplashScreen.h"
|
|
10
11
|
#import <React/RCTBridge.h>
|
|
11
|
-
#import <React/RCTModalHostViewManager.h>
|
|
12
12
|
#import <React/RCTUIManager.h>
|
|
13
13
|
|
|
14
14
|
@interface RNNBridgeManager ()
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
@property(nonatomic, strong, readonly) RNNLayoutManager *layoutManager;
|
|
20
20
|
@property(nonatomic, strong, readonly) RNNOverlayManager *overlayManager;
|
|
21
21
|
@property(nonatomic, strong, readonly) RNNModalManager *modalManager;
|
|
22
|
+
@property(nonatomic, strong, readonly) RNNModalHostViewManagerHandler *modalHostViewHandler;
|
|
22
23
|
|
|
23
24
|
@end
|
|
24
25
|
|
|
@@ -66,7 +67,8 @@
|
|
|
66
67
|
[[RNNModalManagerEventHandler alloc] initWithEventEmitter:eventEmitter];
|
|
67
68
|
_modalManager = [[RNNModalManager alloc] initWithBridge:bridge
|
|
68
69
|
eventHandler:modalManagerEventHandler];
|
|
69
|
-
|
|
70
|
+
_modalHostViewHandler =
|
|
71
|
+
[[RNNModalHostViewManagerHandler alloc] initWithModalManager:_modalManager];
|
|
70
72
|
_layoutManager = [[RNNLayoutManager alloc] init];
|
|
71
73
|
|
|
72
74
|
id<RNNComponentViewCreator> rootViewCreator =
|
|
@@ -105,7 +107,7 @@
|
|
|
105
107
|
|
|
106
108
|
- (void)onJavaScriptLoaded {
|
|
107
109
|
[_commandsHandler setReadyToReceiveCommands:true];
|
|
108
|
-
[
|
|
110
|
+
[_modalHostViewHandler
|
|
109
111
|
connectModalHostViewManager:[self.bridge moduleForClass:RCTModalHostViewManager.class]];
|
|
110
112
|
[[_bridge moduleForClass:[RNNEventEmitter class]] sendOnAppLaunched];
|
|
111
113
|
}
|
|
@@ -2,20 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
@implementation RNNComponentRootView
|
|
4
4
|
|
|
5
|
-
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
6
|
-
moduleName:(NSString *)moduleName
|
|
7
|
-
initialProperties:(NSDictionary *)initialProperties
|
|
8
|
-
eventEmitter:(RNNEventEmitter *)eventEmitter
|
|
9
|
-
reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
|
|
10
|
-
self = [super initWithBridge:bridge
|
|
11
|
-
moduleName:moduleName
|
|
12
|
-
initialProperties:initialProperties
|
|
13
|
-
eventEmitter:eventEmitter
|
|
14
|
-
reactViewReadyBlock:reactViewReadyBlock];
|
|
15
|
-
[bridge.uiManager setAvailableSize:UIScreen.mainScreen.bounds.size forRootView:self];
|
|
16
|
-
return self;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
5
|
- (NSString *)componentType {
|
|
20
6
|
return ComponentTypeScreen;
|
|
21
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#import "RNNModalManager.h"
|
|
2
|
+
#import <Foundation/Foundation.h>
|
|
3
|
+
#import <React/RCTModalHostViewManager.h>
|
|
4
|
+
|
|
5
|
+
@interface RNNModalHostViewManagerHandler : NSObject
|
|
6
|
+
|
|
7
|
+
- (instancetype)initWithModalManager:(RNNModalManager *)modalManager;
|
|
8
|
+
|
|
9
|
+
- (void)connectModalHostViewManager:(RCTModalHostViewManager *)modalHostViewManager;
|
|
10
|
+
|
|
11
|
+
@end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#import "RNNModalHostViewManagerHandler.h"
|
|
2
|
+
|
|
3
|
+
@implementation RNNModalHostViewManagerHandler {
|
|
4
|
+
RNNModalManager *_modalManager;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
- (instancetype)initWithModalManager:(RNNModalManager *)modalManager {
|
|
8
|
+
self = [super init];
|
|
9
|
+
_modalManager = modalManager;
|
|
10
|
+
return self;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
- (void)connectModalHostViewManager:(RCTModalHostViewManager *)modalHostViewManager {
|
|
14
|
+
modalHostViewManager.presentationBlock =
|
|
15
|
+
^(UIViewController *reactViewController, UIViewController *viewController, BOOL animated,
|
|
16
|
+
dispatch_block_t completionBlock) {
|
|
17
|
+
if (reactViewController.presentedViewController != viewController &&
|
|
18
|
+
[self->_modalManager topPresentedVC] != viewController) {
|
|
19
|
+
[self->_modalManager showModal:viewController
|
|
20
|
+
animated:animated
|
|
21
|
+
completion:^(NSString *_Nonnull componentId) {
|
|
22
|
+
if (completionBlock)
|
|
23
|
+
completionBlock();
|
|
24
|
+
}];
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
modalHostViewManager.dismissalBlock =
|
|
29
|
+
^(UIViewController *reactViewController, UIViewController *viewController, BOOL animated,
|
|
30
|
+
dispatch_block_t completionBlock) {
|
|
31
|
+
[self->_modalManager dismissModal:viewController
|
|
32
|
+
animated:animated
|
|
33
|
+
completion:^{
|
|
34
|
+
if (completionBlock)
|
|
35
|
+
completionBlock();
|
|
36
|
+
}];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#import "RNNModalManagerEventHandler.h"
|
|
2
2
|
#import <Foundation/Foundation.h>
|
|
3
3
|
#import <React/RCTBridge.h>
|
|
4
|
-
#import <React/RCTModalHostViewManager.h>
|
|
5
4
|
#import <UIKit/UIKit.h>
|
|
6
5
|
|
|
7
6
|
typedef void (^RNNTransitionCompletionBlock)(void);
|
|
@@ -13,7 +12,6 @@ typedef void (^RNNTransitionRejectionBlock)(NSString *_Nonnull code, NSString *_
|
|
|
13
12
|
|
|
14
13
|
- (instancetype _Nonnull)initWithBridge:(RCTBridge *_Nonnull)bridge
|
|
15
14
|
eventHandler:(RNNModalManagerEventHandler *_Nonnull)eventHandler;
|
|
16
|
-
- (void)connectModalHostViewManager:(RCTModalHostViewManager *_Nonnull)modalHostViewManager;
|
|
17
15
|
|
|
18
16
|
- (void)showModal:(UIViewController *_Nonnull)viewController
|
|
19
17
|
animated:(BOOL)animated
|
|
@@ -25,4 +23,6 @@ typedef void (^RNNTransitionRejectionBlock)(NSString *_Nonnull code, NSString *_
|
|
|
25
23
|
|
|
26
24
|
- (void)reset;
|
|
27
25
|
|
|
26
|
+
- (UIViewController *)topPresentedVC;
|
|
27
|
+
|
|
28
28
|
@end
|
|
@@ -32,32 +32,6 @@
|
|
|
32
32
|
return self;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
- (void)connectModalHostViewManager:(RCTModalHostViewManager *)modalHostViewManager {
|
|
36
|
-
modalHostViewManager.presentationBlock =
|
|
37
|
-
^(UIViewController *reactViewController, UIViewController *viewController, BOOL animated,
|
|
38
|
-
dispatch_block_t completionBlock) {
|
|
39
|
-
if (reactViewController.presentedViewController != viewController) {
|
|
40
|
-
[self showModal:viewController
|
|
41
|
-
animated:animated
|
|
42
|
-
completion:^(NSString *_Nonnull componentId) {
|
|
43
|
-
if (completionBlock)
|
|
44
|
-
completionBlock();
|
|
45
|
-
}];
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
modalHostViewManager.dismissalBlock =
|
|
50
|
-
^(UIViewController *reactViewController, UIViewController *viewController, BOOL animated,
|
|
51
|
-
dispatch_block_t completionBlock) {
|
|
52
|
-
[self dismissModal:viewController
|
|
53
|
-
animated:animated
|
|
54
|
-
completion:^{
|
|
55
|
-
if (completionBlock)
|
|
56
|
-
completionBlock();
|
|
57
|
-
}];
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
35
|
- (void)showModal:(UIViewController<RNNLayoutProtocol> *)viewController
|
|
62
36
|
animated:(BOOL)animated
|
|
63
37
|
completion:(RNNTransitionWithComponentIdCompletionBlock)completion {
|
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
4534E72620CB6724009F8185 /* RNNLargeTitleOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4534E72420CB6724009F8185 /* RNNLargeTitleOptions.m */; };
|
|
52
52
|
500623A525B7003A0086AB39 /* RNNShadowOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 500623A325B7003A0086AB39 /* RNNShadowOptions.h */; };
|
|
53
53
|
500623A625B7003A0086AB39 /* RNNShadowOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 500623A425B7003A0086AB39 /* RNNShadowOptions.m */; };
|
|
54
|
+
5006E12C27974B8900D106A6 /* RNNModalHostViewManagerHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 5006E12A27974B8900D106A6 /* RNNModalHostViewManagerHandler.h */; };
|
|
55
|
+
5006E12D27974B8900D106A6 /* RNNModalHostViewManagerHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 5006E12B27974B8900D106A6 /* RNNModalHostViewManagerHandler.m */; };
|
|
54
56
|
5008641223856A2D00A55BE9 /* UITabBar+utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 5008641023856A2C00A55BE9 /* UITabBar+utils.m */; };
|
|
55
57
|
501214C9217741A000435148 /* libOCMock.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 501214C8217741A000435148 /* libOCMock.a */; };
|
|
56
58
|
501223D72173590F000F5F98 /* RNNStackPresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 501223D52173590F000F5F98 /* RNNStackPresenter.h */; };
|
|
@@ -580,6 +582,8 @@
|
|
|
580
582
|
4534E72420CB6724009F8185 /* RNNLargeTitleOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNLargeTitleOptions.m; sourceTree = "<group>"; };
|
|
581
583
|
500623A325B7003A0086AB39 /* RNNShadowOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNShadowOptions.h; sourceTree = "<group>"; };
|
|
582
584
|
500623A425B7003A0086AB39 /* RNNShadowOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNShadowOptions.m; sourceTree = "<group>"; };
|
|
585
|
+
5006E12A27974B8900D106A6 /* RNNModalHostViewManagerHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNModalHostViewManagerHandler.h; sourceTree = "<group>"; };
|
|
586
|
+
5006E12B27974B8900D106A6 /* RNNModalHostViewManagerHandler.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNModalHostViewManagerHandler.m; sourceTree = "<group>"; };
|
|
583
587
|
5008641023856A2C00A55BE9 /* UITabBar+utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UITabBar+utils.m"; sourceTree = "<group>"; };
|
|
584
588
|
5008641123856A2D00A55BE9 /* UITabBar+utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UITabBar+utils.h"; sourceTree = "<group>"; };
|
|
585
589
|
501214C8217741A000435148 /* libOCMock.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libOCMock.a; sourceTree = "<group>"; };
|
|
@@ -1092,6 +1096,8 @@
|
|
|
1092
1096
|
390AD476200F499D00A8250D /* RNNSwizzles.m */,
|
|
1093
1097
|
506A2B1220973DFD00F43A95 /* RNNErrorHandler.h */,
|
|
1094
1098
|
506A2B1320973DFD00F43A95 /* RNNErrorHandler.m */,
|
|
1099
|
+
5006E12A27974B8900D106A6 /* RNNModalHostViewManagerHandler.h */,
|
|
1100
|
+
5006E12B27974B8900D106A6 /* RNNModalHostViewManagerHandler.m */,
|
|
1095
1101
|
50644A1E20E11A720026709C /* Constants.h */,
|
|
1096
1102
|
50644A1F20E11A720026709C /* Constants.m */,
|
|
1097
1103
|
50706E6B20CE7CA5003345C3 /* UIImage+utils.h */,
|
|
@@ -1818,6 +1824,7 @@
|
|
|
1818
1824
|
files = (
|
|
1819
1825
|
506BF6622600AE7600A22755 /* BoundsTransition.h in Headers */,
|
|
1820
1826
|
91CB34C9250ED50C000C132B /* RNNSearchBarOptions.h in Headers */,
|
|
1827
|
+
5006E12C27974B8900D106A6 /* RNNModalHostViewManagerHandler.h in Headers */,
|
|
1821
1828
|
5060DE73219DAD7E00D0C052 /* ReactNativeNavigation.h in Headers */,
|
|
1822
1829
|
506BF7CE26067B0500A22755 /* AnimatedUIImageView.h in Headers */,
|
|
1823
1830
|
5022EDBD2405237100852BA6 /* BottomTabPresenterCreator.h in Headers */,
|
|
@@ -2337,6 +2344,7 @@
|
|
|
2337
2344
|
5017D9EF239D2FAF00B74047 /* BottomTabsAfterInitialTabAttacher.m in Sources */,
|
|
2338
2345
|
5008641223856A2D00A55BE9 /* UITabBar+utils.m in Sources */,
|
|
2339
2346
|
9FDA2ABE24F2A42C005678CC /* RCTConvert+UIFontWeight.m in Sources */,
|
|
2347
|
+
5006E12D27974B8900D106A6 /* RNNModalHostViewManagerHandler.m in Sources */,
|
|
2340
2348
|
9FDA2AC024F2A43B005678CC /* RCTConvert+SideMenuOpenGestureMode.m in Sources */,
|
|
2341
2349
|
50BCB27223F1650800D6C8E5 /* SharedElementTransition.m in Sources */,
|
|
2342
2350
|
E5F6C3A822DB4D0F0093C2CE /* UIView+Utils.m in Sources */,
|