first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
import type { ImageSourcePropType } from 'react-native';
import type { ScreenStackHeaderConfigProps } from 'react-native-screens';
export interface StackScreenBackButtonProps {
/**
* The title to display for the back button.
*/
children?: string;
/**
* Style for the back button title.
*/
style?: NativeStackNavigationOptions['headerBackTitleStyle'];
/**
* Whether to show a context menu when long pressing the back button.
*
* @platform ios
*/
withMenu?: boolean;
/**
* The display mode for the back button.
*
* @platform ios
*/
displayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];
/**
* Whether to hide the back button.
*/
hidden?: boolean;
/**
* Custom image source for the back button.
*/
src?: ImageSourcePropType;
}
/**
* Component to configure the back button.
*
* Can be used inside Stack.Screen in a layout or directly inside a screen component.
*
* @example
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Layout() {
* return (
* <Stack>
* <Stack.Screen name="detail">
* <Stack.Screen.BackButton displayMode="minimal">Back</Stack.Screen.BackButton>
* </Stack.Screen>
* </Stack>
* );
* }
* ```
*
* @example
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Page() {
* return (
* <>
* <Stack.Screen.BackButton hidden />
* <ScreenContent />
* </>
* );
* }
* ```
*
* > **Note:** If multiple instances of this component are rendered for the same screen,
* the last one rendered in the component tree takes precedence.
*/
export declare function StackScreenBackButton({ children, style, withMenu, displayMode, hidden, src, }: StackScreenBackButtonProps): null;
export declare function appendStackScreenBackButtonPropsToOptions(options: NativeStackNavigationOptions, props: StackScreenBackButtonProps): NativeStackNavigationOptions;
//# sourceMappingURL=StackScreenBackButton.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"StackScreenBackButton.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/StackScreenBackButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAIzE,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,4BAA4B,CAAC,sBAAsB,CAAC,CAAC;IAC7D;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,4BAA4B,CAAC,uBAAuB,CAAC,CAAC;IACpE;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,GAAG,CAAC,EAAE,mBAAmB,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,GAAG,GACJ,EAAE,0BAA0B,QAe5B;AAED,wBAAgB,yCAAyC,CACvD,OAAO,EAAE,4BAA4B,EACrC,KAAK,EAAE,0BAA0B,GAChC,4BAA4B,CAU9B"}

View File

