one
Version:
One is a new React Framework that makes Vite serve both native and web.
46 lines (45 loc) • 1.75 kB
JavaScript
import { NAVIGATOR_CONFIG } from "../../headless/children.mjs";
import { PLATFORM } from "../../utils/platform.mjs";
import { convertFontWeightToStringFontWeight, flattenStyle } from "../../utils/style.mjs";
function StackHeaderTitle(_props) {
return null;
}
Object.assign(StackHeaderTitle, {
[NAVIGATOR_CONFIG]: true
});
function appendStackHeaderTitlePropsToOptions(options, props) {
const flattenedStyle = flattenStyle(props.style);
const flattenedLargeStyle = flattenStyle(props.largeStyle);
const titleStyle = flattenedStyle ? {
...flattenedStyle,
...(flattenedStyle?.fontWeight ? {
fontWeight: convertFontWeightToStringFontWeight(flattenedStyle.fontWeight)
} : {})
} : void 0;
const largeTitleStyle = flattenedLargeStyle ? {
...flattenedLargeStyle,
...(flattenedLargeStyle?.fontWeight ? {
fontWeight: convertFontWeightToStringFontWeight(flattenedLargeStyle.fontWeight)
} : {})
} : void 0;
return {
...options,
title: props.children,
headerLargeTitle: props.large,
// Large titles on iOS require headerTransparent for proper scroll behavior
// Only set on iOS since headerLargeTitle is iOS-only
...(props.large && PLATFORM === "ios" && {
headerTransparent: true
}),
headerTitleAlign: flattenedStyle?.textAlign,
// Only set styles when explicitly configured to avoid interfering with native defaults
...(titleStyle && Object.keys(titleStyle).length > 0 && {
headerTitleStyle: titleStyle
}),
...(largeTitleStyle && Object.keys(largeTitleStyle).length > 0 && {
headerLargeTitleStyle: largeTitleStyle
})
};
}
export { StackHeaderTitle, appendStackHeaderTitlePropsToOptions };
//# sourceMappingURL=StackHeaderTitle.mjs.map