react-native-navigation 7.23.1-snapshot.449 → 7.24.0-snapshot.459
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/Mock.d.ts +1 -0
- package/Mock.js +4 -0
- package/Mock.ts +1 -1
- package/jest.config.js +1 -1
- package/lib/{src/Mock → Mock}/Application.tsx +0 -0
- package/lib/{src/Mock → Mock}/ComponentProps.tsx +0 -0
- package/lib/{src/Mock → Mock}/Components/BottomTabs.tsx +0 -0
- package/lib/{src/Mock → Mock}/Components/ComponentScreen.tsx +1 -1
- package/lib/{src/Mock → Mock}/Components/LayoutComponent.tsx +0 -0
- package/lib/{src/Mock → Mock}/Components/Modals.tsx +0 -0
- package/lib/{src/Mock → Mock}/Components/NavigationButton.tsx +1 -1
- package/lib/{src/Mock → Mock}/Components/Overlays.tsx +0 -0
- package/lib/{src/Mock → Mock}/Components/Stack.tsx +0 -0
- package/lib/{src/Mock → Mock}/Components/TopBar.tsx +2 -2
- package/lib/{src/Mock → Mock}/Layouts/BottomTabsNode.ts +1 -1
- package/lib/{src/Mock → Mock}/Layouts/ComponentNode.ts +1 -1
- package/lib/{src/Mock → Mock}/Layouts/LayoutNodeFactory.ts +0 -0
- package/lib/{src/Mock → Mock}/Layouts/Node.ts +1 -1
- package/lib/{src/Mock → Mock}/Layouts/ParentNode.ts +2 -2
- package/lib/{src/Mock → Mock}/Layouts/StackNode.ts +0 -0
- package/lib/{src/Mock → Mock}/Stores/EventsStore.ts +3 -3
- package/lib/{src/Mock → Mock}/Stores/LayoutStore.ts +1 -1
- package/lib/{src/Mock → Mock}/connect.ts +0 -0
- package/lib/Mock/constants.d.ts +2 -0
- package/lib/Mock/constants.js +5 -0
- package/lib/{src/Mock → Mock}/constants.ts +0 -0
- package/lib/Mock/index.d.ts +3 -0
- package/lib/Mock/index.js +14 -0
- package/lib/{src/Mock → Mock}/index.ts +0 -0
- package/lib/{src/Mock → Mock}/mocks/AppRegistryService.ts +0 -0
- package/lib/{src/Mock → Mock}/mocks/NativeCommandsSender.tsx +1 -1
- package/lib/{src/Mock → Mock}/mocks/NativeEventsReceiver.ts +2 -2
- 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/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/dist/Mock/Application.js +2 -2
- package/lib/dist/Mock/Components/BottomTabs.js +2 -2
- package/lib/dist/Mock/Components/ComponentScreen.js +5 -5
- package/lib/dist/Mock/Components/LayoutComponent.js +3 -2
- package/lib/dist/Mock/Components/Modals.js +2 -2
- package/lib/dist/Mock/Components/NavigationButton.d.ts +1 -1
- package/lib/dist/Mock/Components/NavigationButton.js +8 -10
- package/lib/dist/Mock/Components/Overlays.js +2 -2
- package/lib/dist/Mock/Components/Stack.js +2 -2
- package/lib/dist/Mock/Components/TopBar.d.ts +2 -2
- package/lib/dist/Mock/Components/TopBar.js +7 -6
- package/lib/dist/Mock/Layouts/BottomTabsNode.d.ts +1 -1
- package/lib/dist/Mock/Layouts/BottomTabsNode.js +3 -3
- package/lib/dist/Mock/Layouts/ComponentNode.d.ts +1 -1
- package/lib/dist/Mock/Layouts/ComponentNode.js +4 -4
- package/lib/dist/Mock/Layouts/LayoutNodeFactory.js +3 -3
- package/lib/dist/Mock/Layouts/Node.d.ts +1 -1
- package/lib/dist/Mock/Layouts/Node.js +5 -0
- package/lib/dist/Mock/Layouts/ParentNode.d.ts +2 -2
- package/lib/dist/Mock/Layouts/ParentNode.js +4 -3
- package/lib/dist/Mock/Layouts/StackNode.js +1 -1
- package/lib/dist/Mock/Stores/EventsStore.d.ts +3 -3
- package/lib/dist/Mock/Stores/LayoutStore.js +2 -2
- package/lib/dist/Mock/connect.js +1 -1
- package/lib/dist/Mock/index.js +1 -1
- package/lib/dist/Mock/mocks/NativeCommandsSender.d.ts +1 -1
- package/lib/dist/Mock/mocks/NativeCommandsSender.js +2 -2
- package/lib/dist/Mock/mocks/NativeEventsReceiver.d.ts +2 -2
- package/lib/dist/Mock/mocks/NativeEventsReceiver.js +1 -1
- package/lib/dist/{Navigation.d.ts → src/Navigation.d.ts} +0 -0
- package/lib/dist/{Navigation.js → src/Navigation.js} +19 -3
- package/lib/dist/{NavigationDelegate.d.ts → src/NavigationDelegate.d.ts} +0 -0
- package/lib/dist/{NavigationDelegate.js → src/NavigationDelegate.js} +1 -0
- package/lib/dist/{adapters → src/adapters}/AppRegistryService.d.ts +0 -0
- package/lib/dist/{adapters → src/adapters}/AppRegistryService.js +0 -0
- package/lib/dist/{adapters → src/adapters}/AssetResolver.d.ts +0 -0
- package/lib/dist/{adapters → src/adapters}/AssetResolver.js +0 -0
- package/lib/dist/src/adapters/ColorService.d.ts +3 -0
- package/lib/dist/{adapters → src/adapters}/ColorService.js +1 -1
- package/lib/dist/{adapters → src/adapters}/Constants.d.ts +0 -0
- package/lib/dist/{adapters → src/adapters}/Constants.js +10 -6
- package/lib/dist/{adapters → src/adapters}/NativeCommandsSender.d.ts +0 -0
- package/lib/dist/{adapters → src/adapters}/NativeCommandsSender.js +1 -0
- package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.d.ts +0 -0
- package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.js +1 -0
- package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.mock.d.ts +0 -0
- package/lib/dist/{adapters → src/adapters}/NativeEventsReceiver.mock.js +0 -0
- package/lib/dist/{adapters → src/adapters}/TouchablePreview.d.ts +0 -0
- package/lib/dist/src/adapters/TouchablePreview.js +89 -0
- package/lib/dist/{adapters → src/adapters}/UniqueIdProvider.d.ts +0 -0
- package/lib/dist/{adapters → src/adapters}/UniqueIdProvider.js +2 -2
- package/lib/dist/{commands → src/commands}/Commands.d.ts +0 -0
- package/lib/dist/{commands → src/commands}/Commands.js +18 -9
- package/lib/dist/{commands → src/commands}/Deprecations.d.ts +0 -0
- package/lib/dist/src/commands/Deprecations.js +80 -0
- package/lib/dist/{commands → src/commands}/LayoutTreeCrawler.d.ts +0 -0
- package/lib/dist/{commands → src/commands}/LayoutTreeCrawler.js +2 -0
- package/lib/dist/{commands → src/commands}/LayoutTreeParser.d.ts +0 -0
- package/lib/dist/{commands → src/commands}/LayoutTreeParser.js +1 -0
- package/lib/dist/{commands → src/commands}/LayoutType.d.ts +0 -0
- package/lib/dist/{commands → src/commands}/LayoutType.js +0 -0
- package/lib/dist/{commands → src/commands}/OptionsCrawler.d.ts +0 -0
- package/lib/dist/{commands → src/commands}/OptionsCrawler.js +6 -4
- package/lib/dist/{commands → src/commands}/OptionsProcessor.d.ts +0 -0
- package/lib/dist/{commands → src/commands}/OptionsProcessor.js +42 -36
- package/lib/dist/{components → src/components}/ComponentRegistry.d.ts +0 -0
- package/lib/dist/{components → src/components}/ComponentRegistry.js +4 -0
- package/lib/dist/{components → src/components}/ComponentWrapper.d.ts +0 -0
- package/lib/dist/{components → src/components}/ComponentWrapper.js +17 -17
- package/lib/dist/{components → src/components}/Modal.d.ts +0 -0
- package/lib/dist/{components → src/components}/Modal.js +8 -8
- package/lib/dist/{components → src/components}/Store.d.ts +0 -0
- package/lib/dist/{components → src/components}/Store.js +6 -7
- package/lib/dist/{events → src/events}/CommandsObserver.d.ts +0 -0
- package/lib/dist/{events → src/events}/CommandsObserver.js +2 -1
- package/lib/dist/{events → src/events}/ComponentEventsObserver.d.ts +4 -2
- package/lib/dist/{events → src/events}/ComponentEventsObserver.js +16 -14
- package/lib/dist/{events → src/events}/EventsRegistry.d.ts +2 -2
- package/lib/dist/{events → src/events}/EventsRegistry.js +3 -0
- package/lib/dist/{index.d.ts → src/index.d.ts} +0 -0
- package/lib/dist/src/index.js +22 -0
- package/lib/dist/{interfaces → src/interfaces}/CommandName.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/CommandName.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/ComponentEvents.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/ComponentEvents.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/EventSubscription.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/EventSubscription.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Events.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Events.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Layout.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Layout.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/NavigationComponent.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/NavigationComponent.js +8 -1
- package/lib/dist/{interfaces → src/interfaces}/NavigationComponentListener.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/NavigationComponentListener.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/NavigationComponentProps.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/NavigationComponentProps.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/NavigationFunctionComponent.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/NavigationFunctionComponent.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Options.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Options.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/ProcessorSubscription.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/ProcessorSubscription.js +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Processors.d.ts +0 -0
- package/lib/dist/{interfaces → src/interfaces}/Processors.js +0 -0
- package/lib/dist/{processors → src/processors}/LayoutProcessor.d.ts +0 -0
- package/lib/dist/{processors → src/processors}/LayoutProcessor.js +1 -0
- package/lib/dist/{processors → src/processors}/LayoutProcessorsStore.d.ts +0 -0
- package/lib/dist/{processors → src/processors}/LayoutProcessorsStore.js +1 -3
- package/lib/dist/{processors → src/processors}/OptionProcessorsStore.d.ts +0 -0
- package/lib/dist/{processors → src/processors}/OptionProcessorsStore.js +1 -3
- package/lib/dist/{types.d.ts → src/types.d.ts} +0 -0
- package/lib/dist/{types.js → src/types.js} +0 -0
- package/lib/src/commands/OptionsCrawler.ts +2 -1
- package/lib/src/events/ComponentEventsObserver.ts +5 -1
- package/lib/src/events/EventsRegistry.ts +2 -1
- package/package.json +6 -6
- package/tsconfig.mocks.json +7 -0
- package/lib/dist/adapters/ColorService.d.ts +0 -3
- package/lib/dist/adapters/TouchablePreview.js +0 -91
- package/lib/dist/commands/Deprecations.js +0 -82
- package/lib/dist/index.js +0 -22
package/Mock.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/Mock';
|
package/Mock.js
ADDED
package/Mock.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './lib/
|
|
1
|
+
export * from './lib/Mock';
|
package/jest.config.js
CHANGED
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
|
16
16
|
setupFilesAfterEnv: ['./jest-setup.js'],
|
|
17
17
|
testPathIgnorePatterns: ['/node_modules/'],
|
|
18
18
|
moduleNameMapper: {
|
|
19
|
-
'react-native-navigation/Mock': '<rootDir>/lib/
|
|
19
|
+
'react-native-navigation/Mock': '<rootDir>/lib/Mock',
|
|
20
20
|
'react-native-navigation': '<rootDir>/lib/src',
|
|
21
21
|
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
|
22
22
|
'<rootDir>/playground/img/layouts@2x.png',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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 '../../src';
|
|
4
4
|
import { ComponentProps } from '../ComponentProps';
|
|
5
5
|
import { VISIBLE_SCREEN_TEST_ID } from '../constants';
|
|
6
6
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
File without changes
|
|
File without changes
|
|
@@ -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 '../../src';
|
|
4
4
|
import { events } from '../Stores/EventsStore';
|
|
5
5
|
|
|
6
6
|
interface ButtonProps {
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Button, View, Text } from 'react-native';
|
|
3
|
-
import { Navigation, OptionsTopBarButton } from '
|
|
4
|
-
import { OptionsTopBar, OptionsTopBarBackButton } from '../../interfaces/Options';
|
|
3
|
+
import { Navigation, OptionsTopBarButton } from '../../src';
|
|
4
|
+
import { OptionsTopBar, OptionsTopBarBackButton } from '../../src/interfaces/Options';
|
|
5
5
|
import ParentNode from '../Layouts/ParentNode';
|
|
6
6
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
7
7
|
import { NavigationButton } from './NavigationButton';
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import { OptionsTopBarButton } from '../../interfaces/Options';
|
|
3
|
-
import { Options } from '../../index';
|
|
2
|
+
import { OptionsTopBarButton } from '../../src/interfaces/Options';
|
|
3
|
+
import { Options } from '../../src/index';
|
|
4
4
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
5
5
|
import ComponentNode from './ComponentNode';
|
|
6
6
|
import LayoutNodeFactory from './LayoutNodeFactory';
|
|
File without changes
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ComponentDidDisappearEvent,
|
|
3
3
|
ComponentWillAppearEvent,
|
|
4
4
|
ModalDismissedEvent,
|
|
5
|
-
} from '../../interfaces/ComponentEvents';
|
|
6
|
-
import { ComponentDidAppearEvent, NavigationButtonPressedEvent } from '../../index';
|
|
7
|
-
import { BottomTabPressedEvent } from '../../interfaces/Events';
|
|
5
|
+
} from '../../src/interfaces/ComponentEvents';
|
|
6
|
+
import { ComponentDidAppearEvent, NavigationButtonPressedEvent } from '../../src/index';
|
|
7
|
+
import { BottomTabPressedEvent } from '../../src/interfaces/Events';
|
|
8
8
|
|
|
9
9
|
export const events = {
|
|
10
10
|
navigationButtonPressed: [(_event: NavigationButtonPressedEvent) => {}],
|
|
@@ -2,7 +2,7 @@ import _ from 'lodash';
|
|
|
2
2
|
import BottomTabsNode from '../Layouts/BottomTabsNode';
|
|
3
3
|
import ParentNode from '../Layouts/ParentNode';
|
|
4
4
|
import LayoutNodeFactory from '../Layouts/LayoutNodeFactory';
|
|
5
|
-
import { Options } from '../../interfaces/Options';
|
|
5
|
+
import { Options } from '../../src/interfaces/Options';
|
|
6
6
|
import StackNode from '../Layouts/StackNode';
|
|
7
7
|
|
|
8
8
|
const remx = require('remx');
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VISIBLE_OVERLAY_TEST_ID = exports.VISIBLE_SCREEN_TEST_ID = void 0;
|
|
4
|
+
exports.VISIBLE_SCREEN_TEST_ID = 'VISIBLE_SCREEN_TEST_ID';
|
|
5
|
+
exports.VISIBLE_OVERLAY_TEST_ID = 'VISIBLE_OVERLAY_TEST_ID';
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockNativeComponents = exports.ApplicationMock = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
exports.ApplicationMock = require('./Application').Application;
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./constants"), exports);
|
|
7
|
+
function mockNativeComponents() {
|
|
8
|
+
const { NativeCommandsSender } = require('./mocks/NativeCommandsSender');
|
|
9
|
+
const { NativeEventsReceiver } = require('./mocks/NativeEventsReceiver');
|
|
10
|
+
const { AppRegistryService } = require('./mocks/AppRegistryService');
|
|
11
|
+
const { Navigation } = require('react-native-navigation');
|
|
12
|
+
Navigation.mockNativeComponents(new NativeCommandsSender(), new NativeEventsReceiver(), new AppRegistryService());
|
|
13
|
+
}
|
|
14
|
+
exports.mockNativeComponents = mockNativeComponents;
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
2
2
|
import LayoutNodeFactory from '../Layouts/LayoutNodeFactory';
|
|
3
|
-
import { LayoutNode } from '
|
|
3
|
+
import { LayoutNode } from '../../src/commands/LayoutTreeCrawler';
|
|
4
4
|
import { events } from '../Stores/EventsStore';
|
|
5
5
|
import _ from 'lodash';
|
|
6
6
|
import ComponentNode from '../Layouts/ComponentNode';
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
ModalDismissedEvent,
|
|
12
12
|
ScreenPoppedEvent,
|
|
13
13
|
ModalAttemptedToDismissEvent,
|
|
14
|
-
} from '../../interfaces/ComponentEvents';
|
|
14
|
+
} from '../../src/interfaces/ComponentEvents';
|
|
15
15
|
import {
|
|
16
16
|
CommandCompletedEvent,
|
|
17
17
|
BottomTabSelectedEvent,
|
|
18
18
|
BottomTabLongPressedEvent,
|
|
19
19
|
BottomTabPressedEvent,
|
|
20
|
-
} from '../../interfaces/Events';
|
|
20
|
+
} from '../../src/interfaces/Events';
|
|
21
21
|
import { events } from './../Stores/EventsStore';
|
|
22
22
|
|
|
23
23
|
export class NativeEventsReceiver {
|
|
@@ -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
|
|
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)
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Application = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const React = tslib_1.__importStar(require("react"));
|
|
5
|
+
const React = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
7
|
const connect_1 = require("./connect");
|
|
8
|
-
exports.Application = connect_1.connect(class extends React.Component {
|
|
8
|
+
exports.Application = (0, connect_1.connect)(class extends React.Component {
|
|
9
9
|
constructor(props) {
|
|
10
10
|
super(props);
|
|
11
11
|
props.entryPoint();
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BottomTabs = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const LayoutComponent_1 = require("./LayoutComponent");
|
|
7
7
|
const connect_1 = require("../connect");
|
|
8
|
-
exports.BottomTabs = connect_1.connect(class extends react_1.Component {
|
|
8
|
+
exports.BottomTabs = (0, connect_1.connect)(class extends react_1.Component {
|
|
9
9
|
render() {
|
|
10
10
|
return this.props.layoutNode.children.map((child) => {
|
|
11
11
|
return react_1.default.createElement(LayoutComponent_1.LayoutComponent, { key: child.nodeId, layoutNode: child });
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComponentScreen = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const src_1 = require("../../src");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
10
10
|
const connect_1 = require("../connect");
|
|
11
11
|
const TopBar_1 = require("./TopBar");
|
|
12
12
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
13
|
-
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
14
|
-
exports.ComponentScreen = connect_1.connect(class extends react_1.Component {
|
|
13
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
14
|
+
exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component {
|
|
15
15
|
constructor(props) {
|
|
16
16
|
super(props);
|
|
17
17
|
}
|
|
@@ -43,7 +43,7 @@ exports.ComponentScreen = 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 = src_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 },
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LayoutComponent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
7
|
const BottomTabs_1 = require("./BottomTabs");
|
|
8
8
|
const ComponentScreen_1 = require("./ComponentScreen");
|
|
9
9
|
const Stack_1 = require("./Stack");
|
|
10
|
-
|
|
10
|
+
const LayoutComponent = class extends react_1.Component {
|
|
11
11
|
render() {
|
|
12
12
|
switch (this.props.layoutNode.type) {
|
|
13
13
|
case 'BottomTabs':
|
|
@@ -20,3 +20,4 @@ exports.LayoutComponent = class extends react_1.Component {
|
|
|
20
20
|
return react_1.default.createElement(react_native_1.View, null);
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
exports.LayoutComponent = LayoutComponent;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Modals = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
7
|
const LayoutComponent_1 = require("./LayoutComponent");
|
|
8
8
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
9
9
|
const connect_1 = require("../connect");
|
|
10
|
-
exports.Modals = connect_1.connect(class extends react_1.Component {
|
|
10
|
+
exports.Modals = (0, connect_1.connect)(class extends react_1.Component {
|
|
11
11
|
render() {
|
|
12
12
|
const children = LayoutStore_1.LayoutStore.getModals();
|
|
13
13
|
return (react_1.default.createElement(react_native_1.View, { testID: 'MODALS' }, children.map((child) => {
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NavigationButton = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const src_1 = require("../../src");
|
|
8
8
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super(...arguments);
|
|
12
|
-
this.ref = undefined;
|
|
13
|
-
}
|
|
9
|
+
const NavigationButton = class extends react_1.Component {
|
|
10
|
+
ref = undefined;
|
|
14
11
|
render() {
|
|
15
12
|
const { button, componentId } = this.props;
|
|
16
13
|
if (button.component)
|
|
@@ -26,8 +23,8 @@ exports.NavigationButton = class extends react_1.Component {
|
|
|
26
23
|
//@ts-ignore
|
|
27
24
|
const buttonComponentId = button.component.componentId;
|
|
28
25
|
//@ts-ignore
|
|
29
|
-
const Component =
|
|
30
|
-
const props =
|
|
26
|
+
const Component = src_1.Navigation.mock.store.getComponentClassForName(button.component.name)();
|
|
27
|
+
const props = src_1.Navigation.mock.store.getPropsForId(buttonComponentId);
|
|
31
28
|
return (react_1.default.createElement(react_native_1.TouchableOpacity, { onPress: () => {
|
|
32
29
|
if (this.ref) {
|
|
33
30
|
// @ts-ignore
|
|
@@ -38,7 +35,7 @@ exports.NavigationButton = class extends react_1.Component {
|
|
|
38
35
|
componentId: componentId,
|
|
39
36
|
});
|
|
40
37
|
}, testID: button.testID },
|
|
41
|
-
react_1.default.createElement(Component,
|
|
38
|
+
react_1.default.createElement(Component, { key: buttonComponentId, ...props, componentId: buttonComponentId, ref: (ref) => (this.ref = ref) })));
|
|
42
39
|
}
|
|
43
40
|
invokeOnClick(stateNode) {
|
|
44
41
|
if (stateNode.children) {
|
|
@@ -53,3 +50,4 @@ exports.NavigationButton = class extends react_1.Component {
|
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
};
|
|
53
|
+
exports.NavigationButton = NavigationButton;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Overlays = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
8
|
const LayoutComponent_1 = require("./LayoutComponent");
|
|
9
9
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
10
10
|
const connect_1 = require("../connect");
|
|
11
|
-
exports.Overlays = connect_1.connect(class extends react_1.Component {
|
|
11
|
+
exports.Overlays = (0, connect_1.connect)(class extends react_1.Component {
|
|
12
12
|
render() {
|
|
13
13
|
const children = LayoutStore_1.LayoutStore.getOverlays();
|
|
14
14
|
return (react_1.default.createElement(react_native_1.View, { testID: constants_1.VISIBLE_OVERLAY_TEST_ID }, children.map((child) => {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Stack = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const LayoutComponent_1 = require("./LayoutComponent");
|
|
7
7
|
const connect_1 = require("../connect");
|
|
8
|
-
exports.Stack = connect_1.connect(class extends react_1.Component {
|
|
8
|
+
exports.Stack = (0, connect_1.connect)(class extends react_1.Component {
|
|
9
9
|
render() {
|
|
10
10
|
const children = this.props.layoutNode.children;
|
|
11
11
|
return children.map((child, i) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OptionsTopBarButton } from '
|
|
3
|
-
import { OptionsTopBar, OptionsTopBarBackButton } from '../../interfaces/Options';
|
|
2
|
+
import { OptionsTopBarButton } from '../../src';
|
|
3
|
+
import { OptionsTopBar, OptionsTopBarBackButton } from '../../src/interfaces/Options';
|
|
4
4
|
import ParentNode from '../Layouts/ParentNode';
|
|
5
5
|
export interface TopBarProps {
|
|
6
6
|
layoutNode: ParentNode;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TopBar = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const src_1 = require("../../src");
|
|
8
8
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
9
9
|
const NavigationButton_1 = require("./NavigationButton");
|
|
10
10
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
11
11
|
const DEFAULT_BACK_BUTTON_ID = 'RNN.back';
|
|
12
|
-
|
|
12
|
+
const TopBar = class extends react_1.Component {
|
|
13
13
|
constructor(props) {
|
|
14
14
|
super(props);
|
|
15
15
|
}
|
|
@@ -54,9 +54,10 @@ exports.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 = src_1.Navigation.mock.store.getComponentClassForName(name)();
|
|
58
|
+
const props = src_1.Navigation.mock.store.getPropsForId(id);
|
|
59
59
|
return (react_1.default.createElement(react_native_1.View, { key: id, testID: testID },
|
|
60
|
-
react_1.default.createElement(Component,
|
|
60
|
+
react_1.default.createElement(Component, { ...props, componentId: id })));
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
+
exports.TopBar = TopBar;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
4
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
5
5
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
6
|
-
const ParentNode_1 = tslib_1.__importDefault(require("./ParentNode"));
|
|
6
|
+
const ParentNode_1 = (0, tslib_1.__importDefault)(require("./ParentNode"));
|
|
7
7
|
class BottomTabsNode extends ParentNode_1.default {
|
|
8
|
+
selectedIndex = 0;
|
|
8
9
|
constructor(layout, parentNode) {
|
|
9
10
|
super(layout, 'BottomTabs', parentNode);
|
|
10
|
-
this.selectedIndex = 0;
|
|
11
11
|
}
|
|
12
12
|
mergeOptions(options) {
|
|
13
13
|
super.mergeOptions(options);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
4
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
5
5
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
6
|
-
const ParentNode_1 = tslib_1.__importDefault(require("./ParentNode"));
|
|
6
|
+
const ParentNode_1 = (0, tslib_1.__importDefault)(require("./ParentNode"));
|
|
7
7
|
class ComponentNode extends ParentNode_1.default {
|
|
8
|
+
componentDidMountOnce = false;
|
|
9
|
+
componentDidAppearPending = false;
|
|
8
10
|
constructor(layout, parentNode) {
|
|
9
11
|
super(layout, 'Component', parentNode);
|
|
10
|
-
this.componentDidMountOnce = false;
|
|
11
|
-
this.componentDidAppearPending = false;
|
|
12
12
|
}
|
|
13
13
|
componentDidMount() {
|
|
14
14
|
this.componentDidMountOnce = true;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const BottomTabsNode_1 = tslib_1.__importDefault(require("./BottomTabsNode"));
|
|
5
|
-
const ComponentNode_1 = tslib_1.__importDefault(require("./ComponentNode"));
|
|
6
|
-
const StackNode_1 = tslib_1.__importDefault(require("./StackNode"));
|
|
4
|
+
const BottomTabsNode_1 = (0, tslib_1.__importDefault)(require("./BottomTabsNode"));
|
|
5
|
+
const ComponentNode_1 = (0, tslib_1.__importDefault)(require("./ComponentNode"));
|
|
6
|
+
const StackNode_1 = (0, tslib_1.__importDefault)(require("./StackNode"));
|
|
7
7
|
class LayoutNodeFactory {
|
|
8
8
|
static create(layout, parentNode) {
|
|
9
9
|
switch (layout.type) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OptionsTopBarButton } from '../../interfaces/Options';
|
|
2
|
-
import { Options } from '../../index';
|
|
1
|
+
import { OptionsTopBarButton } from '../../src/interfaces/Options';
|
|
2
|
+
import { Options } from '../../src/index';
|
|
3
3
|
import ComponentNode from './ComponentNode';
|
|
4
4
|
import Node, { NodeType } from './Node';
|
|
5
5
|
export default class ParentNode extends Node {
|