@@ -0,0 +1,62 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StackScreenBackButton = StackScreenBackButton;
exports.appendStackScreenBackButtonPropsToOptions = appendStackScreenBackButtonPropsToOptions;
const react_1 = require("react");
const composition_options_1 = require("../../../fork/native-stack/composition-options");
/**
* Component to configure the back button.
*
* Can be used inside Stack.Screen in a layout or directly inside a screen component.
*
* @example
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Layout() {
* return (
* <Stack>
* <Stack.Screen name="detail">
* <Stack.Screen.BackButton displayMode="minimal">Back</Stack.Screen.BackButton>
* </Stack.Screen>
* </Stack>
* );
* }
* ```
*
* @example
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Page() {
* return (
* <>
* <Stack.Screen.BackButton hidden />
* <ScreenContent />
* </>
* );
* }
* ```
*
* > **Note:** If multiple instances of this component are rendered for the same screen,
* the last one rendered in the component tree takes precedence.
*/
function StackScreenBackButton({ children, style, withMenu, displayMode, hidden, src, }) {
const options = (0, react_1.useMemo)(() => appendStackScreenBackButtonPropsToOptions({},
// satisfies ensures every prop is listed here
{ children, style, withMenu, displayMode, hidden, src }), [children, style, withMenu, displayMode, hidden, src]);
(0, composition_options_1.useCompositionOption)(options);
return null;
}
function appendStackScreenBackButtonPropsToOptions(options, props) {
return {
...options,
headerBackTitle: props.children,
headerBackTitleStyle: props.style,
headerBackImageSource: props.src,
headerBackButtonDisplayMode: props.displayMode,
headerBackButtonMenuEnabled: props.withMenu,
headerBackVisible: !props.hidden,
};
}
//# sourceMappingURL=StackScreenBackButton.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"StackScreenBackButton.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/StackScreenBackButton.tsx"],"names":[],"mappings":";;AA2EA,sDAsBC;AAED,8FAaC;AA/GD,iCAAgC;AAIhC,wFAAsF;AAiCtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,GAAG,GACwB;IAC3B,MAAM,OAAO,GAAG,IAAA,eAAO,EACrB,GAAG,EAAE,CACH,yCAAyC,CACvC,EAAE;IACF,8CAA8C;IAC9C,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAGpD,CACF,EACH,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,CACtD,CAAC;IACF,IAAA,0CAAoB,EAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,yCAAyC,CACvD,OAAqC,EACrC,KAAiC;IAEjC,OAAO;QACL,GAAG,OAAO;QACV,eAAe,EAAE,KAAK,CAAC,QAAQ;QAC/B,oBAAoB,EAAE,KAAK,CAAC,KAAK;QACjC,qBAAqB,EAAE,KAAK,CAAC,GAAG;QAChC,2BAA2B,EAAE,KAAK,CAAC,WAAW;QAC9C,2BAA2B,EAAE,KAAK,CAAC,QAAQ;QAC3C,iBAAiB,EAAE,CAAC,KAAK,CAAC,MAAM;KACjC,CAAC;AACJ,CAAC","sourcesContent":["import { NativeStackNavigationOptions } from '@react-navigation/native-stack';\nimport { useMemo } from 'react';\nimport type { ImageSourcePropType } from 'react-native';\nimport type { ScreenStackHeaderConfigProps } from 'react-native-screens';\n\nimport { useCompositionOption } from '../../../fork/native-stack/composition-options';\n\nexport interface StackScreenBackButtonProps {\n /**\n * The title to display for the back button.\n */\n children?: string;\n /**\n * Style for the back button title.\n */\n style?: NativeStackNavigationOptions['headerBackTitleStyle'];\n /**\n * Whether to show a context menu when long pressing the back button.\n *\n * @platform ios\n */\n withMenu?: boolean;\n /**\n * The display mode for the back button.\n *\n * @platform ios\n */\n displayMode?: ScreenStackHeaderConfigProps['backButtonDisplayMode'];\n /**\n * Whether to hide the back button.\n */\n hidden?: boolean;\n /**\n * Custom image source for the back button.\n */\n src?: ImageSourcePropType;\n}\n\n/**\n * Component to configure the back button.\n *\n * Can be used inside Stack.Screen in a layout or directly inside a screen component.\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Layout() {\n * return (\n * <Stack>\n * <Stack.Screen name=\"detail\">\n * <Stack.Screen.BackButton displayMode=\"minimal\">Back</Stack.Screen.BackButton>\n * </Stack.Screen>\n * </Stack>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * import { Stack } from 'expo-router';\n *\n * export default function Page() {\n * return (\n * <>\n * <Stack.Screen.BackButton hidden />\n * <ScreenContent />\n * </>\n * );\n * }\n * ```\n *\n * > **Note:** If multiple instances of this component are rendered for the same screen,\n * the last one rendered in the component tree takes precedence.\n */\nexport function StackScreenBackButton({\n children,\n style,\n withMenu,\n displayMode,\n hidden,\n src,\n}: StackScreenBackButtonProps) {\n const options = useMemo(\n () =>\n appendStackScreenBackButtonPropsToOptions(\n {},\n // satisfies ensures every prop is listed here\n { children, style, withMenu, displayMode, hidden, src } satisfies Record<\n keyof StackScreenBackButtonProps,\n unknown\n >\n ),\n [children, style, withMenu, displayMode, hidden, src]\n );\n useCompositionOption(options);\n return null;\n}\n\nexport function appendStackScreenBackButtonPropsToOptions(\n options: NativeStackNavigationOptions,\n props: StackScreenBackButtonProps\n): NativeStackNavigationOptions {\n return {\n ...options,\n headerBackTitle: props.children,\n headerBackTitleStyle: props.style,\n headerBackImageSource: props.src,\n headerBackButtonDisplayMode: props.displayMode,\n headerBackButtonMenuEnabled: props.withMenu,\n headerBackVisible: !props.hidden,\n };\n}\n"]}

View File

