Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,10 @@ class TabsHost(

appearanceCoordinator.updateTabAppearance(this)

bottomNavigationView.selectedItemId =
checkNotNull(getSelectedTabScreenFragmentId()) { "[RNScreens] A single selected tab must be present" }
val selectedItemId = checkNotNull(getSelectedTabScreenFragmentId()) { "[RNScreens] A single selected tab must be present" }
if (selectedItemId != bottomNavigationView.selectedItemId) {
bottomNavigationView.selectedItemId = selectedItemId
}

post {
refreshLayout()
Expand Down
61 changes: 61 additions & 0 deletions apps/src/tests/Test3384.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { NavigationContainer, useNavigation } from '@react-navigation/native';
import React from 'react'
import { BottomTabsContainer } from '../shared/gamma/containers/bottom-tabs/BottomTabsContainer';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { Alert, Button, Text, View } from 'react-native';

function ModalScreen() {
return <Text>Modal</Text>
}

function Tab1() {
const navigation = useNavigation()

return <View>
<Text>Tab 1</Text>
<Button title='Open Modal' onPress={() => navigation.navigate('Modal' as never)} />
</View>
}

function Tab2() {
return <View>
<Text>Tab 2</Text>
</View>
}

function BottomTabs() {
return <BottomTabsContainer
onNativeFocusChange={() => Alert.alert("Native focus change called")}
tabConfigs={[{
component: Tab1,
tabScreenProps: { tabKey: 'tab1', title: 'Tab 1' }
}, {
component: Tab2,
tabScreenProps: { tabKey: 'tab2', title: 'Tab 2' }
}]}
/>
}

const Stack = createNativeStackNavigator();

function App() {

return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name='BottomTabs'
component={BottomTabs}
options={{ title: 'Test3384' }}
/>
<Stack.Screen
name='Modal'
component={ModalScreen}
options={{ presentation: 'modal' }}
/>
</Stack.Navigator>
</NavigationContainer>
);
}

export default App;
1 change: 1 addition & 0 deletions apps/src/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export { default as Test3342 } from './Test3342';
export { default as Test3346 } from './Test3346';
export { default as Test3369 } from './Test3369';
export { default as Test3379 } from './Test3379';
export { default as Test3384 } from './Test3384';
export { default as TestScreenAnimation } from './TestScreenAnimation';
export { default as TestScreenAnimationV5 } from './TestScreenAnimationV5';
export { default as TestHeader } from './TestHeader';
Expand Down