Skip to content
Merged
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
30 changes: 30 additions & 0 deletions apps/src/tests/Test3425.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { useState } from 'react';
import { Button, View } from 'react-native';
import Colors from '../shared/styling/Colors';
import { TestBottomTabs } from '.';

export default function App() {
const [index, setIndex] = useState(0);
return (
<View
style={{
flex: 1,
paddingHorizontal: 20,
paddingVertical: 100,
backgroundColor: Colors.BlueLight40,
}}>
{index === 0 ? (
<View
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
}}>
<Button title="Go to Bottom Tabs" onPress={() => setIndex(1)} />
</View>
) : (
<TestBottomTabs />
)}
</View>
);
}
1 change: 1 addition & 0 deletions apps/src/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,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 Test3425 } from './Test3425';
export { default as TestScreenAnimation } from './TestScreenAnimation';
export { default as TestScreenAnimationV5 } from './TestScreenAnimationV5';
export { default as TestHeader } from './TestHeader';
Expand Down
11 changes: 11 additions & 0 deletions ios/bottom-tabs/host/RNSBottomTabsHostComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ - (void)reactAddControllerToClosestParent:(UIViewController *)controller
if (parentView.reactViewController) {
[parentView.reactViewController addChildViewController:controller];
[self addSubview:controller.view];

// Enable auto-layout to ensure valid size of tabBarController.view.
// In host tree, tabBarController.view is the only child of HostComponentView.
controller.view.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[
[controller.view.topAnchor constraintEqualToAnchor:self.topAnchor],
[controller.view.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
[controller.view.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[controller.view.trailingAnchor constraintEqualToAnchor:self.trailingAnchor]
]];

[controller didMoveToParentViewController:parentView.reactViewController];
break;
}
Expand Down
Loading