Skip to content

Commit 40e4b3c

Browse files
committed
update
1 parent 120bc43 commit 40e4b3c

2 files changed

Lines changed: 13 additions & 40 deletions

File tree

playground/src/screens/FirstBottomTabScreen.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,17 @@ const TABS = [
1919

2020
const launchTest = (mode: 'together' | 'onSwitchToTab') => {
2121
resetLoadOrder();
22-
Navigation.setRoot({
23-
root: {
24-
bottomTabs: {
25-
id: 'TabsTest',
26-
options: { bottomTabs: { tabsAttachMode: mode, titleDisplayMode: 'alwaysShow' } },
27-
children: TABS.map((item, i) => ({
28-
stack: {
29-
id: `Tab${i}`,
30-
children: [{ component: { name: 'TabsTogetherTest.WebViewTab', passProps: { tabIndex: i, ...item } } }],
31-
options: { bottomTab: { text: item.title, icon: require('../../img/layouts.png') } },
32-
},
33-
})),
34-
},
22+
Navigation.showModal({
23+
bottomTabs: {
24+
id: 'TabsTest',
25+
options: { bottomTabs: { tabsAttachMode: mode, titleDisplayMode: 'alwaysShow' } },
26+
children: TABS.map((item, i) => ({
27+
stack: {
28+
id: `Tab${i}`,
29+
children: [component('TabsTogetherTest.WebViewTab', undefined, { tabIndex: i, ...item })],
30+
options: { bottomTab: { text: item.title, icon: require('../../img/layouts.png') } },
31+
},
32+
})),
3533
},
3634
});
3735
};

playground/src/screens/TabsTogetherTest.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React, { useEffect } from 'react';
22
import { StyleSheet } from 'react-native';
33
import { Navigation, NavigationFunctionComponent } from 'react-native-navigation';
44
import { WebView } from 'react-native-webview';
5-
import testIDs from '../testIDs';
6-
import Screens from './Screens';
75

86
const loadOrder: number[] = [];
97
const listeners: Set<() => void> = new Set();
@@ -64,37 +62,14 @@ const WebViewTab: NavigationFunctionComponent<Props> = ({ componentId, tabIndex,
6462
WebViewTab.options = {
6563
topBar: {
6664
title: { text: 'WebView Tab' },
67-
leftButtons: [{ id: 'back', text: 'Back' }],
65+
leftButtons: [{ id: 'back', icon: require('../../img/clear.png') }],
6866
},
6967
};
7068

7169
Navigation.registerComponent('TabsTogetherTest.WebViewTab', () => WebViewTab);
7270

7371
const goBackToPlayground = () => {
74-
Navigation.setRoot({
75-
root: {
76-
bottomTabs: {
77-
options: { bottomTabs: { testID: testIDs.MAIN_BOTTOM_TABS } },
78-
children: [
79-
{ stack: { children: [{ component: { name: 'Layouts' } }], options: { bottomTab: { text: 'Layouts', icon: require('../../img/layouts.png') } } } },
80-
{ stack: { children: [{ component: { name: 'Options' } }], options: { bottomTab: { text: 'Options', icon: require('../../img/options.png') } } } },
81-
{ stack: { id: 'NavigationTabStack', children: [{ component: { name: 'Navigation' } }] } },
82-
],
83-
},
84-
},
85-
});
86-
// Show the BottomTabs modal after restoring root
87-
Navigation.showModal({
88-
bottomTabs: {
89-
children: [
90-
{ stack: { children: [{ component: { name: Screens.FirstBottomTabsScreen } }] } },
91-
{ stack: { id: 'SecondTab', children: [{ component: { name: Screens.SecondBottomTabsScreen } }] } },
92-
],
93-
options: {
94-
bottomTabs: { testID: testIDs.BOTTOM_TABS },
95-
},
96-
},
97-
});
72+
Navigation.dismissModal('TabsTest');
9873
};
9974

10075
export const resetLoadOrder = () => { loadOrder.length = 0; };

0 commit comments

Comments
 (0)