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,226 @@
import type { AndroidSymbol } from 'expo-symbols';
import type { ColorValue, ImageSourcePropType, StyleProp } from 'react-native';
import type { SFSymbol } from 'sf-symbols-typescript';
import { VectorIcon } from '../../primitives';
import type { NativeTabsLabelStyle } from '../types';
export interface NativeTabsTriggerLabelProps {
/**
* The text to display as the label for the tab.
*/
children?: string;
selectedStyle?: StyleProp<NativeTabsLabelStyle>;
/**
* If true, the label will be hidden.
* @default false
*/
hidden?: boolean;
}
export declare const NativeTabsTriggerLabel: React.FC<NativeTabsTriggerLabelProps>;
export interface SrcIcon {
/**
* The image source to use as an icon.
*
* When `sf` prop is used it will override this prop on iOS.
*
* When `drawable` or `material` prop is used it will override this prop on Android.
*
* The value can be provided in two ways:
* - As an image source
* - As an object specifying the default and selected states
*
* @example
* ```tsx
* <Icon src={require('./path/to/icon.png')} />
* ```
*
* @example
* ```tsx
* <Icon src={{ default: require('./path/to/icon.png'), selected: require('./path/to/icon-selected.png') }} />
* ```
*
* @platform Android
* @platform iOS
*/
src?: ImageSourcePropType | React.ReactElement | {
default?: ImageSourcePropType | React.ReactElement;
selected: ImageSourcePropType | React.ReactElement;
};
/**
* Controls how the image icon is rendered on iOS.
*
* - `'template'`: iOS applies tint color to the icon (selected/unselected states)
* - `'original'`: Preserves original icon colors
*
* **Default behavior:**
* - If tab bar icon color is configured, defaults to `'template'`
* - If no icon color is set, defaults to `'original'`
*
* @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiimage/renderingmode-swift.enum) for more information.
*
* @platform ios
*/
renderingMode?: 'template' | 'original';
}
export interface SFSymbolIcon {
/**
* The name of the SF Symbol to use as an icon.
*
* The value can be provided in two ways:
* - As a string with the SF Symbol name
* - As an object specifying the default and selected states
*
* @example
* ```tsx
* <Icon sf="magnifyingglass" />
* ```
*
* @example
* ```tsx
* <Icon sf={{ default: "house", selected: "house.fill" }} />
* ```
*
* @platform iOS
*/
sf?: SFSymbol | {
default?: SFSymbol;
selected: SFSymbol;
};
}
export interface XcassetIcon {
/**
* The name of the iOS asset catalog image to use as an icon.
*
* Xcassets provide automatic multi-resolution (@1x/@2x/@3x), dark mode variants,
* and device-specific images via `[UIImage imageNamed:]`.
*
* The rendering mode (template vs original) can be controlled via the `renderingMode` prop
* on the `Icon` component. By default, icons are tinted when `iconColor` is set, and
* rendered as original otherwise.
*
* The value can be provided in two ways:
* - As a string with the asset catalog image name
* - As an object specifying the default and selected states
*
* @example
* ```tsx
* <Icon xcasset="custom-icon" />
* ```
*
* @example
* ```tsx
* <Icon xcasset={{ default: "home-outline", selected: "home-filled" }} />
* ```
*
* @platform iOS
*/
xcasset?: string | {
default?: string;
selected: string;
};
}
export interface DrawableIcon {
/**
* The name of the drawable resource to use as an icon.
* @platform android
*/
drawable?: string;
}
/**
* Material icon name for Android native tabs.
*
* @platform android
*/
export interface MaterialIcon {
/**
* Material icon glyph name. See the [Material icons for the complete catalog](https://fonts.google.com/icons).
*/
md: AndroidSymbol;
}
export type BaseNativeTabsTriggerIconProps = {
selectedColor?: ColorValue;
};
export type NativeTabsTriggerIconProps = BaseNativeTabsTriggerIconProps & ((SFSymbolIcon & DrawableIcon) | (SFSymbolIcon & MaterialIcon) | (SFSymbolIcon & SrcIcon) | (XcassetIcon & DrawableIcon) | (XcassetIcon & MaterialIcon) | (XcassetIcon & SrcIcon) | (MaterialIcon & SrcIcon) | (DrawableIcon & SrcIcon) | SrcIcon);
/**
* Renders an icon for the tab.
*
* Accepts various icon sources such as SF Symbols, xcasset images, drawable resources, material icons, or image sources.
*
* Acceptable props combinations:
* - `sf` and `drawable` - `sf` will be used for iOS icon, `drawable` for Android icon
* - `sf` and `src` - `sf` will be used for iOS icon, `src` for Android icon
* - `xcasset` and `drawable` - `xcasset` will be used for iOS icon, `drawable` for Android icon
* - `xcasset` and `md` - `xcasset` will be used for iOS icon, `md` for Android icon
* - `xcasset` and `src` - `xcasset` will be used for iOS icon, `src` for Android icon
* - `src` and `drawable` - `src` will be used for iOS icon, `drawable` for Android icon
* - `src` only - `src` will be used for both iOS and Android icons
*
* Priority on iOS: `sf` > `xcasset` > `src`. Priority on Android: `drawable` > `md` > `src`.
*
* @platform ios
* @platform android
*/
export declare const NativeTabsTriggerIcon: React.FC<NativeTabsTriggerIconProps>;
/**
* Helper component which can be used to load vector icons for `NativeTabs`.
*
* @example
* ```tsx
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
* import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
*
* export default Layout(){
* return (
* <NativeTabs>
* <NativeTabs.Trigger name="index">
* <NativeTabs.Trigger.Icon src={<NativeTabs.Trigger.VectorIcon family={MaterialCommunityIcons} name="home" />} />
* </NativeTabs.Trigger>
* </NativeTabs>
* );
* }
* ```
*/
export declare const NativeTabsTriggerVectorIcon: typeof VectorIcon;
export interface NativeTabsTriggerPromiseIconProps {
loader: () => Promise<ImageSourcePropType | null>;
}
export declare const NativeTabsTriggerPromiseIcon: (props: NativeTabsTriggerPromiseIconProps) => null;
export interface NativeTabsTriggerBadgeProps {
/**
* The text to display as the badge for the tab.
* If not provided, the badge will not be displayed.
*/
children?: string;
/**
* If true, the badge will be hidden.
* @default false
*/
hidden?: boolean;
selectedBackgroundColor?: ColorValue;
}
export declare const NativeTabsTriggerBadge: React.FC<NativeTabsTriggerBadgeProps>;
export interface NativeTabsBottomAccessoryProps {
children?: React.ReactNode;
}
/**
* A [bottom accessory](https://developer.apple.com/documentation/uikit/uitabbarcontroller/bottomaccessory) for `NativeTabs` on iOS 26 and above.
*
* @example
* ```tsx
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
*
* export default Layout(){
* return (
* <NativeTabs>
* <NativeTabs.BottomAccessory>
* <YourAccessoryComponent />
* </NativeTabs.BottomAccessory>
* <NativeTabs.Trigger name="index" />
* </NativeTabs>
* );
* }
* ```
*
* @platform iOS 26+
*/
export declare const NativeTabsBottomAccessory: React.FC<NativeTabsBottomAccessoryProps>;
//# sourceMappingURL=elements.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAsB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAC;IAChD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAAS,CAAC;AAEnF,MAAM,WAAW,OAAO;IACtB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,GAAG,CAAC,EACA,mBAAmB,GACnB,KAAK,CAAC,YAAY,GAClB;QACE,OAAO,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAAC;QACnD,QAAQ,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAAC;KACpD,CAAC;IACN;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CACzC;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;;;;;;;;OAkBG;IACH,EAAE,CAAC,EAAE,QAAQ,GAAG;QAAE,OAAO,CAAC,EAAE,QAAQ,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,CAA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IAElB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uBAAuB,CAAC,EAAE,UAAU,CAAC;CACtC;AAED,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAAS,CAAC;AAEnF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAE9E,CAAC"}

