Skip to content

Commit 120bc43

Browse files
committed
update
1 parent 47d7a4f commit 120bc43

2 files changed

Lines changed: 30 additions & 28 deletions

File tree

playground/src/screens/FirstBottomTabScreen.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,35 @@ import Screens from './Screens';
99
import { component } from '../commons/Layouts';
1010
import testIDs from '../testIDs';
1111
import bottomTabsStruct from './BottomTabsLayoutStructure';
12-
import { launchTabsTogetherTest, launchTabsOnSwitchTest } from './TabsTogetherTest';
12+
import { resetLoadOrder } from './TabsTogetherTest';
13+
14+
const TABS = [
15+
{ url: 'https://www.apple.com', title: 'Apple' },
16+
{ url: 'https://www.microsoft.com', title: 'Microsoft' },
17+
{ url: 'https://www.amazon.com', title: 'Amazon' },
18+
];
19+
20+
const launchTest = (mode: 'together' | 'onSwitchToTab') => {
21+
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+
},
35+
},
36+
});
37+
};
38+
39+
const launchTabsTogetherTest = () => launchTest('together');
40+
const launchTabsOnSwitchTest = () => launchTest('onSwitchToTab');
1341

1442
export class MountedBottomTabScreensState {
1543
static mountedBottomTabScreens: string[] = [];

playground/src/screens/TabsTogetherTest.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,7 @@ const goBackToPlayground = () => {
9797
});
9898
};
9999

100-
const TABS = [
101-
{ url: 'https://www.apple.com', title: 'Apple' },
102-
{ url: 'https://www.microsoft.com', title: 'Microsoft' },
103-
{ url: 'https://www.amazon.com', title: 'Amazon' },
104-
];
105-
106-
const launchTest = (mode: 'together' | 'onSwitchToTab') => {
107-
loadOrder.length = 0;
108-
Navigation.setRoot({
109-
root: {
110-
bottomTabs: {
111-
id: 'TabsTest',
112-
options: { bottomTabs: { tabsAttachMode: mode, titleDisplayMode: 'alwaysShow' } },
113-
children: TABS.map((item, i) => ({
114-
stack: {
115-
id: `Tab${i}`,
116-
children: [{ component: { name: 'TabsTogetherTest.WebViewTab', passProps: { tabIndex: i, ...item } } }],
117-
options: { bottomTab: { text: item.title, icon: require('../../img/layouts.png') } },
118-
},
119-
})),
120-
},
121-
},
122-
});
123-
};
124-
125-
export const launchTabsTogetherTest = () => launchTest('together');
126-
export const launchTabsOnSwitchTest = () => launchTest('onSwitchToTab');
100+
export const resetLoadOrder = () => { loadOrder.length = 0; };
127101

128102
const styles = StyleSheet.create({
129103
webview: { flex: 1 },

0 commit comments

Comments
 (0)