@@ -0,0 +1,105 @@
import { NativeStackNavigationOptions } from '@react-navigation/native-stack';
import React from 'react';
import { type StyleProp, type TextStyle } from 'react-native';
export type StackScreenTitleProps = {
/**
* The title content. Pass a string for a plain text title,
* or a custom component when `asChild` is enabled.
*/
children?: React.ReactNode;
/**
* Use this to render a custom component as the header title.
*
* @example
* ```tsx
* <Stack.Screen.Title asChild>
* <MyCustomTitle />
* </Stack.Screen.Title>
* ```
*/
asChild?: boolean;
style?: StyleProp<{
fontFamily?: TextStyle['fontFamily'];
fontSize?: TextStyle['fontSize'];
fontWeight?: Exclude<TextStyle['fontWeight'], number>;
color?: string;
textAlign?: 'left' | 'center';
}>;
/**
* Style properties for the large title header.
*
* @platform ios
*/
largeStyle?: StyleProp<{
fontFamily?: TextStyle['fontFamily'];
fontSize?: TextStyle['fontSize'];
fontWeight?: Exclude<TextStyle['fontWeight'], number>;
color?: string;
}>;
/**
* Enables large title mode.
*
* @platform ios
*/
large?: boolean;
};
/**
* Component to set the screen title.
*
* Can be used inside Stack.Screen in a layout or directly inside a screen component.
*
* @example
* String title in a layout:
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Layout() {
* return (
* <Stack>
* <Stack.Screen name="index">
* <Stack.Screen.Title large>Home</Stack.Screen.Title>
* </Stack.Screen>
* </Stack>
* );
* }
* ```
*
* @example
* String title inside a screen:
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Page() {
* return (
* <>
* <Stack.Screen.Title>My Page</Stack.Screen.Title>
* <ScreenContent />
* </>
* );
* }
* ```
*
* @example
* Custom component as the title using `asChild`:
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Layout() {
* return (
* <Stack>
* <Stack.Screen name="index">
* <Stack.Screen.Title asChild>
* <MyCustomTitle />
* </Stack.Screen.Title>
* </Stack.Screen>
* </Stack>
* );
* }
* ```
*
* > **Note:** If multiple instances of this component are rendered for the same screen,
* the last one rendered in the component tree takes precedence.
*/
export declare function StackScreenTitle({ children, asChild, style, largeStyle, large, }: StackScreenTitleProps): null;
export declare function appendStackScreenTitlePropsToOptions(options: NativeStackNavigationOptions, props: StackScreenTitleProps): NativeStackNavigationOptions;
//# sourceMappingURL=StackScreenTitle.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"StackScreenTitle.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/StackScreenTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAK1E,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;QAChB,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;QACjC,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;QAGtD,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;KAC/B,CAAC,CAAC;IACH;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;QACrB,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;QACjC,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;QAGtD,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,KAAK,EACL,UAAU,EACV,KAAK,GACN,EAAE,qBAAqB,QAevB;AAED,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,4BAA4B,EACrC,KAAK,EAAE,qBAAqB,GAC3B,4BAA4B,CA+C9B"}

View File

