Files
discord-decomp/_bundle/HeaderConfig.jsx
T
2026-11-01 12:12:55 +02:00

126 lines
7.0 KiB
React

// Metro module 9113 (f9114).
import { I18nManager, StyleSheet, View, Platform } from "react-native";
import { useTheme } from "./Module1481";
import { processFonts } from "./Module9114";
import { getHeaderTitle, HeaderTitle } from "./Module5579";
import useNavigationHeaderAccessibilityRefreshKey from "./useNavigationHeaderAccessibilityRefreshKey";
import * as _Module4536 from "./Module4536";
import { isSearchBarAvailableForCurrentPlatform, isNewBackTitleImplementation, ScreenStackHeaderCenterView, ScreenStackHeaderConfig, ScreenStackHeaderBackButtonImage, ScreenStackHeaderRightView, ScreenStackHeaderSearchBarView } from "./Module4536";
Platform;
const styles = StyleSheet.create({
row: {
flexDirection: "row",
alignItems: "center"
}
});
export default function HeaderConfig(props) {
let r156, ScreenStackHeaderLeftView;
const { headerBackImageSource, headerBackButtonMenuEnabled, headerBackTitle, headerBackTitleStyle, headerBackTitleVisible = true, headerBackVisible, headerShadowVisible, headerLargeStyle, headerLargeTitle, headerLargeTitleShadowVisible, headerLargeTitleStyle, headerBackground, headerLeft, headerRight, headerShown, headerStyle, headerBlurEffect, headerTintColor, headerTitle, headerTitleAlign, headerTitleStyle } = props;
let headerTransparent = props.headerTransparent;
const { headerSearchBarOptions, headerTopInsetEnabled, UNSTABLE_headerInsets, route, title, canGoBack } = props;
const colors = useTheme().colors;
const tintColor = headerTintColor == null ? colors.text : headerTintColor;
const r41 = StyleSheet.flatten(headerBackTitleStyle) || {};
const r30 = StyleSheet.flatten(headerLargeTitleStyle) || {};
const r59 = StyleSheet.flatten(headerTitleStyle) || {};
const r44 = StyleSheet.flatten(headerStyle) || {};
const r32 = StyleSheet.flatten(headerLargeStyle) || {};
const [backTitleFontFamily, largeTitleFontFamily, titleFontFamily] = processFonts([r41.fontFamily, r30.fontFamily, r59.fontFamily]);
const headerTitle2 = getHeaderTitle({
title,
headerTitle
}, route.name);
let color = r59.color;
if (color == null) {
color = headerTintColor;
}
if (color == null) {
color = colors.text;
}
const { fontSize, fontWeight } = r59;
const style = {
color
};
if (r59.fontFamily != null) {
style.fontFamily = r59.fontFamily;
}
if (fontSize != null) {
style.fontSize = fontSize;
}
if (fontWeight != null) {
style.fontWeight = fontWeight;
}
const r84 = headerLeft == null ? void 0 : headerLeft({
tintColor,
canGoBack,
label: headerBackTitle
});
const r87 = headerRight == null ? void 0 : headerRight({
tintColor,
canGoBack
});
let r89 = typeof headerTitle === "function" ? headerTitle({
tintColor,
children: headerTitle2
}) : null;
useNavigationHeaderAccessibilityRefreshKey();
const r98 = typeof isSearchBarAvailableForCurrentPlatform === "boolean" ? isSearchBarAvailableForCurrentPlatform : typeof isSearchBarAvailableForCurrentPlatform === "boolean";
const r101 = r98 && headerSearchBarOptions != null;
if (headerSearchBarOptions != null && !r98) {
throw new Error("The current version of 'react-native-screens' doesn't support SearchBar in the header. Please update to the latest version to use this option.");
}
const backButtonInCustomView = headerBackVisible ? r84 != null : r89 != null;
const r108 = headerBackground != null || headerTransparent || (r101 || headerLargeTitle) && false;
let backgroundColor = r44.backgroundColor;
if (backgroundColor == null) {
backgroundColor = headerBackground != null ? "transparent" : headerTransparent ? "transparent" : colors.card;
}
const backTitle = isNewBackTitleImplementation ? headerBackTitle : headerBackTitleVisible ? headerBackTitle : " ";
const direction = I18nManager.getConstants().isRTL ? "rtl" : "ltr";
let hideShadow = headerShadowVisible === false || headerBackground != null;
if (!hideShadow) {
if (headerTransparent) {
headerTransparent = headerShadowVisible !== true;
}
hideShadow = headerTransparent;
}
const disableBottomInsetApplication = UNSTABLE_headerInsets?.bottom !== void 0 ? !UNSTABLE_headerInsets.bottom : void 0;
if (r84 == null) {
r156 = null;
if (typeof headerTitle === "function") {
ScreenStackHeaderLeftView = _Module4536.ScreenStackHeaderLeftView;
r156 = <ScreenStackHeaderLeftView>
<View style={styles.row}>
{r84}
{headerTitleAlign !== "center" ? typeof headerTitle !== "function" ? <HeaderTitle tintColor={tintColor} style={style}>{headerTitle2}</HeaderTitle> : r89 : null}
</View>
</ScreenStackHeaderLeftView>;
}
} else {
ScreenStackHeaderLeftView = _Module4536.ScreenStackHeaderLeftView;
r156 = <ScreenStackHeaderLeftView>
<View style={styles.row}>
{r84}
{headerTitleAlign !== "center" ? typeof headerTitle !== "function" ? <HeaderTitle tintColor={tintColor} style={style}>{headerTitle2}</HeaderTitle> : r89 : null}
</View>
</ScreenStackHeaderLeftView>;
}
const r175 = [r156, ,];
let r177 = null;
if (headerTitleAlign === "center") {
if (typeof headerTitle !== "function") {
r89 = <HeaderTitle tintColor={tintColor} style={style}>{headerTitle2}</HeaderTitle>;
}
r177 = <ScreenStackHeaderCenterView>{r89}</ScreenStackHeaderCenterView>;
}
r175[1] = r177;
return <ScreenStackHeaderConfig backButtonInCustomView={backButtonInCustomView} backgroundColor={backgroundColor} backTitle={backTitle} backTitleVisible={headerBackTitleVisible} backTitleFontFamily={backTitleFontFamily} backTitleFontSize={r41.fontSize} blurEffect={headerBlurEffect} color={tintColor} direction={direction} disableBackButtonMenu={headerBackButtonMenuEnabled === false} hidden={headerShown === false} hideBackButton={headerBackVisible === false} hideShadow={hideShadow} largeTitle={headerLargeTitle} largeTitleBackgroundColor={r32.backgroundColor} largeTitleColor={r30.color} largeTitleFontFamily={largeTitleFontFamily} largeTitleFontSize={r30.fontSize} largeTitleFontWeight={r30.fontWeight} largeTitleHideShadow={headerLargeTitleShadowVisible === false} title={headerTitle2} titleColor={color} titleFontFamily={titleFontFamily} titleFontSize={fontSize} titleFontWeight={fontWeight} topInsetEnabled={headerTopInsetEnabled} disableTopInsetApplication={UNSTABLE_headerInsets?.top !== void 0 ? !UNSTABLE_headerInsets.top : void 0} disableLeftInsetApplication={UNSTABLE_headerInsets?.left !== void 0 ? !UNSTABLE_headerInsets.left : void 0} disableRightInsetApplication={UNSTABLE_headerInsets?.right !== void 0 ? !UNSTABLE_headerInsets.right : void 0} disableBottomInsetApplication={disableBottomInsetApplication} translucent={r108 === true}>
<>{r175}</>
{headerBackImageSource !== void 0 ? <ScreenStackHeaderBackButtonImage source={headerBackImageSource} /> : null}
{r87 != null ? <ScreenStackHeaderRightView>{r87}</ScreenStackHeaderRightView> : null}
{r101 ? <ScreenStackHeaderSearchBarView>
<_Module4536.SearchBar {...headerSearchBarOptions} />
</ScreenStackHeaderSearchBarView> : null}
</ScreenStackHeaderConfig>;
};