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,9 @@
import { type ReactElement } from 'react';
import type { TabAccessoryComponentFactory } from 'react-native-screens';
import type { NativeTabsBottomAccessoryProps } from '../common/elements';
/**
* Converts `<NativeTabs.BottomAccessory>` component into a function,
* which can be used by `react-native-screens` to render the accessory.
*/
export declare function useBottomAccessoryFunctionFromBottomAccessories(bottomAccessory: ReactElement<NativeTabsBottomAccessoryProps, string | React.JSXElementConstructor<any>> | undefined): TabAccessoryComponentFactory | undefined;
//# sourceMappingURL=bottomAccessory.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bottomAccessory.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/bottomAccessory.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAGzE;;;GAGG;AACH,wBAAgB,+CAA+C,CAC7D,eAAe,EACX,YAAY,CAAC,8BAA8B,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GACvF,SAAS,GACZ,4BAA4B,GAAG,SAAS,CAY1C"}

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useBottomAccessoryFunctionFromBottomAccessories = useBottomAccessoryFunctionFromBottomAccessories;
const react_1 = require("react");
const hooks_1 = require("../hooks");
/**
* Converts `<NativeTabs.BottomAccessory>` component into a function,
* which can be used by `react-native-screens` to render the accessory.
*/
function useBottomAccessoryFunctionFromBottomAccessories(bottomAccessory) {
return (0, react_1.useMemo)(() => bottomAccessory
? (environment) => (<hooks_1.BottomAccessoryPlacementContext value={environment}>
{bottomAccessory.props.children}
</hooks_1.BottomAccessoryPlacementContext>)
: undefined, [bottomAccessory]);
}
//# sourceMappingURL=bottomAccessory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bottomAccessory.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/bottomAccessory.tsx"],"names":[],"mappings":";;AAUA,0GAgBC;AA1BD,iCAAmD;AAInD,oCAA2D;AAE3D;;;GAGG;AACH,SAAgB,+CAA+C,CAC7D,eAEa;IAEb,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE,CACH,eAAe;QACb,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CACf,CAAC,uCAA+B,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAClD;cAAA,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,CACjC;YAAA,EAAE,uCAA+B,CAAC,CACnC;QACH,CAAC,CAAC,SAAS,EACf,CAAC,eAAe,CAAC,CAClB,CAAC;AACJ,CAAC","sourcesContent":["import { useMemo, type ReactElement } from 'react';\nimport type { TabAccessoryComponentFactory } from 'react-native-screens';\n\nimport type { NativeTabsBottomAccessoryProps } from '../common/elements';\nimport { BottomAccessoryPlacementContext } from '../hooks';\n\n/**\n * Converts `<NativeTabs.BottomAccessory>` component into a function,\n * which can be used by `react-native-screens` to render the accessory.\n */\nexport function useBottomAccessoryFunctionFromBottomAccessories(\n bottomAccessory:\n | ReactElement<NativeTabsBottomAccessoryProps, string | React.JSXElementConstructor<any>>\n | undefined\n): TabAccessoryComponentFactory | undefined {\n return useMemo<TabAccessoryComponentFactory | undefined>(\n () =>\n bottomAccessory\n ? (environment) => (\n <BottomAccessoryPlacementContext value={environment}>\n {bottomAccessory.props.children}\n </BottomAccessoryPlacementContext>\n )\n : undefined,\n [bottomAccessory]\n );\n}\n"]}

View File

