-
-
Notifications
You must be signed in to change notification settings - Fork 661
chore(test): test-tabs-native-container-style test screen with scenario #4134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LKuchno
wants to merge
13
commits into
main
Choose a base branch
from
@lkuchno/test-tabs-native-container-style
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+318
−0
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f70fcba
chore(test): test-tabs-native-container-style screen with scenario
LKuchno 713cbba
space added to ios18 ios26
LKuchno 3398aaa
adjustment after code review
LKuchno d3e1044
Merge branch 'main' of github.com:software-mansion/react-native-scree…
LKuchno e7a460c
index and scenario-description small adjustment after AI review
LKuchno dc59aa2
delete repeated informations
LKuchno d23fe90
changing tab name, config tab appearance for android and ios to check…
LKuchno d47ab69
adding tabBarItemActiveIndicatorEnabled: false to make android tab ba…
LKuchno 666acc4
Merge branch 'main' of github.com:software-mansion/react-native-scree…
LKuchno 3ab1582
chamging text on Transparent tab
LKuchno 59a2fd8
adding standardAppearance setting for ios Config tab
LKuchno b9cc395
removing unused styles
LKuchno 48deb26
fixing color expectation and indentation
LKuchno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
196 changes: 196 additions & 0 deletions
196
apps/src/tests/single-feature-tests/tabs/test-tabs-native-container-style/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| import { | ||
| TabsContainerWithHostConfigContext, | ||
| type TabRouteConfig, | ||
| useTabsHostConfig, | ||
| DEFAULT_TAB_ROUTE_OPTIONS, | ||
| } from '@apps/shared/gamma/containers/tabs'; | ||
| import React from 'react'; | ||
| import { | ||
| View, | ||
| Text, | ||
| ScrollView, | ||
| StyleSheet, | ||
| type ColorValue, | ||
| } from 'react-native'; | ||
| import { scenarioDescription } from './scenario-description'; | ||
| import { createScenario } from '@apps/tests/shared/helpers'; | ||
| import { SettingsPicker } from '@apps/shared'; | ||
| import { Colors } from '@apps/shared/styling'; | ||
| type ContainerBackgroundOption = 'unset' | 'blue' | 'yellow' | 'purple'; | ||
|
|
||
| function ConfigScreen() { | ||
| const { hostConfig, updateHostConfig } = useTabsHostConfig(); | ||
|
|
||
| const getBackgroundColor = ( | ||
| option: ContainerBackgroundOption, | ||
| ): ColorValue | undefined => { | ||
| switch (option) { | ||
| case 'blue': | ||
| return Colors.BlueLight100; | ||
| case 'yellow': | ||
| return Colors.YellowLight100; | ||
| case 'purple': | ||
| return Colors.PurpleLight100; | ||
| case 'unset': | ||
| default: | ||
| return undefined; | ||
| } | ||
| }; | ||
|
|
||
| const currentOption = (() => { | ||
| const bgColor = hostConfig.nativeContainerStyle?.backgroundColor; | ||
| if (bgColor === Colors.BlueLight100) return 'blue'; | ||
| if (bgColor === Colors.YellowLight100) return 'yellow'; | ||
| if (bgColor === Colors.PurpleLight100) return 'purple'; | ||
| return 'unset'; | ||
| })(); | ||
|
|
||
| return ( | ||
| <ScrollView style={styles.container} contentContainerStyle={styles.content}> | ||
| <View style={styles.section}> | ||
| <Text style={styles.heading}>nativeContainerStyle</Text> | ||
| <Text style={styles.description}> | ||
| Controls the background color of the native container. | ||
| </Text> | ||
| </View> | ||
|
|
||
| <View style={styles.section}> | ||
| <Text style={styles.text}> | ||
| {'•'} On <Text style={{ fontWeight: '600' }}>Android</Text>: Color is | ||
| applied to the FrameLayout that wraps the focused screen and | ||
| BottomNavigationView | ||
| </Text> | ||
| </View> | ||
|
|
||
| <View style={styles.section}> | ||
| <Text style={styles.text}> | ||
| {'•'} On <Text style={{ fontWeight: '600' }}>iOS</Text>: Color is | ||
| applied to the UITabBarController's view | ||
| </Text> | ||
| </View> | ||
|
|
||
| <View style={styles.section}> | ||
| <Text style={styles.heading}>Background Color</Text> | ||
| <SettingsPicker<ContainerBackgroundOption> | ||
| label="backgroundColor" | ||
| value={currentOption} | ||
| onValueChange={option => { | ||
| updateHostConfig({ | ||
| nativeContainerStyle: { | ||
| backgroundColor: getBackgroundColor(option), | ||
| }, | ||
| }); | ||
| }} | ||
| items={['unset', 'blue', 'yellow', 'purple']} | ||
| /> | ||
| </View> | ||
| </ScrollView> | ||
| ); | ||
| } | ||
|
|
||
| function TabScreen() { | ||
| return ( | ||
| <View style={styles.centeredContent}> | ||
| <Text style={styles.contentLabel}>Transparent Tab</Text> | ||
| <Text style={styles.contentHint}> | ||
| Observe the container background color behind the tab content and within the tab bar area. | ||
| </Text> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| const ROUTE_CONFIGS: TabRouteConfig[] = [ | ||
| { | ||
| name: 'Config', | ||
| Component: ConfigScreen, | ||
| options: { | ||
| ...DEFAULT_TAB_ROUTE_OPTIONS, | ||
| title: 'Config', | ||
| ios: { | ||
| ...DEFAULT_TAB_ROUTE_OPTIONS.ios, | ||
| scrollEdgeAppearance: { | ||
| tabBarBackgroundColor: Colors.RedDark100, | ||
| }, | ||
| standardAppearance: { | ||
| tabBarBackgroundColor: Colors.RedDark100, | ||
| }, | ||
| }, | ||
|
Comment on lines
+109
to
+117
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| android: { | ||
| ...DEFAULT_TAB_ROUTE_OPTIONS.android, | ||
| standardAppearance: { | ||
| tabBarBackgroundColor: Colors.RedDark100, | ||
| tabBarItemActiveIndicatorEnabled: false, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| { | ||
| name: 'Transparent', | ||
| Component: TabScreen, | ||
| options: { | ||
| ...DEFAULT_TAB_ROUTE_OPTIONS, | ||
| title: 'Transparent', | ||
| android: { | ||
| ...DEFAULT_TAB_ROUTE_OPTIONS.android, | ||
| standardAppearance: { | ||
| tabBarBackgroundColor: 'transparent', | ||
| tabBarItemActiveIndicatorEnabled: false, | ||
| }, | ||
| }, | ||
| }, | ||
|
LKuchno marked this conversation as resolved.
|
||
| }, | ||
| ]; | ||
|
|
||
| export function App() { | ||
| return <TabsContainerWithHostConfigContext routeConfigs={ROUTE_CONFIGS} />; | ||
| } | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| flex: 1, | ||
| paddingTop: 18, | ||
| }, | ||
| content: { | ||
| padding: 16, | ||
| }, | ||
| section: { | ||
| marginBottom: 16, | ||
| }, | ||
| heading: { | ||
| fontSize: 18, | ||
| fontWeight: '600', | ||
| color: Colors.OffNavy, | ||
| marginBottom: 8, | ||
| }, | ||
| description: { | ||
| fontSize: 14, | ||
| color: Colors.LightOffNavy, | ||
| marginBottom: 8, | ||
| }, | ||
| text: { | ||
| fontSize: 13, | ||
| color: Colors.LightOffNavy, | ||
| lineHeight: 20, | ||
| }, | ||
| centeredContent: { | ||
| flex: 1, | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| paddingHorizontal: 24, | ||
| gap: 12, | ||
| }, | ||
| contentLabel: { | ||
| fontSize: 18, | ||
| fontWeight: '600', | ||
| color: Colors.OffNavy, | ||
| textAlign: 'center', | ||
| }, | ||
| contentHint: { | ||
| fontSize: 13, | ||
| color: Colors.LightOffNavy, | ||
| textAlign: 'center', | ||
| lineHeight: 20, | ||
| }, | ||
| }); | ||
|
|
||
| export default createScenario(App, scenarioDescription); | ||
11 changes: 11 additions & 0 deletions
11
.../tests/single-feature-tests/tabs/test-tabs-native-container-style/scenario-description.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import type { ScenarioDescription } from '@apps/tests/shared/helpers'; | ||
|
|
||
| export const scenarioDescription: ScenarioDescription = { | ||
| name: 'Native Container Style', | ||
| key: 'test-tabs-native-container-style', | ||
| details: | ||
| 'Tests the nativeContainerStyle prop with backgroundColor variations on TabsHost.', | ||
| platforms: ['android', 'ios'], | ||
| e2eCoverage: 'incomplete', | ||
| smokeTest: false, | ||
| }; |
109 changes: 109 additions & 0 deletions
109
...rc/tests/single-feature-tests/tabs/test-tabs-native-container-style/scenario.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Test Scenario: nativeContainerStyle | ||
|
|
||
| ## Details | ||
|
|
||
| **Description:** Verifies the `nativeContainerStyle` prop on `TabsHost`, | ||
| which allows customising the background color of the native container | ||
| wrapping the tabs. The test validates that setting `backgroundColor` | ||
| via the picker applies the color to the correct native surface on each | ||
| platform, that the color persists when switching between tabs, and that | ||
| restoring `unset` returns the container to the system default. The prop | ||
| is a host-level setting: it is not per-route. | ||
|
|
||
| **OS test creation version:** iOS: 18.6 and 26.5, Android: API Level 36. | ||
|
|
||
| ## E2E test | ||
|
|
||
| Incomplete: Not automated. Detox cannot assert native background-color | ||
| attributes on either platform, so visual verification must be done | ||
| manually. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - iOS device or simulator | ||
| - Android emulator or device | ||
|
|
||
| ## Note | ||
|
|
||
| - On iOS the color fills the area behind the content screen and around | ||
| the tab bar (the full `UITabBarController` view). | ||
| - On Android the color fills the `FrameLayout` that wraps currently focused | ||
| screen and the `BottomNavigationView`. | ||
| - On Android and iOS 18 and earlier, the tab bar may obscures the color unless | ||
| a transparent or semi-transparent background is configured. | ||
| - On iOS 26, while the "liquid glass" tab bar partially obscures the color, it | ||
| remains inherently visible through the material. | ||
|
|
||
| ## Steps | ||
|
|
||
| ### Baseline | ||
|
|
||
| 1. Launch the app and navigate to **Native Container Style**. | ||
|
|
||
| - [ ] The **Config** tab is active. The `backgroundColor` | ||
| picker shows `unset`. | ||
| - [ ] The container background is the system default (no custom color visible). | ||
| - [ ] Tab bar background is red. | ||
| - [ ] **iOS 26:** The system default color is visible through the liquid glass tab bar. | ||
|
|
||
| --- | ||
|
|
||
| ### Setting backgroundColor to blue and yellow | ||
|
|
||
| 2. On the **Config** tab, set the `backgroundColor` picker to `blue`. | ||
|
|
||
| - [ ] The picker displays `blue`. The native container's background changes to blue. | ||
| - [ ] The blue color is visible behind the tab content area. | ||
| - [ ] The tab bar retains red color. | ||
| - [ ] **iOS 26:** The blue color is visible through the liquid glass tab bar. | ||
|
|
||
| 3. Tap the **Transparent** tab in the tab bar. | ||
|
|
||
| - [ ] The **Transparent** screen content is displayed (featuring the "Transparent Tab" label and | ||
| hint text). | ||
| - [ ] The container background remains blue. | ||
| - [ ] The tab bar is transparent, making the blue background visible behind the tabs. | ||
| - [ ] **iOS 26:** The appearance of the tab bar area is identical to the previous step. | ||
|
|
||
| 4. Tap the **Config** tab to switch back. | ||
|
|
||
| - [ ] The **Config** tab is shown again. | ||
| - [ ] The blue container background persists. | ||
|
|
||
| 5. Set the `backgroundColor` picker to `yellow`. | ||
|
|
||
| - [ ] The yellow color is visible behind the tab content area. | ||
| - [ ] The tab bar retains red color. | ||
| - [ ] **iOS 26:** The yellow color is visible through the liquid glass tab bar. | ||
|
|
||
| 6. Tap the **Transparent** tab, observe the background, then return to **Config**. | ||
|
|
||
| - [ ] The container background remains yellow. | ||
| - [ ] The tab bar is transparent, making the yellow background visible behind the tabs. | ||
| - [ ] **iOS 26:** The appearance of the tab bar area is identical to the previous step. | ||
|
|
||
| --- | ||
|
|
||
| ### Restoring to unset | ||
|
|
||
| 7. Return to **Config** and set the `backgroundColor` picker back to `unset`. | ||
|
|
||
| - [ ] The container background returns to the system default. | ||
| - [ ] The tab bar retains red color. | ||
| - [ ] **iOS 26:** The system default color is visible through the liquid glass tab bar. | ||
|
|
||
| 8. Tap the **Transparent** tab and observe the background. | ||
|
|
||
| - [ ] The **Transparent** screen appears with the system-default container background. | ||
| - [ ] No color remnant from the previous `yellow` value is visible. | ||
|
|
||
| --- | ||
|
|
||
| ### Rapid color cycling (edge case) | ||
|
|
||
| 9. From the **Config** tab, cycle the `backgroundColor` picker rapidly | ||
| through `blue` → `yellow` → `purple` → `unset` → `blue`. | ||
|
|
||
| - [ ] The container background updates with each selection. | ||
| - [ ] No crash, no layout freeze, and no color bleed between selections. | ||
| - [ ] The final displayed color is blue. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.