UNPKG

one

Version:

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

42 lines (41 loc) 1.33 kB
import { createDrawerNavigator } from "@react-navigation/drawer"; import React, { useMemo } from "react"; import { Platform } from "react-native-web"; import { getRenderingConfig } from "../router/renderingRegistry.mjs"; import { withLayoutContext } from "./withLayoutContext.mjs"; import { jsx } from "react/jsx-runtime"; const DrawerNavigator = createDrawerNavigator().Navigator; const RNDrawer = withLayoutContext(DrawerNavigator); const DrawerWithRender = React.forwardRef((props, ref) => { const { render, drawerContent, ...rest } = props; const effectiveDrawerContent = useMemo(() => { if (drawerContent) return drawerContent; const platform = Platform.OS; const fromProp = render?.[platform]; if (fromProp) return fromProp; const fromGlobal = getRenderingConfig().Drawer?.[platform]; if (fromGlobal) return fromGlobal; return void 0; }, [drawerContent, render]); if (effectiveDrawerContent) { return /* @__PURE__ */jsx(RNDrawer, { ...rest, ref, drawerContent: effectiveDrawerContent }); } return /* @__PURE__ */jsx(RNDrawer, { ...rest, ref }); }); const Drawer = Object.assign(DrawerWithRender, { Screen: RNDrawer.Screen }); var Drawer_default = Drawer; export { Drawer, Drawer_default as default }; //# sourceMappingURL=Drawer.mjs.map