@@ -0,0 +1,32 @@
import type { ColorValue, ImageSourcePropType } from 'react-native';
import type { TabsScreenProps, PlatformIconAndroid, PlatformIconIOS } from 'react-native-screens';
import type { SFSymbol } from 'sf-symbols-typescript';
import type { NativeTabOptions, NativeTabsProps } from '../types';
export declare function convertIconColorPropToObject(iconColor: NativeTabsProps['iconColor']): {
default?: ColorValue;
selected?: ColorValue;
};
type AwaitedIcon = {
sf?: SFSymbol;
xcasset?: string;
drawable?: string;
} | {
src?: ImageSourcePropType;
renderingMode?: 'template' | 'original';
};
export declare function useAwaitedScreensIcon(icon: NativeTabOptions['icon']): {
sf?: SFSymbol;
xcasset?: string;
drawable?: string;
} | {
src?: ImageSourcePropType;
renderingMode?: "template" | "original";
} | undefined;
export declare function convertOptionsIconToRNScreensPropsIcon(icon: AwaitedIcon | undefined, iconColor?: ColorValue): TabsScreenProps['icon'];
export declare function convertOptionsIconToIOSPropsIcon(icon: AwaitedIcon | undefined, iconColor?: ColorValue): PlatformIconIOS | undefined;
export declare function convertOptionsIconToAndroidPropsIcon(icon: AwaitedIcon): PlatformIconAndroid | undefined;
export declare function convertComponentSrcToImageSource(src: React.ReactElement): {
src: Promise<ImageSourcePropType | null>;
} | undefined;
export {};
//# sourceMappingURL=icon.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/icon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAElE,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG;IACrF,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB,CAUA;AAED,KAAK,WAAW,GACZ;IACE,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACD;IACE,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B,aAAa,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CACzC,CAAC;AAEN,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC;;;;;UAJxD,mBAAmB;oBACT,UAAU,GAAG,UAAU;cAyB5C;AAMD,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,SAAS,CAAC,EAAE,UAAU,GACrB,eAAe,CAAC,MAAM,CAAC,CAQzB;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,SAAS,CAAC,EAAE,UAAU,GACrB,eAAe,GAAG,SAAS,CAqB7B;AAED,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,WAAW,GAChB,mBAAmB,GAAG,SAAS,CAWjC;AAED,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,KAAK,CAAC,YAAY;;cAUvE"}

View File

