// Metro module 5591 (f5592).
import { useState } from "react";
import * as _Module17 from "react-native";
import { Animated, Image as Image2, View } from "react-native";
import { useTheme } from "./Module1481";
import * as _Module5580 from "./Module5580";
import PlatformPressable from "./PlatformPressable_5594";
const { I18nManager, Platform, StyleSheet } = _Module17;
const android_ripple = {
borderless: true,
foreground: Platform.Version >= 23,
radius: 20
};
const isRTL = I18nManager.getConstants().isRTL;
let scaleX2 = 1;
const scaleX = isRTL ? -1 : 1;
if (I18nManager.getConstants().isRTL) {
scaleX2 = -1;
}
const styles = StyleSheet.create({
container: {
alignItems: "center",
flexDirection: "row",
minWidth: StyleSheet.hairlineWidth,
marginVertical: 3,
marginHorizontal: 11
},
disabled: {
opacity: 0.5
},
label: {
fontSize: 17,
letterSpacing: 0.35
},
labelWrapper: {
flexDirection: "row",
alignItems: "flex-start"
},
icon: {
height: 24,
width: 24,
margin: 3,
resizeMode: "contain",
transform: [{
scaleX
}]
},
iconWithLabel: {},
iconMaskContainer: {
flex: 1,
flexDirection: "row",
justifyContent: "center"
},
iconMaskFillerRect: {
flex: 1,
backgroundColor: "#000"
},
iconMask: {
height: 21,
width: 13,
marginLeft: -14.5,
marginVertical: 12,
alignSelf: "center",
resizeMode: "contain",
transform: [{
scaleX: scaleX2
}]
}
});
export default function HeaderBackButton(props) {
let r74, children;
let disabled = props.disabled;
const { allowFontScaling, backImage, label, labelStyle, labelVisible = false, onLabelLayout, onPress, pressColor, pressOpacity, screenLayout } = props;
let tintColor = props.tintColor;
const { titleLayout, truncatedLabel = "Back", accessibilityLabel = label ? label !== "Back" ? `${label}, back` : "Go back" : "Go back", testID, style } = props;
const colors = useTheme().colors;
const [state, setState] = useState(void 0);
if (tintColor === void 0) {
tintColor = colors.text;
}
const props2 = {
disabled,
accessible: true,
accessibilityRole: "button",
accessibilityLabel,
testID,
onPress: disabled ? void 0 : () => onPress ? requestAnimationFrame(onPress) : onPress,
pressColor,
pressOpacity,
android_ripple,
style: null,
hitSlop: null,
children: null
};
const style2 = [styles.container, , ,];
if (disabled) {
disabled = styles.disabled;
}
style2[1] = disabled;
style2[2] = style;
props2.style = style2;
props2.hitSlop = {
top: 16,
right: 16,
bottom: 16,
left: 16
};
const r72 = backImage ? backImage({
tintColor
}) : ;
L28: {
r74 = [r72, ,];
children = truncatedLabel;
if (label) {
if (state && titleLayout && screenLayout) {
const r1 = (screenLayout.width - titleLayout.width) / 2;
const r79 = state + 26;
children = truncatedLabel;
if (r1 < r79) {
break L28;
}
}
children = label;
}
}
r74[1] = labelVisible ? children !== void 0 ?
{
if (onLabelLayout != null) {
onLabelLayout(a0);
}
setState(a0.nativeEvent.layout.x + a0.nativeEvent.layout.width);
} : void 0} style={[styles.label, tintColor ? {
color: tintColor
} : null, labelStyle]} numberOfLines={1} allowFontScaling={!!allowFontScaling}>{children}
: null : null;
props2.children = <>{r74}>;
return ;
};