40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
// Metro module 15837 (f15838).
|
|
import { useEffect } from "react";
|
|
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
|
|
import { useSharedValue } from "../../../reanimated/ReanimatedRexport";
|
|
let c11330_3 = "unknown";
|
|
export default function useScreenNameSharedValue() {
|
|
let r16;
|
|
const rootNavigationRef2 = getRootNavigationRef();
|
|
if ((rootNavigationRef2 == null ? void 0 : rootNavigationRef2.isReady()) === true) {
|
|
let r20 = rootNavigationRef2.getCurrentRoute()?.name;
|
|
if (r20 == null) {
|
|
r20 = c11330_3;
|
|
}
|
|
r16 = r20;
|
|
} else {
|
|
r16 = c11330_3;
|
|
}
|
|
const sharedValue = useSharedValue(r16);
|
|
useEffect(() => {
|
|
let rootNavigationRef;
|
|
const handleStateChange2 = function handleStateChange() {
|
|
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
|
|
let r11 = rootNavigationRef.getCurrentRoute()?.name;
|
|
if (r11 == null) {
|
|
r11 = "unknown";
|
|
}
|
|
sharedValue.set(r11);
|
|
}
|
|
};
|
|
rootNavigationRef = getRootNavigationRef();
|
|
if (rootNavigationRef != null) {
|
|
rootNavigationRef.addListener("state", handleStateChange2);
|
|
return () => {
|
|
rootNavigationRef.removeListener("state", handleStateChange2);
|
|
};
|
|
}
|
|
}, [sharedValue]);
|
|
return sharedValue;
|
|
};
|