Skip to content

Commit eb84e43

Browse files
committed
react-native(HeaderBase): wrap title in flex-1 container to preserve centering with ReactNode children; import TextVariant from @metamask/design-system-shared per shared import rules
1 parent 08349aa commit eb84e43

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

  • packages/design-system-react-native/src/components/HeaderBase

packages/design-system-react-native/src/components/HeaderBase/HeaderBase.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
88
// External dependencies.
99
import { ButtonIcon, ButtonIconSize } from '../ButtonIcon';
1010
import { TextOrChildren } from '../temp-components/TextOrChildren';
11-
import { TextVariant } from '../Text';
11+
import { TextVariant } from '@metamask/design-system-shared';
1212

1313
import type { HeaderBaseProps } from './HeaderBase.types';
1414

@@ -146,18 +146,20 @@ export const HeaderBase: React.FC<HeaderBaseProps> = ({
146146
})}
147147

148148
{/* Title */}
149-
<TextOrChildren
150-
textProps={{
151-
variant: TextVariant.HeadingSm,
152-
...textProps,
153-
style: [
154-
tw.style('text-center flex-1 items-center'),
155-
textProps?.style,
156-
],
157-
}}
158-
>
159-
{children}
160-
</TextOrChildren>
149+
<View style={tw.style('flex-1 items-center')}>
150+
<TextOrChildren
151+
textProps={{
152+
variant: TextVariant.HeadingSm,
153+
...textProps,
154+
style: [
155+
tw.style('text-center flex-1 items-center'),
156+
textProps?.style,
157+
],
158+
}}
159+
>
160+
{children}
161+
</TextOrChildren>
162+
</View>
161163

162164
{/* End accessory */}
163165
{renderAccessoryWrapper({

0 commit comments

Comments
 (0)