@@ -0,0 +1,147 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.StackScreenTitle = StackScreenTitle;
exports.appendStackScreenTitlePropsToOptions = appendStackScreenTitlePropsToOptions;
const react_1 = __importStar(require("react"));
const react_native_1 = require("react-native");
const composition_options_1 = require("../../../fork/native-stack/composition-options");
const style_1 = require("../../../utils/style");
/**
* Component to set the screen title.
*
* Can be used inside Stack.Screen in a layout or directly inside a screen component.
*
* @example
* String title in a layout:
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Layout() {
* return (
* <Stack>
* <Stack.Screen name="index">
* <Stack.Screen.Title large>Home</Stack.Screen.Title>
* </Stack.Screen>
* </Stack>
* );
* }
* ```
*
* @example
* String title inside a screen:
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Page() {
* return (
* <>
* <Stack.Screen.Title>My Page</Stack.Screen.Title>
* <ScreenContent />
* </>
* );
* }
* ```
*
* @example
* Custom component as the title using `asChild`:
* ```tsx
* import { Stack } from 'expo-router';
*
* export default function Layout() {
* return (
* <Stack>
* <Stack.Screen name="index">
* <Stack.Screen.Title asChild>
* <MyCustomTitle />
* </Stack.Screen.Title>
* </Stack.Screen>
* </Stack>
* );
* }
* ```
*
* > **Note:** If multiple instances of this component are rendered for the same screen,
* the last one rendered in the component tree takes precedence.
*/
function StackScreenTitle({ children, asChild, style, largeStyle, large, }) {
const options = (0, react_1.useMemo)(() => appendStackScreenTitlePropsToOptions({},
// satisfies ensures every prop is listed here
{ children, asChild, style, largeStyle, large }), [children, asChild, style, largeStyle, large]);
(0, composition_options_1.useCompositionOption)(options);
return null;
}
function appendStackScreenTitlePropsToOptions(options, props) {
const flattenedStyle = react_native_1.StyleSheet.flatten(props.style);
const flattenedLargeStyle = react_native_1.StyleSheet.flatten(props.largeStyle);
let titleOptions = props.asChild
? { headerTitle: () => <>{props.children}</> }
: { title: props.children };
if (props.asChild && typeof props.children === 'string') {
if (__DEV__) {
console.warn("Stack.Screen.Title: 'asChild' expects a custom component as children, string received.");
}
titleOptions = {};
}
if (!props.asChild && props.children != null && typeof props.children !== 'string') {
if (__DEV__) {
console.warn('Stack.Screen.Title: Component passed to Stack.Screen.Title without `asChild` enabled. In order to render a custom component as the title, set `asChild` to true.');
}
titleOptions = {};
}
return {
...options,
...titleOptions,
headerLargeTitle: props.large,
headerTitleAlign: flattenedStyle?.textAlign,
headerTitleStyle: {
...flattenedStyle,
...(flattenedStyle?.fontWeight
? {
fontWeight: (0, style_1.convertFontWeightToStringFontWeight)(flattenedStyle?.fontWeight),
}
: {}),
},
headerLargeTitleStyle: {
...flattenedLargeStyle,
...(flattenedLargeStyle?.fontWeight
? {
fontWeight: (0, style_1.convertFontWeightToStringFontWeight)(flattenedLargeStyle?.fontWeight),
}
: {}),
},
};
}
//# sourceMappingURL=StackScreenTitle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
export { StackScreenTitle, appendStackScreenTitlePropsToOptions, type StackScreenTitleProps, } from './StackScreenTitle';
export { StackScreenBackButton, appendStackScreenBackButtonPropsToOptions, type StackScreenBackButtonProps, } from './StackScreenBackButton';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oCAAoC,EACpC,KAAK,qBAAqB,GAC3B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,qBAAqB,EACrB,yCAAyC,EACzC,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAC"}

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.appendStackScreenBackButtonPropsToOptions = exports.StackScreenBackButton = exports.appendStackScreenTitlePropsToOptions = exports.StackScreenTitle = void 0;
var StackScreenTitle_1 = require("./StackScreenTitle");
Object.defineProperty(exports, "StackScreenTitle", { enumerable: true, get: function () { return StackScreenTitle_1.StackScreenTitle; } });
Object.defineProperty(exports, "appendStackScreenTitlePropsToOptions", { enumerable: true, get: function () { return StackScreenTitle_1.appendStackScreenTitlePropsToOptions; } });
var StackScreenBackButton_1 = require("./StackScreenBackButton");
Object.defineProperty(exports, "StackScreenBackButton", { enumerable: true, get: function () { return StackScreenBackButton_1.StackScreenBackButton; } });
Object.defineProperty(exports, "appendStackScreenBackButtonPropsToOptions", { enumerable: true, get: function () { return StackScreenBackButton_1.appendStackScreenBackButtonPropsToOptions; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/layouts/stack-utils/screen/index.tsx"],"names":[],"mappings":";;;AAAA,uDAI4B;AAH1B,oHAAA,gBAAgB,OAAA;AAChB,wIAAA,oCAAoC,OAAA;AAItC,iEAIiC;AAH/B,8HAAA,qBAAqB,OAAA;AACrB,kJAAA,yCAAyC,OAAA","sourcesContent":["export {\n StackScreenTitle,\n appendStackScreenTitlePropsToOptions,\n type StackScreenTitleProps,\n} from './StackScreenTitle';\n\nexport {\n StackScreenBackButton,\n appendStackScreenBackButtonPropsToOptions,\n type StackScreenBackButtonProps,\n} from './StackScreenBackButton';\n"]}