View File

@@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NativeTabsBottomAccessory = exports.NativeTabsTriggerBadge = exports.NativeTabsTriggerPromiseIcon = exports.NativeTabsTriggerVectorIcon = exports.NativeTabsTriggerIcon = exports.NativeTabsTriggerLabel = void 0;
const primitives_1 = require("../../primitives");
exports.NativeTabsTriggerLabel = primitives_1.Label;
/**
* Renders an icon for the tab.
*
* Accepts various icon sources such as SF Symbols, xcasset images, drawable resources, material icons, or image sources.
*
* Acceptable props combinations:
* - `sf` and `drawable` - `sf` will be used for iOS icon, `drawable` for Android icon
* - `sf` and `src` - `sf` will be used for iOS icon, `src` for Android icon
* - `xcasset` and `drawable` - `xcasset` will be used for iOS icon, `drawable` for Android icon
* - `xcasset` and `md` - `xcasset` will be used for iOS icon, `md` for Android icon
* - `xcasset` and `src` - `xcasset` will be used for iOS icon, `src` for Android icon
* - `src` and `drawable` - `src` will be used for iOS icon, `drawable` for Android icon
* - `src` only - `src` will be used for both iOS and Android icons
*
* Priority on iOS: `sf` > `xcasset` > `src`. Priority on Android: `drawable` > `md` > `src`.
*
* @platform ios
* @platform android
*/
exports.NativeTabsTriggerIcon = primitives_1.Icon;
/**
* Helper component which can be used to load vector icons for `NativeTabs`.
*
* @example
* ```tsx
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
* import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
*
* export default Layout(){
* return (
* <NativeTabs>
* <NativeTabs.Trigger name="index">
* <NativeTabs.Trigger.Icon src={<NativeTabs.Trigger.VectorIcon family={MaterialCommunityIcons} name="home" />} />
* </NativeTabs.Trigger>
* </NativeTabs>
* );
* }
* ```
*/
exports.NativeTabsTriggerVectorIcon = primitives_1.VectorIcon;
const NativeTabsTriggerPromiseIcon = function NativeTabsTriggerPromiseIcon(props) {
return null;
};
exports.NativeTabsTriggerPromiseIcon = NativeTabsTriggerPromiseIcon;
exports.NativeTabsTriggerBadge = primitives_1.Badge;
/**
* A [bottom accessory](https://developer.apple.com/documentation/uikit/uitabbarcontroller/bottomaccessory) for `NativeTabs` on iOS 26 and above.
*
* @example
* ```tsx
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
*
* export default Layout(){
* return (
* <NativeTabs>
* <NativeTabs.BottomAccessory>
* <YourAccessoryComponent />
* </NativeTabs.BottomAccessory>
* <NativeTabs.Trigger name="index" />
* </NativeTabs>
* );
* }
* ```
*
* @platform iOS 26+
*/
const NativeTabsBottomAccessory = () => {
return null;
};
exports.NativeTabsBottomAccessory = NativeTabsBottomAccessory;
//# sourceMappingURL=elements.js.map

File diff suppressed because one or more lines are too long