diff --git a/packages/sandbox/e2e/android/screenshots/NavigationBarTrail.png b/packages/sandbox/e2e/android/screenshots/NavigationBarTrail.png
index 9cba2c9d..9abbd548 100644
Binary files a/packages/sandbox/e2e/android/screenshots/NavigationBarTrail.png and b/packages/sandbox/e2e/android/screenshots/NavigationBarTrail.png differ
diff --git a/packages/sandbox/e2e/ios/screenshots/NavigationBarTrail.png b/packages/sandbox/e2e/ios/screenshots/NavigationBarTrail.png
index 87ae69f7..8e79e783 100644
Binary files a/packages/sandbox/e2e/ios/screenshots/NavigationBarTrail.png and b/packages/sandbox/e2e/ios/screenshots/NavigationBarTrail.png differ
diff --git a/packages/sandbox/src/app/sandbox/docs/navigation-bar-trail.doc.tsx b/packages/sandbox/src/app/sandbox/docs/navigation-bar-trail.doc.tsx
index 63bc0536..527c7790 100644
--- a/packages/sandbox/src/app/sandbox/docs/navigation-bar-trail.doc.tsx
+++ b/packages/sandbox/src/app/sandbox/docs/navigation-bar-trail.doc.tsx
@@ -20,6 +20,10 @@ const right: NavigationBarTrailProps['right'] = {
},
};
+const title = 'Title';
+const longTitle =
+ 'Super long title that should be truncated even when there is no other stuff';
+
const action = {
title: 'Action',
onPress: async () => {
@@ -31,14 +35,14 @@ const docs: JSX.Element[] = [
appearance="primary"
left={{ ...left, type: 'close' }}
right={right}
- title="Title"
+ title={title}
action={action}
/>,
,
@@ -47,7 +51,7 @@ const docs: JSX.Element[] = [
left={left}
right={right}
backgroundColor="BLUKO_500"
- title="Title"
+ title={title}
action={action}
appearance="light"
/>,
@@ -62,10 +66,32 @@ const docs: JSX.Element[] = [
backgroundColor="ORANGE_700"
/>,
,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
];
export const NavigationBarTrailSandbox = () => ;
diff --git a/packages/streamline/src/components/navigation/navigation-bar-trail/navigation-bar-trail.tsx b/packages/streamline/src/components/navigation/navigation-bar-trail/navigation-bar-trail.tsx
index e7a5da87..5f82669d 100644
--- a/packages/streamline/src/components/navigation/navigation-bar-trail/navigation-bar-trail.tsx
+++ b/packages/streamline/src/components/navigation/navigation-bar-trail/navigation-bar-trail.tsx
@@ -1,13 +1,17 @@
-import { Pressable } from 'react-native';
+import { useState } from 'react';
+import { LayoutChangeEvent, Pressable } from 'react-native';
import { AnimatedBox } from '../../../primitives/animated-box/animated-box';
import { Box } from '../../../primitives/box/box';
import { Text } from '../../../primitives/text/text';
-import { ColorTheme } from '../../../theme';
+import { ColorTheme, useStreamlineTheme } from '../../../theme';
import ButtonIcon from '../../buttons/button-icon/button-icon';
import { ButtonIconProps } from '../../buttons/button-icon/button-icon.types';
import { getNavigationTrailTextColor } from './navigation-bar-trail.utils';
+const MIN_WIDTH = 40;
+const MIN_HEIGHT = 48;
+
export interface NavigationBarTrailProps {
title?: string;
left?: {
@@ -38,6 +42,19 @@ export const NavigationBarTrail = ({
const { titleColor, actionColor } = getNavigationTrailTextColor({
appearance,
});
+
+ const { spacing } = useStreamlineTheme();
+
+ const minWidth = left || right ? MIN_WIDTH + spacing.xs : spacing.md;
+
+ const [rightWidth, setRightWidth] = useState(minWidth);
+
+ const handleOnRightLayout = (event: LayoutChangeEvent) => {
+ const { width } = event.nativeEvent.layout;
+ const rightWidth = width ? width + spacing.xs : minWidth;
+ setRightWidth(rightWidth);
+ };
+
return (
-
+
-
+
{title}
@@ -69,7 +91,12 @@ export const NavigationBarTrail = ({
)}
-
+
{action ? (