96 lines
3.8 KiB
React
96 lines
3.8 KiB
React
// Metro module 4563 (f4564).
|
|
import { forwardRef, useRef, useContext, useImperativeHandle, useEffect } from "react";
|
|
import { Platform, StyleSheet } from "react-native";
|
|
import * as _Module4561 from "./Module4561";
|
|
import { useEdgeInsetApplication, EdgeInsetApplicationContext } from "./Module4552";
|
|
import warnOnce from "./warnOnce_4545";
|
|
import _default from "./_default_4564";
|
|
import { ScreenStackHeaderConfig } from "./Module4551";
|
|
import { FooterComponent } from "./ScreenFooter";
|
|
import Screen from "./Screen_4540";
|
|
let styles;
|
|
const r28 = forwardRef(function ScreenStackItem(props, a1) {
|
|
let current, ref3;
|
|
const { children, headerConfig, activityState, shouldFreeze, stackPresentation: _stackPresentation, sheetAllowedDetents, contentStyle, style, screenId, onHeaderHeightChange, unstable_sheetFooter, ...props2 } = props;
|
|
let stackPresentation = props.stackPresentation;
|
|
current = void 0;
|
|
ref3 = void 0;
|
|
const ref2 = useRef(null);
|
|
const context = useContext(_Module4561.RNSScreensRefContext);
|
|
useImperativeHandle(a1, () => ref2.current);
|
|
let r42 = headerConfig?.disableLeftInsetApplication;
|
|
if (r42 == null) {
|
|
r42 = false;
|
|
}
|
|
let r44 = headerConfig?.disableRightInsetApplication;
|
|
if (r44 == null) {
|
|
r44 = false;
|
|
}
|
|
let r46 = headerConfig?.disableBottomInsetApplication;
|
|
if (r46 == null) {
|
|
r46 = false;
|
|
}
|
|
const nextContextValue = useEdgeInsetApplication(r42, r44, r46).nextContextValue;
|
|
if (stackPresentation == null) {
|
|
stackPresentation = "push";
|
|
}
|
|
let r49 = headerConfig?.hidden;
|
|
if (r49 == null) {
|
|
r49 = false;
|
|
}
|
|
current = r49;
|
|
ref3 = useRef(current);
|
|
useEffect(() => {
|
|
warnOnce(false, "Dynamically changing header's visibility in modals will result in remounting the screen and losing all local state.");
|
|
ref3.current = current;
|
|
}, [current, stackPresentation]);
|
|
let r58 = props2?.scrollEdgeEffects === void 0 || Object.values(props2.scrollEdgeEffects).some((item) => item !== "hidden");
|
|
const r68 = headerConfig?.blurEffect !== void 0 && headerConfig.blurEffect !== "none";
|
|
if (r58) {
|
|
r58 = r68;
|
|
}
|
|
if (r58) {
|
|
r58 = false;
|
|
}
|
|
warnOnce(r58, "[RNScreens] Using both `blurEffect` and `scrollEdgeEffects` simultaneously may cause overlapping effects.");
|
|
Platform.constants.reactNativeVersion.minor;
|
|
const r113 = <>
|
|
{[<EdgeInsetApplicationContext.Provider value={nextContextValue}>
|
|
<_default contentStyle={contentStyle} style={stackPresentation !== "formSheet" ? styles.container : sheetAllowedDetents === "fitToContents" ? styles.absoluteWithNoBottom : styles.container} stackPresentation={stackPresentation}>{children}</_default>
|
|
</EdgeInsetApplicationContext.Provider>, <ScreenStackHeaderConfig {...headerConfig} />, stackPresentation === "formSheet" && unstable_sheetFooter && <FooterComponent>
|
|
{unstable_sheetFooter()}
|
|
</FooterComponent>]}
|
|
</>;
|
|
let hasLargeHeader = headerConfig?.largeTitle;
|
|
if (hasLargeHeader == null) {
|
|
hasLargeHeader = false;
|
|
}
|
|
return <Screen ref={(a0) => {
|
|
ref2.current = a0;
|
|
if (context !== null) {
|
|
const current2 = context.current;
|
|
if (a0 === null) {
|
|
delete current2[screenId];
|
|
} else {
|
|
current2[screenId] = {
|
|
current: a0
|
|
};
|
|
}
|
|
} else {
|
|
console.warn("Looks like RNSScreensRefContext is missing. Make sure the ScreenStack component is wrapped in it");
|
|
}
|
|
}} enabled isNativeStack activityState={activityState} shouldFreeze={shouldFreeze} screenId={screenId} stackPresentation={stackPresentation} hasLargeHeader={hasLargeHeader} sheetAllowedDetents={sheetAllowedDetents} style={[style, void 0]} onHeaderHeightChange={onHeaderHeightChange} {...props2}>{r113}</Screen>;
|
|
});
|
|
styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1
|
|
},
|
|
absoluteWithNoBottom: {
|
|
position: "absolute",
|
|
top: 0,
|
|
start: 0,
|
|
end: 0
|
|
}
|
|
});
|
|
export default r28;
|