Skip to content

Commit ba243b3

Browse files
authored
refactor(test): Changed indentation spaces and updated the style using StyleSheet (#3887)
## Description Updated existing screens based on remarks from #3881 (comment) and #3881 (comment) to align the code with best practices. ## Changes: For **test-tabs-tab-bar-controller-mode-ios** and **test-tabs-tab-bar-minimize-behavior-ios** screens: - Adjusted indentation: Switched from 4 to 2 spaces. - Refactored styling: Updated style definitions to use StyleSheet.create.
1 parent b9fafba commit ba243b3

2 files changed

Lines changed: 193 additions & 193 deletions

File tree

  • apps/src/tests/single-feature-tests/tabs
    • test-tabs-tab-bar-controller-mode-ios
    • test-tabs-tab-bar-minimize-behavior-ios
Lines changed: 98 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,125 @@
11
import {
2-
TabsContainerWithHostConfigContext,
3-
type TabRouteConfig,
4-
useTabsHostConfig,
5-
DEFAULT_TAB_ROUTE_OPTIONS,
2+
TabsContainerWithHostConfigContext,
3+
type TabRouteConfig,
4+
useTabsHostConfig,
5+
DEFAULT_TAB_ROUTE_OPTIONS,
66
} from '@apps/shared/gamma/containers/tabs';
77
import React from 'react';
88
import { View, Text, ScrollView, StyleSheet } from 'react-native';
99
import { Scenario } from '@apps/tests/shared/helpers';
1010
import { SettingsPicker } from '@apps/shared';
11-
import {TabBarControllerMode } from 'react-native-screens';
11+
import { TabBarControllerMode } from 'react-native-screens';
1212

1313
const SCENARIO: Scenario = {
14-
name: 'Tab Bar Controller Mode',
15-
key: 'test-tabs-tab-bar-controller-mode-ios',
16-
details: 'Test different tab bar modes.',
17-
platforms: ['ios'],
18-
AppComponent: App,
14+
name: 'Tab Bar Controller Mode',
15+
key: 'test-tabs-tab-bar-controller-mode-ios',
16+
details: 'Test different tab bar modes.',
17+
platforms: ['ios'],
18+
AppComponent: App,
1919
};
2020

2121
export default SCENARIO;
2222

2323
function ConfigScreen() {
24-
const { hostConfig, updateHostConfig } = useTabsHostConfig();
25-
return (
26-
<ScrollView style={{ padding: 40 }}>
27-
<View>
28-
<Text style={styles.description}>
29-
Controls whether the tab bar is displayed as a bar or
30-
sidebar.{'\n'}Test tabSidebar on iPad — on iPhone it collapses
31-
back to a tab bar automatically.
32-
</Text>
33-
<SettingsPicker<TabBarControllerMode>
34-
label="tabBarControllerMode"
35-
value={hostConfig.ios?.tabBarControllerMode ?? 'automatic'}
36-
onValueChange={value =>
37-
updateHostConfig({ ios: { tabBarControllerMode: value } })
38-
}
39-
items={['automatic', 'tabBar', 'tabSidebar']}
40-
/>
41-
</View>
42-
</ScrollView >
43-
);
24+
const { hostConfig, updateHostConfig } = useTabsHostConfig();
25+
return (
26+
<ScrollView style={{ padding: 40 }}>
27+
<View>
28+
<Text style={styles.description}>
29+
Controls whether the tab bar is displayed as a bar or
30+
sidebar.{'\n'}Test tabSidebar on iPad — on iPhone it collapses
31+
back to a tab bar automatically.
32+
</Text>
33+
<SettingsPicker<TabBarControllerMode>
34+
label="tabBarControllerMode"
35+
value={hostConfig.ios?.tabBarControllerMode ?? 'automatic'}
36+
onValueChange={value =>
37+
updateHostConfig({ ios: { tabBarControllerMode: value } })
38+
}
39+
items={['automatic', 'tabBar', 'tabSidebar']}
40+
/>
41+
</View>
42+
</ScrollView >
43+
);
4444
}
4545

4646
function TestScreen() {
47-
return (
48-
<ScrollView
49-
style={{ flex: 1 }}
50-
contentInsetAdjustmentBehavior="automatic"
51-
testID="test-screen-scroll">
52-
{Array.from({ length: 40 }, (_, i) => (
53-
<View key={i} style={styles.scrollItem}>
54-
<Text>Row {i + 1} — scroll to test tabBarMinimizeBehavior</Text>
55-
</View>
56-
))}
57-
</ScrollView>
58-
);
47+
return (
48+
<ScrollView
49+
style={{ flex: 1 }}
50+
contentInsetAdjustmentBehavior="automatic"
51+
testID="test-screen-scroll">
52+
{Array.from({ length: 40 }, (_, i) => (
53+
<View key={i} style={styles.scrollItem}>
54+
<Text>Row {i + 1} — scroll to test tabBarMinimizeBehavior</Text>
55+
</View>
56+
))}
57+
</ScrollView>
58+
);
5959
};
6060

6161
const ROUTE_CONFIGS: TabRouteConfig[] = [
62-
{
63-
name: 'Tab1',
64-
Component: ConfigScreen,
65-
options: {
66-
...DEFAULT_TAB_ROUTE_OPTIONS,
67-
title: 'Tab1',
68-
},
62+
{
63+
name: 'Tab1',
64+
Component: ConfigScreen,
65+
options: {
66+
...DEFAULT_TAB_ROUTE_OPTIONS,
67+
title: 'Tab1',
6968
},
70-
{
71-
name: 'Tab2',
72-
Component: TestScreen,
73-
options: {
74-
...DEFAULT_TAB_ROUTE_OPTIONS,
75-
title: 'Tab2',
69+
},
70+
{
71+
name: 'Tab2',
72+
Component: TestScreen,
73+
options: {
74+
...DEFAULT_TAB_ROUTE_OPTIONS,
75+
title: 'Tab2',
7676

77-
},
7877
},
78+
},
7979
];
8080

8181
export function App() {
82-
return <TabsContainerWithHostConfigContext routeConfigs={ROUTE_CONFIGS} />;
82+
return <TabsContainerWithHostConfigContext routeConfigs={ROUTE_CONFIGS} />;
8383
};
8484

85-
const styles = {
86-
sectionHeader: {
87-
fontSize: 13,
88-
fontWeight: '600' as const,
89-
textTransform: 'uppercase' as const,
90-
color: '#888',
91-
letterSpacing: 0.5,
92-
marginTop: 24,
93-
marginBottom: 4,
94-
},
95-
description: {
96-
fontSize: 13,
97-
color: '#555',
98-
marginBottom: 6,
99-
marginTop: 12,
100-
textAlign: 'center' as const,
101-
},
102-
scrollItem: {
103-
padding: 16,
104-
borderBottomWidth: StyleSheet.hairlineWidth,
105-
borderBottomColor: '#e0e0e0',
106-
},
107-
centeredScreen: {
108-
flex: 1,
109-
justifyContent: 'center',
110-
alignItems: 'center',
111-
padding: 24,
112-
gap: 12,
113-
},
114-
screenLabel: {
115-
fontSize: 17,
116-
fontWeight: '600',
117-
textAlign: 'center',
118-
},
119-
screenHint: {
120-
fontSize: 14,
121-
color: '#555',
122-
textAlign: 'center',
123-
lineHeight: 20,
124-
},
125-
}
85+
const styles = StyleSheet.create({
86+
sectionHeader: {
87+
fontSize: 13,
88+
fontWeight: '600',
89+
textTransform: 'uppercase',
90+
color: '#888',
91+
letterSpacing: 0.5,
92+
marginTop: 24,
93+
marginBottom: 4,
94+
},
95+
description: {
96+
fontSize: 13,
97+
color: '#555',
98+
marginBottom: 6,
99+
marginTop: 12,
100+
textAlign: 'center',
101+
},
102+
scrollItem: {
103+
padding: 16,
104+
borderBottomWidth: StyleSheet.hairlineWidth,
105+
borderBottomColor: '#e0e0e0',
106+
},
107+
centeredScreen: {
108+
flex: 1,
109+
justifyContent: 'center',
110+
alignItems: 'center',
111+
padding: 24,
112+
gap: 12,
113+
},
114+
screenLabel: {
115+
fontSize: 17,
116+
fontWeight: '600',
117+
textAlign: 'center',
118+
},
119+
screenHint: {
120+
fontSize: 14,
121+
color: '#555',
122+
textAlign: 'center',
123+
lineHeight: 20,
124+
},
125+
});

0 commit comments

Comments
 (0)