@@ -0,0 +1,101 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertIconColorPropToObject = convertIconColorPropToObject;
exports.useAwaitedScreensIcon = useAwaitedScreensIcon;
exports.convertOptionsIconToRNScreensPropsIcon = convertOptionsIconToRNScreensPropsIcon;
exports.convertOptionsIconToIOSPropsIcon = convertOptionsIconToIOSPropsIcon;
exports.convertOptionsIconToAndroidPropsIcon = convertOptionsIconToAndroidPropsIcon;
exports.convertComponentSrcToImageSource = convertComponentSrcToImageSource;
const react_1 = require("react");
const children_1 = require("../../utils/children");
const elements_1 = require("../common/elements");
function convertIconColorPropToObject(iconColor) {
if (iconColor) {
if (typeof iconColor === 'object' && ('default' in iconColor || 'selected' in iconColor)) {
return iconColor;
}
return {
default: iconColor,
};
}
return {};
}
function useAwaitedScreensIcon(icon) {
const src = icon && typeof icon === 'object' && 'src' in icon ? icon.src : undefined;
const [awaitedIcon, setAwaitedIcon] = (0, react_1.useState)(undefined);
(0, react_1.useEffect)(() => {
const loadIcon = async () => {
if (src && src instanceof Promise) {
const awaitedSrc = await src;
if (awaitedSrc) {
const currentAwaitedIcon = { src: awaitedSrc };
setAwaitedIcon(currentAwaitedIcon);
}
}
};
loadIcon();
// Checking `src` rather then icon here, to avoid unnecessary re-renders
// The icon object can be recreated, while src should stay the same
// In this case as we control `VectorIcon`, it will only change if `family` or `name` props change
// So we should be safe with promise resolving
}, [src]);
return (0, react_1.useMemo)(() => (isAwaitedIcon(icon) ? icon : awaitedIcon), [awaitedIcon, icon]);
}
function isAwaitedIcon(icon) {
return !icon || !('src' in icon && icon.src instanceof Promise);
}
function convertOptionsIconToRNScreensPropsIcon(icon, iconColor) {
if (!icon) {
return undefined;
}
return {
ios: convertOptionsIconToIOSPropsIcon(icon, iconColor),
android: convertOptionsIconToAndroidPropsIcon(icon),
};
}
function convertOptionsIconToIOSPropsIcon(icon, iconColor) {
if (icon && 'sf' in icon && icon.sf) {
return {
type: 'sfSymbol',
name: icon.sf,
};
}
if (icon && (('xcasset' in icon && icon.xcasset) || ('src' in icon && icon.src))) {
const imageSource = 'xcasset' in icon && icon.xcasset
? { uri: icon.xcasset }
: icon.src;
const renderingMode = 'renderingMode' in icon ? icon.renderingMode : undefined;
const effectiveRenderingMode = renderingMode ?? (iconColor !== undefined ? 'template' : 'original');
if (effectiveRenderingMode === 'original') {
return { type: 'imageSource', imageSource };
}
return { type: 'templateSource', templateSource: imageSource };
}
return undefined;
}
function convertOptionsIconToAndroidPropsIcon(icon) {
if (icon && 'drawable' in icon && icon.drawable) {
return {
type: 'drawableResource',
name: icon.drawable,
};
}
if (icon && 'src' in icon && icon.src) {
return { type: 'imageSource', imageSource: icon.src };
}
return undefined;
}
function convertComponentSrcToImageSource(src) {
if ((0, children_1.isChildOfType)(src, elements_1.NativeTabsTriggerVectorIcon)) {
const props = src.props;
return { src: props.family.getImageSource(props.name, 24, 'white') };
}
else if ((0, children_1.isChildOfType)(src, elements_1.NativeTabsTriggerPromiseIcon)) {
return { src: src.props.loader() };
}
else {
console.warn('Only VectorIcon is supported as a React element in Icon.src');
}
return undefined;
}
//# sourceMappingURL=icon.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
export { convertLabelStylePropToObject } from './label';
export { convertIconColorPropToObject } from './icon';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,QAAQ,CAAC"}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertIconColorPropToObject = exports.convertLabelStylePropToObject = void 0;
var label_1 = require("./label");
Object.defineProperty(exports, "convertLabelStylePropToObject", { enumerable: true, get: function () { return label_1.convertLabelStylePropToObject; } });
var icon_1 = require("./icon");
Object.defineProperty(exports, "convertIconColorPropToObject", { enumerable: true, get: function () { return icon_1.convertIconColorPropToObject; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/index.ts"],"names":[],"mappings":";;;AAAA,iCAAwD;AAA/C,sHAAA,6BAA6B,OAAA;AACtC,+BAAsD;AAA7C,oHAAA,4BAA4B,OAAA","sourcesContent":["export { convertLabelStylePropToObject } from './label';\nexport { convertIconColorPropToObject } from './icon';\n"]}

View File

@@ -0,0 +1,6 @@
import type { NativeTabsLabelStyle, NativeTabsProps } from '../types';
export declare function convertLabelStylePropToObject(labelStyle: NativeTabsProps['labelStyle']): {
default?: NativeTabsLabelStyle;
selected?: NativeTabsLabelStyle;
};
//# sourceMappingURL=label.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/label.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEtE,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG;IACxF,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAaA"}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertLabelStylePropToObject = convertLabelStylePropToObject;
const react_native_1 = require("react-native");
function convertLabelStylePropToObject(labelStyle) {
if (labelStyle) {
if (typeof labelStyle === 'object' && ('default' in labelStyle || 'selected' in labelStyle)) {
return {
default: labelStyle.default ? react_native_1.StyleSheet.flatten(labelStyle.default) : undefined,
selected: labelStyle.selected ? react_native_1.StyleSheet.flatten(labelStyle.selected) : undefined,
};
}
return {
default: react_native_1.StyleSheet.flatten(labelStyle),
};
}
return {};
}
//# sourceMappingURL=label.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/label.ts"],"names":[],"mappings":";;AAIA,sEAgBC;AApBD,+CAA0D;AAI1D,SAAgB,6BAA6B,CAAC,UAAyC;IAIrF,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,SAAS,IAAI,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC,EAAE,CAAC;YAC5F,OAAO;gBACL,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;gBAChF,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;aACpF,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO,EAAE,yBAAU,CAAC,OAAO,CAAC,UAA6C,CAAC;SAC3E,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import { StyleSheet, type StyleProp } from 'react-native';\n\nimport type { NativeTabsLabelStyle, NativeTabsProps } from '../types';\n\nexport function convertLabelStylePropToObject(labelStyle: NativeTabsProps['labelStyle']): {\n default?: NativeTabsLabelStyle;\n selected?: NativeTabsLabelStyle;\n} {\n if (labelStyle) {\n if (typeof labelStyle === 'object' && ('default' in labelStyle || 'selected' in labelStyle)) {\n return {\n default: labelStyle.default ? StyleSheet.flatten(labelStyle.default) : undefined,\n selected: labelStyle.selected ? StyleSheet.flatten(labelStyle.selected) : undefined,\n };\n }\n return {\n default: StyleSheet.flatten(labelStyle as StyleProp<NativeTabsLabelStyle>),\n };\n }\n return {};\n}\n"]}

View File

@@ -0,0 +1,4 @@
import { convertComponentSrcToImageSource } from './icon';
import { type MaterialIcon } from '../common/elements';
export declare function convertMaterialIconNameToImageSource(name: MaterialIcon['md']): ReturnType<typeof convertComponentSrcToImageSource>;
//# sourceMappingURL=materialIconConverter.android.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"materialIconConverter.android.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/materialIconConverter.android.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gCAAgC,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAErF,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,GACvB,UAAU,CAAC,OAAO,gCAAgC,CAAC,CAMrD"}

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertMaterialIconNameToImageSource = convertMaterialIconNameToImageSource;
const expo_symbols_1 = require("expo-symbols");
const icon_1 = require("./icon");
const elements_1 = require("../common/elements");
function convertMaterialIconNameToImageSource(name) {
return (0, icon_1.convertComponentSrcToImageSource)(<elements_1.NativeTabsTriggerPromiseIcon loader={() => (0, expo_symbols_1.unstable_getMaterialSymbolSourceAsync)(name, 24, 'white')}/>);
}
//# sourceMappingURL=materialIconConverter.android.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"materialIconConverter.android.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/materialIconConverter.android.tsx"],"names":[],"mappings":";;AAKA,oFAQC;AAbD,+CAAqE;AAErE,iCAA0D;AAC1D,iDAAqF;AAErF,SAAgB,oCAAoC,CAClD,IAAwB;IAExB,OAAO,IAAA,uCAAgC,EACrC,CAAC,uCAA4B,CAC3B,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,IAAA,oDAAqC,EAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,EACvE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { unstable_getMaterialSymbolSourceAsync } from 'expo-symbols';\n\nimport { convertComponentSrcToImageSource } from './icon';\nimport { NativeTabsTriggerPromiseIcon, type MaterialIcon } from '../common/elements';\n\nexport function convertMaterialIconNameToImageSource(\n name: MaterialIcon['md']\n): ReturnType<typeof convertComponentSrcToImageSource> {\n return convertComponentSrcToImageSource(\n <NativeTabsTriggerPromiseIcon\n loader={() => unstable_getMaterialSymbolSourceAsync(name, 24, 'white')}\n />\n );\n}\n"]}

View File

@@ -0,0 +1,4 @@
import type { convertComponentSrcToImageSource } from './icon';
import type { MaterialIcon } from '../common/elements';
export declare function convertMaterialIconNameToImageSource(name: MaterialIcon['md']): ReturnType<typeof convertComponentSrcToImageSource>;
//# sourceMappingURL=materialIconConverter.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"materialIconConverter.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/utils/materialIconConverter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,GACvB,UAAU,CAAC,OAAO,gCAAgC,CAAC,CAKrD"}

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertMaterialIconNameToImageSource = convertMaterialIconNameToImageSource;
function convertMaterialIconNameToImageSource(name) {
console.warn('Using convertMaterialIconNameToImageSource on unsupported platform. This is most likely an internal expo router bug.');
return undefined;
}
//# sourceMappingURL=materialIconConverter.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"materialIconConverter.js","sourceRoot":"","sources":["../../../src/native-tabs/utils/materialIconConverter.tsx"],"names":[],"mappings":";;AAGA,oFAOC;AAPD,SAAgB,oCAAoC,CAClD,IAAwB;IAExB,OAAO,CAAC,IAAI,CACV,sHAAsH,CACvH,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { convertComponentSrcToImageSource } from './icon';\nimport type { MaterialIcon } from '../common/elements';\n\nexport function convertMaterialIconNameToImageSource(\n name: MaterialIcon['md']\n): ReturnType<typeof convertComponentSrcToImageSource> {\n console.warn(\n 'Using convertMaterialIconNameToImageSource on unsupported platform. This is most likely an internal expo router bug.'\n );\n return undefined;\n}\n"]}