UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

53 lines (51 loc) 1.66 kB
"use client"; import { jsx as _jsx } from "react/jsx-runtime"; import { createNavigatorFactory, useNavigationBuilder } from "@react-navigation/core"; import { StackActions, StackRouter } from "@react-navigation/routers"; import { useEffect } from "react"; import { WebStackView } from "./WebStackView.native.js"; function WebStackNavigator(param) { var { initialRouteName, children, screenOptions, headlessChildren, ...rest } = param; var { state, navigation, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, { ...rest, children, screenOptions, initialRouteName }); useEffect(function () { var _navigation_addListener; return navigation === null || navigation === void 0 ? void 0 : (_navigation_addListener = navigation.addListener) === null || _navigation_addListener === void 0 ? void 0 : _navigation_addListener.call(navigation, "tabPress", function (e) { var isFocused = navigation.isFocused(); requestAnimationFrame(function () { if (state.index > 0 && isFocused && !e.defaultPrevented) { navigation.dispatch({ ...StackActions.popToTop(), target: state.key }); } }); }); }, [navigation, state.index, state.key]); return /* @__PURE__ */_jsx(NavigationContent, { children: /* @__PURE__ */_jsx(WebStackView, { state, navigation, descriptors, customChildren: headlessChildren }) }); } var createWebStackNavigator = createNavigatorFactory(WebStackNavigator); export { createWebStackNavigator }; //# sourceMappingURL=WebStackNavigator.native.js.map