expo-router 6.1.0-canary-20251008-6acbc1c → 6.1.0-canary-20251009-9919e08
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_error.js +3 -36
- package/build/ExpoRoot.d.ts.map +1 -1
- package/build/ExpoRoot.js +1 -4
- package/build/ExpoRoot.js.map +1 -1
- package/build/getRoutesCore.d.ts +1 -0
- package/build/getRoutesCore.d.ts.map +1 -1
- package/build/getRoutesCore.js.map +1 -1
- package/build/getServerManifest.d.ts +9 -1
- package/build/getServerManifest.d.ts.map +1 -1
- package/build/getServerManifest.js +4 -1
- package/build/getServerManifest.js.map +1 -1
- package/build/modal/web/ModalStack.d.ts.map +1 -1
- package/build/modal/web/ModalStack.js +20 -2
- package/build/modal/web/ModalStack.js.map +1 -1
- package/build/modal/web/ModalStackRouteDrawer.d.ts +2 -1
- package/build/modal/web/ModalStackRouteDrawer.d.ts.map +1 -1
- package/build/modal/web/ModalStackRouteDrawer.js +2 -2
- package/build/modal/web/ModalStackRouteDrawer.js.map +1 -1
- package/build/modal/web/TransparentModalStackRouteDrawer.d.ts +2 -1
- package/build/modal/web/TransparentModalStackRouteDrawer.d.ts.map +1 -1
- package/build/modal/web/TransparentModalStackRouteDrawer.js +2 -2
- package/build/modal/web/TransparentModalStackRouteDrawer.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +5 -0
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +9 -13
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +59 -1
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/renderRootComponent.d.ts.map +1 -1
- package/build/renderRootComponent.js +7 -5
- package/build/renderRootComponent.js.map +1 -1
- package/build/routes-manifest.js +1 -1
- package/build/routes-manifest.js.map +1 -1
- package/build/views/ErrorBoundary.js +1 -1
- package/build/views/ErrorBoundary.js.map +1 -1
- package/package.json +8 -9
- package/plugin/build/index.d.ts +2 -0
- package/plugin/options.json +17 -0
- package/plugin/src/index.ts +2 -0
- package/build/modal/Modal.d.ts +0 -95
- package/build/modal/Modal.d.ts.map +0 -1
- package/build/modal/Modal.js +0 -116
- package/build/modal/Modal.js.map +0 -1
- package/build/modal/ModalComponent.d.ts +0 -7
- package/build/modal/ModalComponent.d.ts.map +0 -1
- package/build/modal/ModalComponent.js +0 -10
- package/build/modal/ModalComponent.js.map +0 -1
- package/build/modal/ModalContext.d.ts +0 -15
- package/build/modal/ModalContext.d.ts.map +0 -1
- package/build/modal/ModalContext.js +0 -90
- package/build/modal/ModalContext.js.map +0 -1
- package/build/modal/ModalsRenderer.d.ts +0 -3
- package/build/modal/ModalsRenderer.d.ts.map +0 -1
- package/build/modal/ModalsRenderer.js +0 -47
- package/build/modal/ModalsRenderer.js.map +0 -1
- package/build/modal/ModalsRenderer.web.d.ts +0 -3
- package/build/modal/ModalsRenderer.web.d.ts.map +0 -1
- package/build/modal/ModalsRenderer.web.js +0 -37
- package/build/modal/ModalsRenderer.web.js.map +0 -1
- package/build/modal/types.d.ts +0 -19
- package/build/modal/types.d.ts.map +0 -1
- package/build/modal/types.js +0 -3
- package/build/modal/types.js.map +0 -1
- package/build/modal/utils.d.ts +0 -7
- package/build/modal/utils.d.ts.map +0 -1
- package/build/modal/utils.js +0 -60
- package/build/modal/utils.js.map +0 -1
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useModalContext = exports.ModalContextProvider = void 0;
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const ModalsRenderer_1 = require("./ModalsRenderer");
|
|
7
|
-
const ALLOWED_EVENT_TYPE_LISTENERS = ['close', 'show'];
|
|
8
|
-
const ModalContext = (0, react_1.createContext)(undefined);
|
|
9
|
-
const ModalContextProvider = ({ children }) => {
|
|
10
|
-
const [modalConfigs, setModalConfigs] = (0, react_1.useState)([]);
|
|
11
|
-
const eventListeners = (0, react_1.useRef)({
|
|
12
|
-
close: new Set(),
|
|
13
|
-
show: new Set(),
|
|
14
|
-
});
|
|
15
|
-
const prevModalConfigs = (0, react_1.useRef)([]);
|
|
16
|
-
(0, react_1.useEffect)(() => {
|
|
17
|
-
if (prevModalConfigs.current !== modalConfigs) {
|
|
18
|
-
prevModalConfigs.current.forEach((config) => {
|
|
19
|
-
if (!modalConfigs.find((c) => c.uniqueId === config.uniqueId)) {
|
|
20
|
-
emitCloseEvent(config.uniqueId);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
prevModalConfigs.current = modalConfigs;
|
|
24
|
-
}
|
|
25
|
-
}, [modalConfigs]);
|
|
26
|
-
const openModal = (0, react_1.useCallback)((config) => {
|
|
27
|
-
setModalConfigs((prev) => [...prev, config]);
|
|
28
|
-
}, []);
|
|
29
|
-
const updateModal = (0, react_1.useCallback)((id, config) => {
|
|
30
|
-
setModalConfigs((prev) => {
|
|
31
|
-
const index = prev.findIndex((c) => c.uniqueId === id);
|
|
32
|
-
if (index >= 0) {
|
|
33
|
-
const updatedConfigs = [...prev];
|
|
34
|
-
updatedConfigs[index] = { ...updatedConfigs[index], ...config };
|
|
35
|
-
return updatedConfigs;
|
|
36
|
-
}
|
|
37
|
-
return prev;
|
|
38
|
-
});
|
|
39
|
-
}, []);
|
|
40
|
-
const emitCloseEvent = (0, react_1.useCallback)((id) => {
|
|
41
|
-
eventListeners.current.close.forEach((callback) => callback(id));
|
|
42
|
-
}, []);
|
|
43
|
-
const emitShowEvent = (0, react_1.useCallback)((id) => {
|
|
44
|
-
eventListeners.current.show.forEach((callback) => callback(id));
|
|
45
|
-
}, []);
|
|
46
|
-
const closeModal = (0, react_1.useCallback)((id) => {
|
|
47
|
-
setModalConfigs((prev) => {
|
|
48
|
-
const modalIndex = prev.findIndex((config) => config.uniqueId === id);
|
|
49
|
-
if (modalIndex >= 0) {
|
|
50
|
-
return prev.filter((_, index) => index < modalIndex);
|
|
51
|
-
}
|
|
52
|
-
return prev;
|
|
53
|
-
});
|
|
54
|
-
}, []);
|
|
55
|
-
const addEventListener = (0, react_1.useCallback)((type, callback) => {
|
|
56
|
-
if (!ALLOWED_EVENT_TYPE_LISTENERS.includes(type))
|
|
57
|
-
return () => { };
|
|
58
|
-
if (!callback) {
|
|
59
|
-
console.warn('Passing undefined as a callback to addEventListener is forbidden');
|
|
60
|
-
return () => { };
|
|
61
|
-
}
|
|
62
|
-
eventListeners.current[type].add(callback);
|
|
63
|
-
return () => {
|
|
64
|
-
eventListeners.current[type].delete(callback);
|
|
65
|
-
};
|
|
66
|
-
}, []);
|
|
67
|
-
return (<ModalContext.Provider value={{
|
|
68
|
-
modalConfigs,
|
|
69
|
-
openModal,
|
|
70
|
-
closeModal,
|
|
71
|
-
updateModal,
|
|
72
|
-
addEventListener,
|
|
73
|
-
}}>
|
|
74
|
-
<ModalsRenderer_1.ModalsRenderer modalConfigs={modalConfigs} onDismissed={(id) => {
|
|
75
|
-
closeModal(id);
|
|
76
|
-
}} onShow={emitShowEvent}>
|
|
77
|
-
{children}
|
|
78
|
-
</ModalsRenderer_1.ModalsRenderer>
|
|
79
|
-
</ModalContext.Provider>);
|
|
80
|
-
};
|
|
81
|
-
exports.ModalContextProvider = ModalContextProvider;
|
|
82
|
-
const useModalContext = () => {
|
|
83
|
-
const context = (0, react_1.use)(ModalContext);
|
|
84
|
-
if (!context) {
|
|
85
|
-
throw new Error('useModalContext must be used within a ModalContextProvider');
|
|
86
|
-
}
|
|
87
|
-
return context;
|
|
88
|
-
};
|
|
89
|
-
exports.useModalContext = useModalContext;
|
|
90
|
-
//# sourceMappingURL=Mod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AM,CAAC,CAAC,aAAa,CAAC,CACtB;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,+BAAc,CAClB;IAAA,EAAE,YAAY,CAAC,QAAQ,CAAC,CACzB,CAAC;AACJ,CAAC,CAAC;AA1FW,QAAA,oBAAoB,wBA0F/B;AAEK,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,IAAA,WAAG,EAAC,YAAY,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,eAAe,mBAM1B","sourcesContent":["'use client';\n\nimport {\n createContext,\n use,\n useCallback,\n useEffect,\n useRef,\n useState,\n type PropsWithChildren,\n} from 'react';\n\nimport { ModalsRenderer } from './ModalsRenderer';\nimport { type ModalConfig } from './types';\n\nexport { type ModalConfig };\n\nconst ALLOWED_EVENT_TYPE_LISTENERS = ['close', 'show'] as const;\ntype AllowedEventTypeListeners = (typeof ALLOWED_EVENT_TYPE_LISTENERS)[number];\n\nexport interface ModalContextType {\n modalConfigs: ModalConfig[];\n openModal: (config: ModalConfig) => void;\n updateModal: (id: string, config: Omit<Partial<ModalConfig>, 'uniqueId'>) => void;\n closeModal: (id: string) => void;\n addEventListener: (type: AllowedEventTypeListeners, callback: (id: string) => void) => () => void;\n}\n\nconst ModalContext = createContext<ModalContextType | undefined>(undefined);\n\nexport const ModalContextProvider = ({ children }: PropsWithChildren) => {\n const [modalConfigs, setModalConfigs] = useState<ModalConfig[]>([]);\n const eventListeners = useRef<Record<AllowedEventTypeListeners, Set<(id: string) => void>>>({\n close: new Set(),\n show: new Set(),\n });\n const prevModalConfigs = useRef<ModalConfig[]>([]);\n\n useEffect(() => {\n if (prevModalConfigs.current !== modalConfigs) {\n prevModalConfigs.current.forEach((config) => {\n if (!modalConfigs.find((c) => c.uniqueId === config.uniqueId)) {\n emitCloseEvent(config.uniqueId);\n }\n });\n prevModalConfigs.current = modalConfigs;\n }\n }, [modalConfigs]);\n\n const openModal = useCallback((config: ModalConfig) => {\n setModalConfigs((prev) => [...prev, config]);\n }, []);\n\n const updateModal = useCallback((id: string, config: Omit<Partial<ModalConfig>, 'uniqueId'>) => {\n setModalConfigs((prev) => {\n const index = prev.findIndex((c) => c.uniqueId === id);\n if (index >= 0) {\n const updatedConfigs = [...prev];\n updatedConfigs[index] = { ...updatedConfigs[index], ...config };\n return updatedConfigs;\n }\n return prev;\n });\n }, []);\n\n const emitCloseEvent = useCallback((id: string) => {\n eventListeners.current.close.forEach((callback) => callback(id));\n }, []);\n\n const emitShowEvent = useCallback((id: string) => {\n eventListeners.current.show.forEach((callback) => callback(id));\n }, []);\n\n const closeModal = useCallback((id: string) => {\n setModalConfigs((prev) => {\n const modalIndex = prev.findIndex((config) => config.uniqueId === id);\n if (modalIndex >= 0) {\n return prev.filter((_, index) => index < modalIndex);\n }\n return prev;\n });\n }, []);\n\n const addEventListener = useCallback(\n (type: AllowedEventTypeListeners, callback: (id: string) => void) => {\n if (!ALLOWED_EVENT_TYPE_LISTENERS.includes(type)) return () => {};\n\n if (!callback) {\n console.warn('Passing undefined as a callback to addEventListener is forbidden');\n return () => {};\n }\n\n eventListeners.current[type].add(callback);\n\n return () => {\n eventListeners.current[type].delete(callback);\n };\n },\n []\n );\n\n return (\n <ModalContext.Provider\n value={{\n modalConfigs,\n openModal,\n closeModal,\n updateModal,\n addEventListener,\n }}>\n <ModalsRenderer\n modalConfigs={modalConfigs}\n onDismissed={(id) => {\n closeModal(id);\n }}\n onShow={emitShowEvent}>\n {children}\n </ModalsRenderer>\n </ModalContext.Provider>\n );\n};\n\nexport const useModalContext = () => {\n const context = use(ModalContext);\n if (!context) {\n throw new Error('useModalContext must be used within a ModalContextProvider');\n }\n return context;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalsRenderer.d.ts","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,eAAO,MAAM,cAAc,GAAI,kDAK5B,mBAAmB,gCAmDrB,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ModalsRenderer = void 0;
|
|
5
|
-
const non_secure_1 = require("nanoid/non-secure");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const react_native_1 = require("react-native");
|
|
8
|
-
const react_native_screens_1 = require("react-native-screens");
|
|
9
|
-
const ModalComponent_1 = require("./ModalComponent");
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
|
-
const ModalsRenderer = ({ children, modalConfigs, onDismissed, onShow, }) => {
|
|
12
|
-
const rootId = (0, react_1.useRef)((0, non_secure_1.nanoid)());
|
|
13
|
-
return (<react_native_screens_1.ScreenStack style={styles.stackContainer}>
|
|
14
|
-
<react_native_screens_1.ScreenStackItem screenId={rootId.current} activityState={2} style={react_native_1.StyleSheet.absoluteFill} headerConfig={{
|
|
15
|
-
hidden: true,
|
|
16
|
-
}}>
|
|
17
|
-
{children}
|
|
18
|
-
</react_native_screens_1.ScreenStackItem>
|
|
19
|
-
{modalConfigs.map((config) => (<react_native_screens_1.ScreenStackItem key={config.uniqueId} {...config.viewProps} screenId={`${rootId.current}${config.uniqueId}`} activityState={2} stackPresentation={(0, utils_1.getStackPresentationType)(config)} stackAnimation={(0, utils_1.getStackAnimationType)(config)} nativeBackButtonDismissalEnabled headerConfig={{
|
|
20
|
-
hidden: true,
|
|
21
|
-
}} contentStyle={[
|
|
22
|
-
{
|
|
23
|
-
flex: config.presentationStyle !== 'formSheet' ? 1 : undefined,
|
|
24
|
-
backgroundColor: config.transparent ? 'transparent' : 'white',
|
|
25
|
-
},
|
|
26
|
-
config.viewProps?.style,
|
|
27
|
-
]} sheetAllowedDetents={config.detents} style={[
|
|
28
|
-
react_native_1.StyleSheet.absoluteFill,
|
|
29
|
-
{
|
|
30
|
-
backgroundColor: config.transparent ? 'transparent' : 'white',
|
|
31
|
-
},
|
|
32
|
-
]} onDismissed={() => {
|
|
33
|
-
onDismissed?.(config.uniqueId);
|
|
34
|
-
}} onAppear={() => {
|
|
35
|
-
onShow?.(config.uniqueId);
|
|
36
|
-
}}>
|
|
37
|
-
<ModalComponent_1.ModalComponent modalConfig={config}/>
|
|
38
|
-
</react_native_screens_1.ScreenStackItem>))}
|
|
39
|
-
</react_native_screens_1.ScreenStack>);
|
|
40
|
-
};
|
|
41
|
-
exports.ModalsRenderer = ModalsRenderer;
|
|
42
|
-
const styles = react_native_1.StyleSheet.create({
|
|
43
|
-
stackContainer: {
|
|
44
|
-
flex: 1,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=ModalsRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalsRenderer.js","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,kDAA2C;AAC3C,iCAA+B;AAC/B,+CAA0C;AAC1C,+DAAoE;AAEpE,qDAAkD;AAElD,mCAA0E;AAEnE,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,MAAM,GACc,EAAE,EAAE;IACxB,MAAM,MAAM,GAAG,IAAA,cAAM,EAAC,IAAA,mBAAM,GAAE,CAAC,CAAC;IAEhC,OAAO,CACL,CAAC,kCAAW,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CACxC;MAAA,CAAC,sCAAe,CACd,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CACzB,aAAa,CAAC,CAAC,CAAC,CAAC,CACjB,KAAK,CAAC,CAAC,yBAAU,CAAC,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CAAC,GAAG,EAAE;gBACb,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,CAAC,CAAC,CACF;UAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;QAAA,EAAE,sCAAe,CAAC,CACnB,CAAC,CACJ;IAAA,EAAE,kCAAW,CAAC,CACf,CAAC;AACJ,CAAC,CAAC;AAxDW,QAAA,cAAc,kBAwDzB;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;KACR;CACF,CAAC,CAAC","sourcesContent":["'use client';\n\nimport { nanoid } from 'nanoid/non-secure';\nimport { useRef } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { ScreenStack, ScreenStackItem } from 'react-native-screens';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n const rootId = useRef(nanoid());\n\n return (\n <ScreenStack style={styles.stackContainer}>\n <ScreenStackItem\n screenId={rootId.current}\n activityState={2}\n style={StyleSheet.absoluteFill}\n headerConfig={{\n hidden: true,\n }}>\n {children}\n </ScreenStackItem>\n {modalConfigs.map((config) => (\n <ScreenStackItem\n key={config.uniqueId}\n {...config.viewProps}\n screenId={`${rootId.current}${config.uniqueId}`}\n activityState={2}\n stackPresentation={getStackPresentationType(config)}\n stackAnimation={getStackAnimationType(config)}\n nativeBackButtonDismissalEnabled\n headerConfig={{\n hidden: true,\n }}\n contentStyle={[\n {\n flex: config.presentationStyle !== 'formSheet' ? 1 : undefined,\n backgroundColor: config.transparent ? 'transparent' : 'white',\n },\n config.viewProps?.style,\n ]}\n sheetAllowedDetents={config.detents}\n style={[\n StyleSheet.absoluteFill,\n {\n backgroundColor: config.transparent ? 'transparent' : 'white',\n },\n ]}\n onDismissed={() => {\n onDismissed?.(config.uniqueId);\n }}\n onAppear={() => {\n onShow?.(config.uniqueId);\n }}>\n <ModalComponent modalConfig={config} />\n </ScreenStackItem>\n ))}\n </ScreenStack>\n );\n};\n\nconst styles = StyleSheet.create({\n stackContainer: {\n flex: 1,\n },\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalsRenderer.web.d.ts","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.web.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAe,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAMhE,eAAO,MAAM,cAAc,GAAI,kDAK5B,mBAAmB,gCAarB,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ModalsRenderer = void 0;
|
|
5
|
-
const native_1 = require("@react-navigation/native");
|
|
6
|
-
const react_native_1 = require("react-native");
|
|
7
|
-
const ModalComponent_1 = require("./ModalComponent");
|
|
8
|
-
const utils_1 = require("./utils");
|
|
9
|
-
const ModalStackRouteDrawer_1 = require("./web/ModalStackRouteDrawer");
|
|
10
|
-
const TransparentModalStackRouteDrawer_1 = require("./web/TransparentModalStackRouteDrawer");
|
|
11
|
-
const utils_2 = require("./web/utils");
|
|
12
|
-
const ModalsRenderer = ({ children, modalConfigs, onDismissed, onShow, }) => {
|
|
13
|
-
return (<div style={{ flex: 1, display: 'flex' }}>
|
|
14
|
-
{children}
|
|
15
|
-
{modalConfigs.map((config) => (<Modal key={config.uniqueId} config={config} onDismissed={() => onDismissed?.(config.uniqueId)}/>))}
|
|
16
|
-
</div>);
|
|
17
|
-
};
|
|
18
|
-
exports.ModalsRenderer = ModalsRenderer;
|
|
19
|
-
function Modal({ config, onDismissed }) {
|
|
20
|
-
const { colors } = (0, native_1.useTheme)();
|
|
21
|
-
const presentation = (0, utils_1.getStackPresentationType)(config);
|
|
22
|
-
const isTransparentModal = (0, utils_2.isTransparentModalPresentation)({ presentation });
|
|
23
|
-
const SelectedModalComponent = isTransparentModal
|
|
24
|
-
? TransparentModalStackRouteDrawer_1.TransparentModalStackRouteDrawer
|
|
25
|
-
: ModalStackRouteDrawer_1.ModalStackRouteDrawer;
|
|
26
|
-
return (<SelectedModalComponent routeKey={config.uniqueId} onDismiss={onDismissed} themeColors={colors} key={config.uniqueId} options={{
|
|
27
|
-
presentation,
|
|
28
|
-
animation: (0, utils_1.getStackAnimationType)(config),
|
|
29
|
-
headerShown: false,
|
|
30
|
-
sheetAllowedDetents: config.detents,
|
|
31
|
-
}} renderScreen={() => (<react_native_1.View style={{ flex: 1 }}>
|
|
32
|
-
<react_native_1.View {...config.viewProps} style={[{ flex: 1 }, config.viewProps?.style]}>
|
|
33
|
-
<ModalComponent_1.ModalComponent modalConfig={config}/>
|
|
34
|
-
</react_native_1.View>
|
|
35
|
-
</react_native_1.View>)}/>);
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=ModalsRenderer.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModalsRenderer.web.js","sourceRoot":"","sources":["../../src/modal/ModalsRenderer.web.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,qDAAoD;AACpD,+CAAoC;AAEpC,qDAAkD;AAElD,mCAA0E;AAC1E,uEAAoE;AACpE,6FAA0F;AAC1F,uCAA6D;AAEtD,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,MAAM,GACc,EAAE,EAAE;IACxB,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CACvC;MAAA,CAAC,QAAQ,CACT;MAAA,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC5B,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AI,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CACxE;YAAA,CAAC,+BAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,EACtC;UAAA,EAAE,mBAAI,CACR;QAAA,EAAE,mBAAI,CAAC,CACR,CAAC,EACF,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useTheme } from '@react-navigation/native';\nimport { View } from 'react-native';\n\nimport { ModalComponent } from './ModalComponent';\nimport type { ModalConfig, ModalsRendererProps } from './types';\nimport { getStackAnimationType, getStackPresentationType } from './utils';\nimport { ModalStackRouteDrawer } from './web/ModalStackRouteDrawer';\nimport { TransparentModalStackRouteDrawer } from './web/TransparentModalStackRouteDrawer';\nimport { isTransparentModalPresentation } from './web/utils';\n\nexport const ModalsRenderer = ({\n children,\n modalConfigs,\n onDismissed,\n onShow,\n}: ModalsRendererProps) => {\n return (\n <div style={{ flex: 1, display: 'flex' }}>\n {children}\n {modalConfigs.map((config) => (\n <Modal\n key={config.uniqueId}\n config={config}\n onDismissed={() => onDismissed?.(config.uniqueId)}\n />\n ))}\n </div>\n );\n};\n\ninterface ModalProps {\n config: ModalConfig;\n onDismissed: () => void;\n}\n\nfunction Modal({ config, onDismissed }: ModalProps) {\n const { colors } = useTheme();\n\n const presentation = getStackPresentationType(config);\n const isTransparentModal = isTransparentModalPresentation({ presentation });\n\n const SelectedModalComponent = isTransparentModal\n ? TransparentModalStackRouteDrawer\n : ModalStackRouteDrawer;\n\n return (\n <SelectedModalComponent\n routeKey={config.uniqueId}\n onDismiss={onDismissed}\n themeColors={colors}\n key={config.uniqueId}\n options={{\n presentation,\n animation: getStackAnimationType(config),\n headerShown: false,\n sheetAllowedDetents: config.detents,\n }}\n renderScreen={() => (\n <View style={{ flex: 1 }}>\n <View {...config.viewProps} style={[{ flex: 1 }, config.viewProps?.style]}>\n <ModalComponent modalConfig={config} />\n </View>\n </View>\n )}\n />\n );\n}\n"]}
|
package/build/modal/types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { NavigationProp, ParamListBase } from '@react-navigation/native';
|
|
2
|
-
import { type ViewProps } from 'react-native';
|
|
3
|
-
export interface ModalConfig {
|
|
4
|
-
component: React.ReactNode;
|
|
5
|
-
parentNavigationProp: NavigationProp<ParamListBase>;
|
|
6
|
-
uniqueId: string;
|
|
7
|
-
animationType?: 'slide' | 'fade' | 'none';
|
|
8
|
-
presentationStyle?: 'fullScreen' | 'overFullScreen' | 'pageSheet' | 'formSheet';
|
|
9
|
-
transparent?: boolean;
|
|
10
|
-
viewProps?: ViewProps;
|
|
11
|
-
detents?: number[] | 'fitToContents';
|
|
12
|
-
}
|
|
13
|
-
export interface ModalsRendererProps {
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
modalConfigs: ModalConfig[];
|
|
16
|
-
onDismissed?: (id: string) => void;
|
|
17
|
-
onShow?: (id: string) => void;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/modal/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oBAAoB,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1C,iBAAiB,CAAC,EAAE,YAAY,GAAG,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAC;IAChF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B"}
|
package/build/modal/types.js
DELETED
package/build/modal/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/modal/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { NavigationProp, ParamListBase } from '@react-navigation/native';\nimport { type ViewProps } from 'react-native';\n\nexport interface ModalConfig {\n component: React.ReactNode;\n parentNavigationProp: NavigationProp<ParamListBase>;\n uniqueId: string;\n animationType?: 'slide' | 'fade' | 'none';\n presentationStyle?: 'fullScreen' | 'overFullScreen' | 'pageSheet' | 'formSheet';\n transparent?: boolean;\n viewProps?: ViewProps;\n detents?: number[] | 'fitToContents';\n}\n\nexport interface ModalsRendererProps {\n children?: React.ReactNode;\n modalConfigs: ModalConfig[];\n onDismissed?: (id: string) => void;\n onShow?: (id: string) => void;\n}\n"]}
|
package/build/modal/utils.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { StackAnimationTypes } from 'react-native-screens';
|
|
2
|
-
import type { ModalProps } from './Modal';
|
|
3
|
-
import type { ModalConfig } from './types';
|
|
4
|
-
export declare function areDetentsValid(detents: ModalProps['detents']): boolean;
|
|
5
|
-
export declare function getStackAnimationType(config: ModalConfig): StackAnimationTypes | undefined;
|
|
6
|
-
export declare function getStackPresentationType(config: ModalConfig): "transparentModal" | "fullScreenModal" | "formSheet" | "pageSheet";
|
|
7
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/modal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,OAAO,CAcvE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,mBAAmB,GAAG,SAAS,CAU1F;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,WAAW,sEAgC3D"}
|
package/build/modal/utils.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.areDetentsValid = areDetentsValid;
|
|
4
|
-
exports.getStackAnimationType = getStackAnimationType;
|
|
5
|
-
exports.getStackPresentationType = getStackPresentationType;
|
|
6
|
-
function areDetentsValid(detents) {
|
|
7
|
-
if (Array.isArray(detents)) {
|
|
8
|
-
return (!!detents.length &&
|
|
9
|
-
detents.every((detent, index, arr) => typeof detent === 'number' &&
|
|
10
|
-
detent >= 0 &&
|
|
11
|
-
detent <= 1 &&
|
|
12
|
-
detent >= (arr[index - 1] ?? 0)));
|
|
13
|
-
}
|
|
14
|
-
return detents === 'fitToContents' || detents === undefined || detents === null;
|
|
15
|
-
}
|
|
16
|
-
function getStackAnimationType(config) {
|
|
17
|
-
switch (config.animationType) {
|
|
18
|
-
case 'fade':
|
|
19
|
-
return 'fade';
|
|
20
|
-
case 'none':
|
|
21
|
-
return 'none';
|
|
22
|
-
case 'slide':
|
|
23
|
-
default:
|
|
24
|
-
return 'slide_from_bottom';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function getStackPresentationType(config) {
|
|
28
|
-
if (process.env.EXPO_OS === 'android') {
|
|
29
|
-
if (config.transparent) {
|
|
30
|
-
return 'transparentModal';
|
|
31
|
-
}
|
|
32
|
-
switch (config.presentationStyle) {
|
|
33
|
-
case 'fullScreen':
|
|
34
|
-
return 'fullScreenModal';
|
|
35
|
-
case 'overFullScreen':
|
|
36
|
-
return 'transparentModal';
|
|
37
|
-
case 'pageSheet':
|
|
38
|
-
return 'pageSheet';
|
|
39
|
-
case 'formSheet':
|
|
40
|
-
return 'formSheet';
|
|
41
|
-
default:
|
|
42
|
-
return 'fullScreenModal';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
switch (config.presentationStyle) {
|
|
46
|
-
case 'overFullScreen':
|
|
47
|
-
return 'transparentModal';
|
|
48
|
-
case 'pageSheet':
|
|
49
|
-
return 'pageSheet';
|
|
50
|
-
case 'formSheet':
|
|
51
|
-
return 'formSheet';
|
|
52
|
-
case 'fullScreen':
|
|
53
|
-
default:
|
|
54
|
-
if (config.transparent) {
|
|
55
|
-
return 'transparentModal';
|
|
56
|
-
}
|
|
57
|
-
return 'fullScreenModal';
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=utils.js.map
|
package/build/modal/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/modal/utils.ts"],"names":[],"mappings":";;AAKA,0CAcC;AAED,sDAUC;AAED,4DAgCC;AA5DD,SAAgB,eAAe,CAAC,OAA8B;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,CACL,CAAC,CAAC,OAAO,CAAC,MAAM;YAChB,OAAO,CAAC,KAAK,CACX,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CACrB,OAAO,MAAM,KAAK,QAAQ;gBAC1B,MAAM,IAAI,CAAC;gBACX,MAAM,IAAI,CAAC;gBACX,MAAM,IA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":["import type { StackAnimationTypes } from 'react-native-screens';\n\nimport type { ModalProps } from './Modal';\nimport type { ModalConfig } from './types';\n\nexport function areDetentsValid(detents: ModalProps['detents']): boolean {\n if (Array.isArray(detents)) {\n return (\n !!detents.length &&\n detents.every(\n (detent, index, arr) =>\n typeof detent === 'number' &&\n detent >= 0 &&\n detent <= 1 &&\n detent >= (arr[index - 1] ?? 0)\n )\n );\n }\n return detents === 'fitToContents' || detents === undefined || detents === null;\n}\n\nexport function getStackAnimationType(config: ModalConfig): StackAnimationTypes | undefined {\n switch (config.animationType) {\n case 'fade':\n return 'fade';\n case 'none':\n return 'none';\n case 'slide':\n default:\n return 'slide_from_bottom';\n }\n}\n\nexport function getStackPresentationType(config: ModalConfig) {\n if (process.env.EXPO_OS === 'android') {\n if (config.transparent) {\n return 'transparentModal';\n }\n switch (config.presentationStyle) {\n case 'fullScreen':\n return 'fullScreenModal';\n case 'overFullScreen':\n return 'transparentModal';\n case 'pageSheet':\n return 'pageSheet';\n case 'formSheet':\n return 'formSheet';\n default:\n return 'fullScreenModal';\n }\n }\n switch (config.presentationStyle) {\n case 'overFullScreen':\n return 'transparentModal';\n case 'pageSheet':\n return 'pageSheet';\n case 'formSheet':\n return 'formSheet';\n case 'fullScreen':\n default:\n if (config.transparent) {\n return 'transparentModal';\n }\n return 'fullScreenModal';\n }\n}\n"]}
|