expo-router 7.0.0-canary-20251120-e46b3cc → 7.0.0-canary-20251205-756eb7a
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/android/build.gradle +2 -2
- package/build/fork/getStateFromPath-forks.d.ts +5 -10
- package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
- package/build/fork/getStateFromPath-forks.js +14 -13
- package/build/fork/getStateFromPath-forks.js.map +1 -1
- package/build/fork/getStateFromPath.js +3 -3
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.d.ts.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.js +25 -7
- package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
- package/build/fork/native-stack/descriptors-context.d.ts +8 -0
- package/build/fork/native-stack/descriptors-context.d.ts.map +1 -0
- package/build/fork/native-stack/descriptors-context.js +6 -0
- package/build/fork/native-stack/descriptors-context.js.map +1 -0
- package/build/internal/utils.d.ts +1 -0
- package/build/internal/utils.d.ts.map +1 -1
- package/build/internal/utils.js +3 -1
- package/build/internal/utils.js.map +1 -1
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js +39 -5
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderComponent.js +6 -6
- package/build/layouts/stack-utils/StackHeaderComponent.js.map +1 -1
- package/build/layouts/stack-utils/StackHeaderTitle.d.ts.map +1 -1
- package/build/layouts/stack-utils/StackHeaderTitle.js +3 -8
- package/build/layouts/stack-utils/StackHeaderTitle.js.map +1 -1
- package/build/layouts/stack-utils/index.d.ts +0 -1
- package/build/layouts/stack-utils/index.d.ts.map +1 -1
- package/build/layouts/stack-utils/index.js +1 -3
- package/build/layouts/stack-utils/index.js.map +1 -1
- package/build/link/ExpoLink.d.ts.map +1 -1
- package/build/link/ExpoLink.js +12 -4
- package/build/link/ExpoLink.js.map +1 -1
- package/build/link/Link.d.ts +2 -0
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +2 -0
- package/build/link/Link.js.map +1 -1
- package/build/link/LinkWithPreview.d.ts +6 -1
- package/build/link/LinkWithPreview.d.ts.map +1 -1
- package/build/link/LinkWithPreview.js +10 -11
- package/build/link/LinkWithPreview.js.map +1 -1
- package/build/link/elements.d.ts +8 -0
- package/build/link/elements.d.ts.map +1 -1
- package/build/link/elements.js +7 -2
- package/build/link/elements.js.map +1 -1
- package/build/link/preview/native.d.ts +17 -0
- package/build/link/preview/native.d.ts.map +1 -1
- package/build/link/preview/native.js +22 -0
- package/build/link/preview/native.js.map +1 -1
- package/build/link/zoom/ZoomTransitionEnabler.d.ts +5 -0
- package/build/link/zoom/ZoomTransitionEnabler.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts +5 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.js +44 -0
- package/build/link/zoom/ZoomTransitionEnabler.ios.js.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.js +13 -0
- package/build/link/zoom/ZoomTransitionEnabler.js.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.d.ts +4 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.d.ts.map +1 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.js +3 -0
- package/build/link/zoom/ZoomTransitionEnabler.types.js.map +1 -0
- package/build/link/zoom/link-apple-zoom.d.ts +23 -0
- package/build/link/zoom/link-apple-zoom.d.ts.map +1 -0
- package/build/link/zoom/link-apple-zoom.js +40 -0
- package/build/link/zoom/link-apple-zoom.js.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.d.ts +6 -0
- package/build/link/zoom/useZoomTransitionPrimitives.d.ts.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.d.ts +11 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.d.ts.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js +66 -0
- package/build/link/zoom/useZoomTransitionPrimitives.ios.js.map +1 -0
- package/build/link/zoom/useZoomTransitionPrimitives.js +9 -0
- package/build/link/zoom/useZoomTransitionPrimitives.js.map +1 -0
- package/build/link/zoom/zoom-transition-context.d.ts +7 -0
- package/build/link/zoom/zoom-transition-context.d.ts.map +1 -0
- package/build/link/zoom/zoom-transition-context.js +6 -0
- package/build/link/zoom/zoom-transition-context.js.map +1 -0
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts +3 -15
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabsNavigator.js +17 -2
- package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -1
- package/build/native-tabs/NativeBottomTabsRouter.d.ts.map +1 -1
- package/build/native-tabs/NativeBottomTabsRouter.js +12 -1
- package/build/native-tabs/NativeBottomTabsRouter.js.map +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts +2 -2
- package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -1
- package/build/native-tabs/NativeTabTrigger.js +24 -14
- package/build/native-tabs/NativeTabTrigger.js.map +1 -1
- package/build/native-tabs/NativeTabs.d.ts +6 -3
- package/build/native-tabs/NativeTabs.d.ts.map +1 -1
- package/build/native-tabs/NativeTabs.js +7 -2
- package/build/native-tabs/NativeTabs.js.map +1 -1
- package/build/native-tabs/NativeTabsView.d.ts.map +1 -1
- package/build/native-tabs/NativeTabsView.js +26 -3
- package/build/native-tabs/NativeTabsView.js.map +1 -1
- package/build/native-tabs/appearance.d.ts.map +1 -1
- package/build/native-tabs/appearance.js +2 -4
- package/build/native-tabs/appearance.js.map +1 -1
- package/build/native-tabs/common/elements.d.ts +36 -3
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js +30 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/hooks.d.ts +45 -0
- package/build/native-tabs/hooks.d.ts.map +1 -0
- package/build/native-tabs/hooks.js +57 -0
- package/build/native-tabs/hooks.js.map +1 -0
- package/build/native-tabs/index.d.ts +1 -1
- package/build/native-tabs/index.d.ts.map +1 -1
- package/build/native-tabs/index.js.map +1 -1
- package/build/native-tabs/types.d.ts +42 -55
- package/build/native-tabs/types.d.ts.map +1 -1
- package/build/native-tabs/types.js.map +1 -1
- package/build/native-tabs/utils/bottomAccessory.d.ts +9 -0
- package/build/native-tabs/utils/bottomAccessory.d.ts.map +1 -0
- package/build/native-tabs/utils/bottomAccessory.js +17 -0
- package/build/native-tabs/utils/bottomAccessory.js.map +1 -0
- package/build/native-tabs/utils/icon.d.ts +3 -0
- package/build/native-tabs/utils/icon.d.ts.map +1 -1
- package/build/native-tabs/utils/icon.js +16 -0
- package/build/native-tabs/utils/icon.js.map +1 -1
- package/build/native-tabs/utils/index.d.ts +0 -1
- package/build/native-tabs/utils/index.d.ts.map +1 -1
- package/build/native-tabs/utils/index.js +1 -4
- package/build/native-tabs/utils/index.js.map +1 -1
- package/build/native-tabs/utils/label.d.ts.map +1 -1
- package/build/native-tabs/utils/label.js +6 -2
- package/build/native-tabs/utils/label.js.map +1 -1
- package/build/native-tabs/utils/materialIconConverter.android.d.ts +4 -0
- package/build/native-tabs/utils/materialIconConverter.android.d.ts.map +1 -0
- package/build/native-tabs/utils/materialIconConverter.android.js +10 -0
- package/build/native-tabs/utils/materialIconConverter.android.js.map +1 -0
- package/build/native-tabs/utils/materialIconConverter.d.ts +4 -0
- package/build/native-tabs/utils/materialIconConverter.d.ts.map +1 -0
- package/build/native-tabs/utils/materialIconConverter.js +8 -0
- package/build/native-tabs/utils/materialIconConverter.js.map +1 -0
- package/build/navigationParams.d.ts +5 -1
- package/build/navigationParams.d.ts.map +1 -1
- package/build/navigationParams.js +32 -8
- package/build/navigationParams.js.map +1 -1
- package/build/toolbar/elements.d.ts +24 -0
- package/build/toolbar/elements.d.ts.map +1 -0
- package/build/toolbar/elements.js +36 -0
- package/build/toolbar/elements.js.map +1 -0
- package/build/toolbar/index.d.ts +9 -0
- package/build/toolbar/index.d.ts.map +1 -0
- package/build/toolbar/index.js +12 -0
- package/build/toolbar/index.js.map +1 -0
- package/build/toolbar/native.d.ts +4 -0
- package/build/toolbar/native.d.ts.map +1 -0
- package/build/toolbar/native.ios.d.ts +4 -0
- package/build/toolbar/native.ios.d.ts.map +1 -0
- package/build/toolbar/native.ios.js +21 -0
- package/build/toolbar/native.ios.js.map +1 -0
- package/build/toolbar/native.js +11 -0
- package/build/toolbar/native.js.map +1 -0
- package/build/toolbar/native.types.d.ts +30 -0
- package/build/toolbar/native.types.d.ts.map +1 -0
- package/build/toolbar/native.types.js +3 -0
- package/build/toolbar/native.types.js.map +1 -0
- package/build/useScreens.d.ts.map +1 -1
- package/build/useScreens.js +14 -0
- package/build/useScreens.js.map +1 -1
- package/build/utils/children.d.ts +7 -0
- package/build/utils/children.d.ts.map +1 -0
- package/build/utils/children.js +24 -0
- package/build/utils/children.js.map +1 -0
- package/build/utils/style.d.ts +3 -0
- package/build/utils/style.d.ts.map +1 -0
- package/build/utils/style.js +10 -0
- package/build/utils/style.js.map +1 -0
- package/build/views/Sitemap.js +3 -2
- package/build/views/Sitemap.js.map +1 -1
- package/expo-module.config.json +2 -2
- package/ios/LinkPreview/LinkPreviewNativeActionView.swift +1 -0
- package/ios/LinkPreview/LinkPreviewNativeModule.swift +49 -1
- package/ios/LinkPreview/LinkPreviewNativeNavigation.swift +132 -70
- package/ios/LinkPreview/LinkPreviewNativeView.swift +34 -17
- package/ios/LinkPreview/LinkZoomTransition.swift +227 -0
- package/ios/Toolbar/RouterToolbarHostView.swift +140 -0
- package/ios/Toolbar/RouterToolbarItemView.swift +171 -0
- package/ios/Toolbar/RouterToolbarModule.swift +102 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module} +7 -7
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom} +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/maven-metadata.xml.sha512 +1 -1
- package/package.json +17 -14
- package/unstable-toolbar.d.ts +1 -0
- package/unstable-toolbar.js +1 -0
- package/build/layouts/stack-utils/utils.d.ts +0 -3
- package/build/layouts/stack-utils/utils.d.ts.map +0 -1
- package/build/layouts/stack-utils/utils.js +0 -8
- package/build/layouts/stack-utils/utils.js.map +0 -1
- package/build/native-tabs/utils/children.d.ts +0 -5
- package/build/native-tabs/utils/children.d.ts.map +0 -1
- package/build/native-tabs/utils/children.js +0 -15
- package/build/native-tabs/utils/children.js.map +0 -1
- package/ios/LinkPreview/LinkPreviewNativeNavigation.h +0 -50
- package/ios/LinkPreview/LinkPreviewNativeNavigation.mm +0 -164
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/router/expo.modules.router/7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.md5 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.sha1 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.sha256 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc-sources.jar.sha512 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.md5 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.sha1 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.sha256 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/router/expo.modules.router/{7.0.0-canary-20251120-e46b3cc/expo.modules.router-7.0.0-canary-20251120-e46b3cc.aar.sha512 → 7.0.0-canary-20251205-756eb7a/expo.modules.router-7.0.0-canary-20251205-756eb7a.aar.sha512} +0 -0
|
@@ -34,16 +34,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.NativeTabsView = NativeTabsView;
|
|
37
|
+
const native_1 = require("@react-navigation/native");
|
|
37
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
38
40
|
const react_native_screens_1 = require("react-native-screens");
|
|
41
|
+
const experimental_1 = require("react-native-screens/experimental");
|
|
39
42
|
const appearance_1 = require("./appearance");
|
|
43
|
+
const elements_1 = require("./common/elements");
|
|
40
44
|
const types_1 = require("./types");
|
|
41
45
|
const icon_1 = require("./utils/icon");
|
|
46
|
+
const children_1 = require("../utils/children");
|
|
47
|
+
const bottomAccessory_1 = require("./utils/bottomAccessory");
|
|
42
48
|
// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.
|
|
43
49
|
// Otherwise user may see glitches when switching between tabs.
|
|
44
50
|
react_native_screens_1.featureFlags.experiment.controlledBottomTabs = false;
|
|
45
51
|
function NativeTabsView(props) {
|
|
46
|
-
const { minimizeBehavior, disableIndicator, focusedIndex, tabs, sidebarAdaptable } = props;
|
|
52
|
+
const { minimizeBehavior, disableIndicator, focusedIndex, tabs, sidebarAdaptable, nonTriggerChildren, } = props;
|
|
47
53
|
const deferredFocusedIndex = (0, react_1.useDeferredValue)(focusedIndex);
|
|
48
54
|
// We need to check if the deferred index is not out of bounds
|
|
49
55
|
// This can happen when the focused index is the last tab, and user removes that tab
|
|
@@ -55,6 +61,8 @@ function NativeTabsView(props) {
|
|
|
55
61
|
scrollEdgeAppearance: (0, appearance_1.createScrollEdgeAppearanceFromOptions)(tab.options),
|
|
56
62
|
}));
|
|
57
63
|
const options = tabs.map((tab) => tab.options);
|
|
64
|
+
const bottomAccessory = (0, react_1.useMemo)(() => (0, children_1.getFirstChildOfType)(nonTriggerChildren, elements_1.NativeTabsBottomAccessory), [nonTriggerChildren]);
|
|
65
|
+
const bottomAccessoryFn = (0, bottomAccessory_1.useBottomAccessoryFunctionFromBottomAccessories)(bottomAccessory);
|
|
58
66
|
const children = tabs.map((tab, index) => {
|
|
59
67
|
const isFocused = index === inBoundsDeferredFocusedIndex;
|
|
60
68
|
return (<Screen key={tab.routeKey} routeKey={tab.routeKey} name={tab.name} options={tab.options} isFocused={isFocused} standardAppearance={appearances[index].standardAppearance} scrollEdgeAppearance={appearances[index].scrollEdgeAppearance} badgeTextColor={tab.options.badgeTextColor} contentRenderer={tab.contentRenderer}/>);
|
|
@@ -72,7 +80,7 @@ function NativeTabsView(props) {
|
|
|
72
80
|
tabBarItemActiveIndicatorColor={options[inBoundsDeferredFocusedIndex]?.indicatorColor} tabBarItemActiveIndicatorEnabled={!disableIndicator}
|
|
73
81
|
// #endregion
|
|
74
82
|
// #region iOS props
|
|
75
|
-
tabBarTintColor={props?.tintColor} tabBarMinimizeBehavior={minimizeBehavior} tabBarControllerMode={tabBarControllerMode}
|
|
83
|
+
tabBarTintColor={props?.tintColor} tabBarMinimizeBehavior={minimizeBehavior} tabBarControllerMode={tabBarControllerMode} bottomAccessory={bottomAccessoryFn} tabBarHidden={props.hidden}
|
|
76
84
|
// #endregion
|
|
77
85
|
onNativeFocusChange={({ nativeEvent: { tabKey } }) => {
|
|
78
86
|
props.onTabChange(tabKey);
|
|
@@ -86,8 +94,23 @@ function Screen(props) {
|
|
|
86
94
|
// We need to await the icon, as VectorIcon will load asynchronously
|
|
87
95
|
const icon = (0, icon_1.useAwaitedScreensIcon)(options.icon);
|
|
88
96
|
const selectedIcon = (0, icon_1.useAwaitedScreensIcon)(options.selectedIcon);
|
|
89
|
-
|
|
97
|
+
const { colors } = (0, native_1.useTheme)();
|
|
98
|
+
const content = (<react_native_1.View
|
|
99
|
+
// https://github.com/software-mansion/react-native-screens/issues/2662#issuecomment-2757735088
|
|
100
|
+
collapsable={false} style={[
|
|
101
|
+
{ backgroundColor: colors.background },
|
|
102
|
+
options.contentStyle,
|
|
103
|
+
{ flex: 1, position: 'relative', overflow: 'hidden' },
|
|
104
|
+
]}>
|
|
90
105
|
{contentRenderer()}
|
|
106
|
+
</react_native_1.View>);
|
|
107
|
+
const wrappedContent = process.env.EXPO_OS === 'android' && !options.disableAutomaticContentInsets ? (<experimental_1.SafeAreaView
|
|
108
|
+
// https://github.com/software-mansion/react-native-screens/issues/2662#issuecomment-2757735088
|
|
109
|
+
collapsable={false} style={{ flex: 1 }} edges={{ bottom: true }}>
|
|
110
|
+
{content}
|
|
111
|
+
</experimental_1.SafeAreaView>) : (content);
|
|
112
|
+
return (<react_native_screens_1.BottomTabsScreen {...options} overrideScrollViewContentInsetAdjustmentBehavior={!options.disableAutomaticContentInsets} tabBarItemBadgeBackgroundColor={standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor} tabBarItemBadgeTextColor={badgeTextColor} standardAppearance={standardAppearance} scrollEdgeAppearance={scrollEdgeAppearance} icon={(0, icon_1.convertOptionsIconToRNScreensPropsIcon)(icon)} selectedIcon={(0, icon_1.convertOptionsIconToIOSPropsIcon)(selectedIcon)} title={title} freezeContents={false} systemItem={options.role} {...options.nativeProps} tabKey={routeKey} isFocused={isFocused}>
|
|
113
|
+
{wrappedContent}
|
|
91
114
|
</react_native_screens_1.BottomTabsScreen>);
|
|
92
115
|
}
|
|
93
116
|
const supportedTabBarMinimizeBehaviorsSet = new Set(types_1.SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,wCA6EC;AA3GD,+CAAgD;AAEhD,+DAM8B;AAE9B,6CAGsB;AACtB,mCAKiB;AACjB,uCAIsB;AAEtB,8FAA8F;AAC9F,+DAA+D;AAC/D,mCAAY,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC;AAErD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAE3F,MAAM,oBAAoB,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;IAC5D,8DAA8D;IAC9D,oFAAoF;IACpF,wFAAwF;IACxF,2BAA2B;IAC3B,MAAM,4BAA4B,GAChC,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,CAAC;IAE3E,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACrC,kBAAkB,EAAE,IAAA,gDAAmC,EAAC,GAAG,CAAC,OAAO,CAAC;QACpE,oBAAoB,EAAE,IAAA,kDAAqC,EAAC,GAAG,CAAC,OAAO,CAAC;KACzE,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAG,IAA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,qDAA6C,CAC9C,CAAC;AAEF,SAAS,iBAAiB,CAAC,KAAsB;IAC/C,IAAI,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC/E,IAAI,sBAAsB,IAAI,CAAC,mCAAmC,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAC/F,OAAO,CAAC,IAAI,CACV,iCAAiC,sBAAsB,2BAA2B,4CAAoC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvK,CAAC;QACF,sBAAsB,GAAG,SAAS,CAAC;IACrC,CAAC;IACD,IACE,6BAA6B;QAC7B,CAAC,0CAA0C,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC9E,CAAC;QACD,OAAO,CAAC,IAAI,CACV,oCAAoC,6BAA6B,2BAA2B,qDAA6C,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClL,CAAC;QACF,6BAA6B,GAAG,SAAS,CAAC;IAC5C,CAAC;IAED,OAAO,CACL,CAAC,iCAAU,CACT,6BAA6B,CAAC,CAAC,6BAA6B,CAAC,CAC7D,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAC/C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useDeferredValue } from 'react';\nimport type { ColorValue } from 'react-native';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenAppearance,\n} from 'react-native-screens';\n\nimport {\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\nimport {\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport {\n convertOptionsIconToRNScreensPropsIcon,\n convertOptionsIconToIOSPropsIcon,\n useAwaitedScreensIcon,\n} from './utils/icon';\n\n// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.\n// Otherwise user may see glitches when switching between tabs.\nfeatureFlags.experiment.controlledBottomTabs = false;\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { minimizeBehavior, disableIndicator, focusedIndex, tabs, sidebarAdaptable } = props;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n // We need to check if the deferred index is not out of bounds\n // This can happen when the focused index is the last tab, and user removes that tab\n // In that case the deferred index will still point to the last tab, but after re-render\n // it will be out of bounds\n const inBoundsDeferredFocusedIndex =\n deferredFocusedIndex < tabs.length ? deferredFocusedIndex : focusedIndex;\n\n const appearances = tabs.map((tab) => ({\n standardAppearance: createStandardAppearanceFromOptions(tab.options),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(tab.options),\n }));\n\n const options = tabs.map((tab) => tab.options);\n\n const children = tabs.map((tab, index) => {\n const isFocused = index === inBoundsDeferredFocusedIndex;\n\n return (\n <Screen\n key={tab.routeKey}\n routeKey={tab.routeKey}\n name={tab.name}\n options={tab.options}\n isFocused={isFocused}\n standardAppearance={appearances[index].standardAppearance}\n scrollEdgeAppearance={appearances[index].scrollEdgeAppearance}\n badgeTextColor={tab.options.badgeTextColor}\n contentRenderer={tab.contentRenderer}\n />\n );\n });\n\n const currentTabAppearance = appearances[inBoundsDeferredFocusedIndex]?.standardAppearance;\n const tabBarControllerMode: BottomTabsProps['tabBarControllerMode'] = sidebarAdaptable\n ? 'tabSidebar'\n : sidebarAdaptable === false\n ? 'tabBar'\n : 'automatic';\n\n return (\n <BottomTabsWrapper\n // #region android props\n tabBarItemTitleFontColor={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontColor}\n tabBarItemTitleFontFamily={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontFamily}\n tabBarItemTitleFontSize={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontSizeActive={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontWeight={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontWeight}\n tabBarItemTitleFontStyle={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontStyle}\n tabBarItemIconColor={currentTabAppearance?.stacked?.normal?.tabBarItemIconColor}\n tabBarBackgroundColor={currentTabAppearance?.tabBarBackgroundColor}\n tabBarItemRippleColor={props.rippleColor}\n tabBarItemLabelVisibilityMode={props.labelVisibilityMode}\n tabBarItemIconColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemIconColor ?? props?.tintColor\n }\n tabBarItemTitleFontColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemTitleFontColor ?? props?.tintColor\n }\n // tabBarItemTitleFontSizeActive={activeStyle?.fontSize}\n tabBarItemActiveIndicatorColor={options[inBoundsDeferredFocusedIndex]?.indicatorColor}\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n // #endregion\n // #region iOS props\n tabBarTintColor={props?.tintColor}\n tabBarMinimizeBehavior={minimizeBehavior}\n tabBarControllerMode={tabBarControllerMode}\n // #endregion\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n props.onTabChange(tabKey);\n }}>\n {children}\n </BottomTabsWrapper>\n );\n}\n\nfunction Screen(props: {\n routeKey: string;\n name: string;\n isFocused: boolean;\n options: NativeTabOptions;\n standardAppearance: BottomTabsScreenAppearance;\n scrollEdgeAppearance: BottomTabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n contentRenderer: () => React.ReactNode;\n}) {\n const {\n routeKey,\n name,\n options,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n contentRenderer,\n } = props;\n const title = options.title ?? name;\n\n // We need to await the icon, as VectorIcon will load asynchronously\n const icon = useAwaitedScreensIcon(options.icon);\n const selectedIcon = useAwaitedScreensIcon(options.selectedIcon);\n\n return (\n <BottomTabsScreen\n {...options}\n tabBarItemBadgeBackgroundColor={\n standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor\n }\n tabBarItemBadgeTextColor={badgeTextColor}\n standardAppearance={standardAppearance}\n scrollEdgeAppearance={scrollEdgeAppearance}\n icon={convertOptionsIconToRNScreensPropsIcon(icon)}\n selectedIcon={convertOptionsIconToIOSPropsIcon(selectedIcon)}\n title={title}\n freezeContents={false}\n systemItem={options.role}\n {...options.nativeProps}\n tabKey={routeKey}\n isFocused={isFocused}>\n {contentRenderer()}\n </BottomTabsScreen>\n );\n}\n\nconst supportedTabBarMinimizeBehaviorsSet = new Set<string>(SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);\nconst supportedTabBarItemLabelVisibilityModesSet = new Set<string>(\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES\n);\n\nfunction BottomTabsWrapper(props: BottomTabsProps) {\n let { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, ...rest } = props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n console.warn(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n tabBarMinimizeBehavior = undefined;\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n console.warn(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n tabBarItemLabelVisibilityMode = undefined;\n }\n\n return (\n <BottomTabs\n tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode}\n tabBarMinimizeBehavior={tabBarMinimizeBehavior}\n {...rest}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NativeTabsView.js","sourceRoot":"","sources":["../../src/native-tabs/NativeTabsView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,wCA6FC;AAhID,qDAAoD;AACpD,+CAAyD;AACzD,+CAAqD;AACrD,+DAM8B;AAC9B,oEAAiE;AAEjE,6CAGsB;AACtB,gDAA8D;AAC9D,mCAKiB;AACjB,uCAIsB;AACtB,gDAAwD;AACxD,6DAA0F;AAE1F,8FAA8F;AAC9F,+DAA+D;AAC/D,mCAAY,CAAC,UAAU,CAAC,oBAAoB,GAAG,KAAK,CAAC;AAErD,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EACJ,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,gBAAgB,EAChB,kBAAkB,GACnB,GAAG,KAAK,CAAC;IAEV,MAAM,oBAAoB,GAAG,IAAA,wBAAgB,EAAC,YAAY,CAAC,CAAC;IAC5D,8DAA8D;IAC9D,oFAAoF;IACpF,wFAAwF;IACxF,2BAA2B;IAC3B,MAAM,4BAA4B,GAChC,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,YAAY,CAAC;IAE3E,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACrC,kBAAkB,EAAE,IAAA,gDAAmC,EAAC,GAAG,CAAC,OAAO,CAAC;QACpE,oBAAoB,EAAE,IAAA,kDAAqC,EAAC,GAAG,CAAC,OAAO,CAAC;KACzE,CAAC,CAAC,CAAC;IAEJ,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE/C,MAAM,eAAe,GAAG,IAAA,e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B,IAAI,CAAC,mCAAmC,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;QAC/F,OAAO,CAAC,IAAI,CACV,iCAAiC,sBAAsB,2BAA2B,4CAAoC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvK,CAAC;QACF,sBAAsB,GAAG,SAAS,CAAC;IACrC,CAAC;IACD,IACE,6BAA6B;QAC7B,CAAC,0CAA0C,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAC9E,CAAC;QACD,OAAO,CAAC,IAAI,CACV,oCAAoC,6BAA6B,2BAA2B,qDAA6C,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAClL,CAAC;QACF,6BAA6B,GAAG,SAAS,CAAC;IAC5C,CAAC;IAED,OAAO,CACL,CAAC,iCAAU,CACT,6BAA6B,CAAC,CAAC,6BAA6B,CAAC,CAC7D,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAC/C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useTheme } from '@react-navigation/native';\nimport React, { useDeferredValue, useMemo } from 'react';\nimport { View, type ColorValue } from 'react-native';\nimport {\n BottomTabs,\n BottomTabsScreen,\n featureFlags,\n type BottomTabsProps,\n type BottomTabsScreenAppearance,\n} from 'react-native-screens';\nimport { SafeAreaView } from 'react-native-screens/experimental';\n\nimport {\n createScrollEdgeAppearanceFromOptions,\n createStandardAppearanceFromOptions,\n} from './appearance';\nimport { NativeTabsBottomAccessory } from './common/elements';\nimport {\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES,\n SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS,\n type NativeTabOptions,\n type NativeTabsViewProps,\n} from './types';\nimport {\n convertOptionsIconToRNScreensPropsIcon,\n convertOptionsIconToIOSPropsIcon,\n useAwaitedScreensIcon,\n} from './utils/icon';\nimport { getFirstChildOfType } from '../utils/children';\nimport { useBottomAccessoryFunctionFromBottomAccessories } from './utils/bottomAccessory';\n\n// We let native tabs to control the changes. This requires freeze to be disabled for tab bar.\n// Otherwise user may see glitches when switching between tabs.\nfeatureFlags.experiment.controlledBottomTabs = false;\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const {\n minimizeBehavior,\n disableIndicator,\n focusedIndex,\n tabs,\n sidebarAdaptable,\n nonTriggerChildren,\n } = props;\n\n const deferredFocusedIndex = useDeferredValue(focusedIndex);\n // We need to check if the deferred index is not out of bounds\n // This can happen when the focused index is the last tab, and user removes that tab\n // In that case the deferred index will still point to the last tab, but after re-render\n // it will be out of bounds\n const inBoundsDeferredFocusedIndex =\n deferredFocusedIndex < tabs.length ? deferredFocusedIndex : focusedIndex;\n\n const appearances = tabs.map((tab) => ({\n standardAppearance: createStandardAppearanceFromOptions(tab.options),\n scrollEdgeAppearance: createScrollEdgeAppearanceFromOptions(tab.options),\n }));\n\n const options = tabs.map((tab) => tab.options);\n\n const bottomAccessory = useMemo(\n () => getFirstChildOfType(nonTriggerChildren, NativeTabsBottomAccessory),\n [nonTriggerChildren]\n );\n\n const bottomAccessoryFn = useBottomAccessoryFunctionFromBottomAccessories(bottomAccessory);\n\n const children = tabs.map((tab, index) => {\n const isFocused = index === inBoundsDeferredFocusedIndex;\n\n return (\n <Screen\n key={tab.routeKey}\n routeKey={tab.routeKey}\n name={tab.name}\n options={tab.options}\n isFocused={isFocused}\n standardAppearance={appearances[index].standardAppearance}\n scrollEdgeAppearance={appearances[index].scrollEdgeAppearance}\n badgeTextColor={tab.options.badgeTextColor}\n contentRenderer={tab.contentRenderer}\n />\n );\n });\n\n const currentTabAppearance = appearances[inBoundsDeferredFocusedIndex]?.standardAppearance;\n const tabBarControllerMode: BottomTabsProps['tabBarControllerMode'] = sidebarAdaptable\n ? 'tabSidebar'\n : sidebarAdaptable === false\n ? 'tabBar'\n : 'automatic';\n\n return (\n <BottomTabsWrapper\n // #region android props\n tabBarItemTitleFontColor={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontColor}\n tabBarItemTitleFontFamily={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontFamily}\n tabBarItemTitleFontSize={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontSizeActive={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontSize}\n tabBarItemTitleFontWeight={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontWeight}\n tabBarItemTitleFontStyle={currentTabAppearance?.stacked?.normal?.tabBarItemTitleFontStyle}\n tabBarItemIconColor={currentTabAppearance?.stacked?.normal?.tabBarItemIconColor}\n tabBarBackgroundColor={currentTabAppearance?.tabBarBackgroundColor}\n tabBarItemRippleColor={props.rippleColor}\n tabBarItemLabelVisibilityMode={props.labelVisibilityMode}\n tabBarItemIconColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemIconColor ?? props?.tintColor\n }\n tabBarItemTitleFontColorActive={\n currentTabAppearance?.stacked?.selected?.tabBarItemTitleFontColor ?? props?.tintColor\n }\n // tabBarItemTitleFontSizeActive={activeStyle?.fontSize}\n tabBarItemActiveIndicatorColor={options[inBoundsDeferredFocusedIndex]?.indicatorColor}\n tabBarItemActiveIndicatorEnabled={!disableIndicator}\n // #endregion\n // #region iOS props\n tabBarTintColor={props?.tintColor}\n tabBarMinimizeBehavior={minimizeBehavior}\n tabBarControllerMode={tabBarControllerMode}\n bottomAccessory={bottomAccessoryFn}\n tabBarHidden={props.hidden}\n // #endregion\n onNativeFocusChange={({ nativeEvent: { tabKey } }) => {\n props.onTabChange(tabKey);\n }}>\n {children}\n </BottomTabsWrapper>\n );\n}\n\nfunction Screen(props: {\n routeKey: string;\n name: string;\n isFocused: boolean;\n options: NativeTabOptions;\n standardAppearance: BottomTabsScreenAppearance;\n scrollEdgeAppearance: BottomTabsScreenAppearance;\n badgeTextColor: ColorValue | undefined;\n contentRenderer: () => React.ReactNode;\n}) {\n const {\n routeKey,\n name,\n options,\n isFocused,\n standardAppearance,\n scrollEdgeAppearance,\n badgeTextColor,\n contentRenderer,\n } = props;\n const title = options.title ?? name;\n\n // We need to await the icon, as VectorIcon will load asynchronously\n const icon = useAwaitedScreensIcon(options.icon);\n const selectedIcon = useAwaitedScreensIcon(options.selectedIcon);\n const { colors } = useTheme();\n\n const content = (\n <View\n // https://github.com/software-mansion/react-native-screens/issues/2662#issuecomment-2757735088\n collapsable={false}\n style={[\n { backgroundColor: colors.background },\n options.contentStyle,\n { flex: 1, position: 'relative', overflow: 'hidden' },\n ]}>\n {contentRenderer()}\n </View>\n );\n const wrappedContent =\n process.env.EXPO_OS === 'android' && !options.disableAutomaticContentInsets ? (\n <SafeAreaView\n // https://github.com/software-mansion/react-native-screens/issues/2662#issuecomment-2757735088\n collapsable={false}\n style={{ flex: 1 }}\n edges={{ bottom: true }}>\n {content}\n </SafeAreaView>\n ) : (\n content\n );\n\n return (\n <BottomTabsScreen\n {...options}\n overrideScrollViewContentInsetAdjustmentBehavior={!options.disableAutomaticContentInsets}\n tabBarItemBadgeBackgroundColor={\n standardAppearance.stacked?.normal?.tabBarItemBadgeBackgroundColor\n }\n tabBarItemBadgeTextColor={badgeTextColor}\n standardAppearance={standardAppearance}\n scrollEdgeAppearance={scrollEdgeAppearance}\n icon={convertOptionsIconToRNScreensPropsIcon(icon)}\n selectedIcon={convertOptionsIconToIOSPropsIcon(selectedIcon)}\n title={title}\n freezeContents={false}\n systemItem={options.role}\n {...options.nativeProps}\n tabKey={routeKey}\n isFocused={isFocused}>\n {wrappedContent}\n </BottomTabsScreen>\n );\n}\n\nconst supportedTabBarMinimizeBehaviorsSet = new Set<string>(SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS);\nconst supportedTabBarItemLabelVisibilityModesSet = new Set<string>(\n SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES\n);\n\nfunction BottomTabsWrapper(props: BottomTabsProps) {\n let { tabBarMinimizeBehavior, tabBarItemLabelVisibilityMode, ...rest } = props;\n if (tabBarMinimizeBehavior && !supportedTabBarMinimizeBehaviorsSet.has(tabBarMinimizeBehavior)) {\n console.warn(\n `Unsupported minimizeBehavior: ${tabBarMinimizeBehavior}. Supported values are: ${SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS.map((behavior) => `\"${behavior}\"`).join(', ')}`\n );\n tabBarMinimizeBehavior = undefined;\n }\n if (\n tabBarItemLabelVisibilityMode &&\n !supportedTabBarItemLabelVisibilityModesSet.has(tabBarItemLabelVisibilityMode)\n ) {\n console.warn(\n `Unsupported labelVisibilityMode: ${tabBarItemLabelVisibilityMode}. Supported values are: ${SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES.map((mode) => `\"${mode}\"`).join(', ')}`\n );\n tabBarItemLabelVisibilityMode = undefined;\n }\n\n return (\n <BottomTabs\n tabBarItemLabelVisibilityMode={tabBarItemLabelVisibilityMode}\n tabBarMinimizeBehavior={tabBarMinimizeBehavior}\n {...rest}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../src/native-tabs/appearance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,0BAA0B,EAE1B,mCAAmC,EACpC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../src/native-tabs/appearance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,0BAA0B,EAE1B,mCAAmC,EACpC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAC;AAKjB,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,gBAAgB,GACxB,0BAA0B,CAgC5B;AAED,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,gBAAgB,GACxB,0BAA0B,CAgC5B;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,uBAAuB,CAAC,EAAE;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,eAAe,EAC9B,UAAU,EAAE,0BAA0B,GACrC,0BAA0B,CAE5B;AASD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,0BAA0B,EACtC,MAAM,EAAE,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,EAAE,GACzD,0BAA0B,CA8B5B;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,0BAA0B,CAmB5B;AAED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,mCAAmC,CAsBrC"}
|
|
@@ -7,6 +7,7 @@ exports.appendStyleToAppearance = appendStyleToAppearance;
|
|
|
7
7
|
exports.convertStyleToAppearance = convertStyleToAppearance;
|
|
8
8
|
exports.convertStyleToItemStateAppearance = convertStyleToItemStateAppearance;
|
|
9
9
|
const types_1 = require("./types");
|
|
10
|
+
const style_1 = require("../utils/style");
|
|
10
11
|
const supportedBlurEffectsSet = new Set(types_1.SUPPORTED_BLUR_EFFECTS);
|
|
11
12
|
function createStandardAppearanceFromOptions(options) {
|
|
12
13
|
let blurEffect = options.blurEffect;
|
|
@@ -118,10 +119,7 @@ function convertStyleToItemStateAppearance(style) {
|
|
|
118
119
|
tabBarItemIconColor: style.iconColor,
|
|
119
120
|
tabBarItemTitleFontFamily: style.fontFamily,
|
|
120
121
|
tabBarItemTitleFontSize: style.fontSize,
|
|
121
|
-
|
|
122
|
-
tabBarItemTitleFontWeight: style?.fontWeight
|
|
123
|
-
? String(style.fontWeight)
|
|
124
|
-
: undefined,
|
|
122
|
+
tabBarItemTitleFontWeight: (0, style_1.convertFontWeightToStringFontWeight)(style.fontWeight),
|
|
125
123
|
tabBarItemTitleFontStyle: style.fontStyle,
|
|
126
124
|
tabBarItemTitleFontColor: style.color,
|
|
127
125
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../../src/native-tabs/appearance.ts"],"names":[],"mappings":";;AAgBA,kFAkCC;AAED,sFAkCC;AAcD,0EAKC;AASD,0DAkCC;AAED,4DAqBC;AAED,8EA2BC;AAjMD,mCAKiB;AAEjB,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS,8BAAsB,CAAC,CAAC;AAExE,SAAgB,mCAAmC,CACjD,OAAyB;IAEzB,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACpC,IAAI,UAAU,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,IAAI,CACV,2BAA2B,UAAU,2BAA2B,8BAAsB,CAAC,GAAG,CACxF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,GAAG,CAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACf,CAAC;QACF,UAAU,GA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AAW;KACtC,CAAC;AACJ,CAAC;AAED,SAAgB,iCAAiC,CAC/C,KAAkC;IAElC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,eAAe,GAAwC;QAC3D,8BAA8B,EAAE,KAAK,CAAC,oBAAoB;QAC1D,iCAAiC,EAAE,KAAK,CAAC,uBAAuB;QAChE,mBAAmB,EAAE,KAAK,CAAC,SAAS;QACpC,yBAAyB,EAAE,KAAK,CAAC,UAAU;QAC3C,uBAAuB,EAAE,KAAK,CAAC,QAAQ;QACvC,gDAAgD;QAChD,yBAAyB,EAAE,KAAK,EAAE,UAAU;YAC1C,CAAC,CAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAoD;YAC9E,CAAC,CAAC,SAAS;QACb,wBAAwB,EAAE,KAAK,CAAC,SAAS;QACzC,wBAAwB,EAAE,KAAK,CAAC,KAAK;KACtC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,eAAe,CAAmD,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC9F,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColorValue } from 'react-native';\nimport type {\n BottomTabsScreenAppearance,\n BottomTabsScreenItemAppearance,\n BottomTabsScreenItemStateAppearance,\n} from 'react-native-screens';\n\nimport {\n SUPPORTED_BLUR_EFFECTS,\n type NativeTabOptions,\n type NativeTabsBlurEffect,\n type NativeTabsLabelStyle,\n} from './types';\n\nconst supportedBlurEffectsSet = new Set<string>(SUPPORTED_BLUR_EFFECTS);\n\nexport function createStandardAppearanceFromOptions(\n options: NativeTabOptions\n): BottomTabsScreenAppearance {\n let blurEffect = options.blurEffect;\n if (blurEffect && !supportedBlurEffectsSet.has(blurEffect)) {\n console.warn(\n `Unsupported blurEffect: ${blurEffect}. Supported values are: ${SUPPORTED_BLUR_EFFECTS.map(\n (effect) => `\"${effect}\"`\n ).join(', ')}`\n );\n blurEffect = undefined;\n }\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n backgroundColor: options.backgroundColor,\n blurEffect,\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n shadowColor: options.shadowColor,\n },\n {},\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport function createScrollEdgeAppearanceFromOptions(\n options: NativeTabOptions\n): BottomTabsScreenAppearance {\n let blurEffect = options.disableTransparentOnScrollEdge ? options.blurEffect : 'none';\n if (blurEffect && !supportedBlurEffectsSet.has(blurEffect)) {\n console.warn(\n `Unsupported blurEffect: ${blurEffect}. Supported values are: ${SUPPORTED_BLUR_EFFECTS.map(\n (effect) => `\"${effect}\"`\n ).join(', ')}`\n );\n blurEffect = undefined;\n }\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n blurEffect,\n backgroundColor: options.disableTransparentOnScrollEdge ? options.backgroundColor : null,\n shadowColor: options.disableTransparentOnScrollEdge ? options.shadowColor : 'transparent',\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n },\n {},\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport interface AppearanceStyle extends NativeTabsLabelStyle {\n iconColor?: ColorValue;\n backgroundColor?: ColorValue | null;\n blurEffect?: NativeTabsBlurEffect;\n badgeBackgroundColor?: ColorValue;\n shadowColor?: ColorValue;\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n}\n\nexport function appendSelectedStyleToAppearance(\n selectedStyle: AppearanceStyle,\n appearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n return appendStyleToAppearance(selectedStyle, appearance, ['selected', 'focused']);\n}\n\nconst EMPTY_APPEARANCE_ITEM: BottomTabsScreenItemAppearance = {\n normal: {},\n selected: {},\n focused: {},\n disabled: {},\n};\n\nexport function appendStyleToAppearance(\n style: AppearanceStyle,\n appearance: BottomTabsScreenAppearance,\n states: ('selected' | 'focused' | 'disabled' | 'normal')[]\n): BottomTabsScreenAppearance {\n const baseItemAppearance =\n appearance.stacked || appearance.inline || appearance.compactInline || {};\n\n const styleAppearance = convertStyleToAppearance(style);\n const newAppearances = states.map((state) => ({\n key: state,\n appearance: {\n ...baseItemAppearance.normal,\n ...baseItemAppearance[state],\n ...styleAppearance.stacked?.normal,\n },\n }));\n\n const itemAppearance: BottomTabsScreenItemAppearance = {\n ...EMPTY_APPEARANCE_ITEM,\n ...baseItemAppearance,\n ...Object.fromEntries(newAppearances.map(({ key, appearance }) => [key, appearance])),\n };\n return {\n stacked: itemAppearance,\n inline: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor:\n style.backgroundColor === null\n ? undefined\n : (style.backgroundColor ?? appearance.tabBarBackgroundColor),\n tabBarBlurEffect: styleAppearance.tabBarBlurEffect ?? appearance.tabBarBlurEffect,\n tabBarShadowColor: styleAppearance.tabBarShadowColor ?? appearance.tabBarShadowColor,\n };\n}\n\nexport function convertStyleToAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance = convertStyleToItemStateAppearance(style);\n const itemAppearance: BottomTabsScreenItemAppearance = {\n normal: stateAppearance,\n selected: stateAppearance,\n focused: stateAppearance,\n disabled: {},\n };\n return {\n inline: itemAppearance,\n stacked: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor: style?.backgroundColor ?? undefined,\n tabBarBlurEffect: style?.blurEffect,\n tabBarShadowColor: style?.shadowColor,\n };\n}\n\nexport function convertStyleToItemStateAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenItemStateAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance: BottomTabsScreenItemStateAppearance = {\n tabBarItemBadgeBackgroundColor: style.badgeBackgroundColor,\n tabBarItemTitlePositionAdjustment: style.titlePositionAdjustment,\n tabBarItemIconColor: style.iconColor,\n tabBarItemTitleFontFamily: style.fontFamily,\n tabBarItemTitleFontSize: style.fontSize,\n // Only string values are accepted by rn-screens\n tabBarItemTitleFontWeight: style?.fontWeight\n ? (String(style.fontWeight) as `${NonNullable<(typeof style)['fontWeight']>}`)\n : undefined,\n tabBarItemTitleFontStyle: style.fontStyle,\n tabBarItemTitleFontColor: style.color,\n };\n\n (Object.keys(stateAppearance) as (keyof BottomTabsScreenItemStateAppearance)[]).forEach((key) => {\n if (stateAppearance[key] === undefined) {\n delete stateAppearance[key];\n }\n });\n\n return stateAppearance;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../../src/native-tabs/appearance.ts"],"names":[],"mappings":";;AAiBA,kFAkCC;AAED,sFAkCC;AAcD,0EAKC;AASD,0DAkCC;AAED,4DAqBC;AAED,8EAwBC;AA/LD,mCAKiB;AACjB,0CAAqE;AAErE,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS,8BAAsB,CAAC,CAAC;AAExE,SAAgB,mCAAmC,CACjD,OAAyB;IAEzB,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACpC,IAAI,UAAU,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,IAAI,CACV,2BAA2B,UAAU,2B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ACvB,aAAa,EAAE,cAAc;QAC7B,qBAAqB,EAAE,KAAK,EAAE,eAAe,IAAI,SAAS;QAC1D,gBAAgB,EAAE,KAAK,EAAE,UAAU;QACnC,iBAAiB,EAAE,KAAK,EAAE,WAAW;KACtC,CAAC;AACJ,CAAC;AAED,SAAgB,iCAAiC,CAC/C,KAAkC;IAElC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,eAAe,GAAwC;QAC3D,8BAA8B,EAAE,KAAK,CAAC,oBAAoB;QAC1D,iCAAiC,EAAE,KAAK,CAAC,uBAAuB;QAChE,mBAAmB,EAAE,KAAK,CAAC,SAAS;QACpC,yBAAyB,EAAE,KAAK,CAAC,UAAU;QAC3C,uBAAuB,EAAE,KAAK,CAAC,QAAQ;QACvC,yBAAyB,EAAE,IAAA,2CAAmC,EAAC,KAAK,CAAC,UAAU,CAAC;QAChF,wBAAwB,EAAE,KAAK,CAAC,SAAS;QACzC,wBAAwB,EAAE,KAAK,CAAC,KAAK;KACtC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,eAAe,CAAmD,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAC9F,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColorValue } from 'react-native';\nimport type {\n BottomTabsScreenAppearance,\n BottomTabsScreenItemAppearance,\n BottomTabsScreenItemStateAppearance,\n} from 'react-native-screens';\n\nimport {\n SUPPORTED_BLUR_EFFECTS,\n type NativeTabOptions,\n type NativeTabsBlurEffect,\n type NativeTabsLabelStyle,\n} from './types';\nimport { convertFontWeightToStringFontWeight } from '../utils/style';\n\nconst supportedBlurEffectsSet = new Set<string>(SUPPORTED_BLUR_EFFECTS);\n\nexport function createStandardAppearanceFromOptions(\n options: NativeTabOptions\n): BottomTabsScreenAppearance {\n let blurEffect = options.blurEffect;\n if (blurEffect && !supportedBlurEffectsSet.has(blurEffect)) {\n console.warn(\n `Unsupported blurEffect: ${blurEffect}. Supported values are: ${SUPPORTED_BLUR_EFFECTS.map(\n (effect) => `\"${effect}\"`\n ).join(', ')}`\n );\n blurEffect = undefined;\n }\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n backgroundColor: options.backgroundColor,\n blurEffect,\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n shadowColor: options.shadowColor,\n },\n {},\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport function createScrollEdgeAppearanceFromOptions(\n options: NativeTabOptions\n): BottomTabsScreenAppearance {\n let blurEffect = options.disableTransparentOnScrollEdge ? options.blurEffect : 'none';\n if (blurEffect && !supportedBlurEffectsSet.has(blurEffect)) {\n console.warn(\n `Unsupported blurEffect: ${blurEffect}. Supported values are: ${SUPPORTED_BLUR_EFFECTS.map(\n (effect) => `\"${effect}\"`\n ).join(', ')}`\n );\n blurEffect = undefined;\n }\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n blurEffect,\n backgroundColor: options.disableTransparentOnScrollEdge ? options.backgroundColor : null,\n shadowColor: options.disableTransparentOnScrollEdge ? options.shadowColor : 'transparent',\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n },\n {},\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport interface AppearanceStyle extends NativeTabsLabelStyle {\n iconColor?: ColorValue;\n backgroundColor?: ColorValue | null;\n blurEffect?: NativeTabsBlurEffect;\n badgeBackgroundColor?: ColorValue;\n shadowColor?: ColorValue;\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n}\n\nexport function appendSelectedStyleToAppearance(\n selectedStyle: AppearanceStyle,\n appearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n return appendStyleToAppearance(selectedStyle, appearance, ['selected', 'focused']);\n}\n\nconst EMPTY_APPEARANCE_ITEM: BottomTabsScreenItemAppearance = {\n normal: {},\n selected: {},\n focused: {},\n disabled: {},\n};\n\nexport function appendStyleToAppearance(\n style: AppearanceStyle,\n appearance: BottomTabsScreenAppearance,\n states: ('selected' | 'focused' | 'disabled' | 'normal')[]\n): BottomTabsScreenAppearance {\n const baseItemAppearance =\n appearance.stacked || appearance.inline || appearance.compactInline || {};\n\n const styleAppearance = convertStyleToAppearance(style);\n const newAppearances = states.map((state) => ({\n key: state,\n appearance: {\n ...baseItemAppearance.normal,\n ...baseItemAppearance[state],\n ...styleAppearance.stacked?.normal,\n },\n }));\n\n const itemAppearance: BottomTabsScreenItemAppearance = {\n ...EMPTY_APPEARANCE_ITEM,\n ...baseItemAppearance,\n ...Object.fromEntries(newAppearances.map(({ key, appearance }) => [key, appearance])),\n };\n return {\n stacked: itemAppearance,\n inline: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor:\n style.backgroundColor === null\n ? undefined\n : (style.backgroundColor ?? appearance.tabBarBackgroundColor),\n tabBarBlurEffect: styleAppearance.tabBarBlurEffect ?? appearance.tabBarBlurEffect,\n tabBarShadowColor: styleAppearance.tabBarShadowColor ?? appearance.tabBarShadowColor,\n };\n}\n\nexport function convertStyleToAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance = convertStyleToItemStateAppearance(style);\n const itemAppearance: BottomTabsScreenItemAppearance = {\n normal: stateAppearance,\n selected: stateAppearance,\n focused: stateAppearance,\n disabled: {},\n };\n return {\n inline: itemAppearance,\n stacked: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor: style?.backgroundColor ?? undefined,\n tabBarBlurEffect: style?.blurEffect,\n tabBarShadowColor: style?.shadowColor,\n };\n}\n\nexport function convertStyleToItemStateAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenItemStateAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance: BottomTabsScreenItemStateAppearance = {\n tabBarItemBadgeBackgroundColor: style.badgeBackgroundColor,\n tabBarItemTitlePositionAdjustment: style.titlePositionAdjustment,\n tabBarItemIconColor: style.iconColor,\n tabBarItemTitleFontFamily: style.fontFamily,\n tabBarItemTitleFontSize: style.fontSize,\n tabBarItemTitleFontWeight: convertFontWeightToStringFontWeight(style.fontWeight),\n tabBarItemTitleFontStyle: style.fontStyle,\n tabBarItemTitleFontColor: style.color,\n };\n\n (Object.keys(stateAppearance) as (keyof BottomTabsScreenItemStateAppearance)[]).forEach((key) => {\n if (stateAppearance[key] === undefined) {\n delete stateAppearance[key];\n }\n });\n\n return stateAppearance;\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AndroidSymbol } from 'expo-symbols';
|
|
2
|
+
import type { ColorValue, ImageSourcePropType, StyleProp } from 'react-native';
|
|
2
3
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
3
4
|
import { VectorIcon } from '../../primitives';
|
|
4
5
|
import type { NativeTabsLabelStyle } from '../types';
|
|
@@ -7,7 +8,7 @@ export interface NativeTabsTriggerLabelProps {
|
|
|
7
8
|
* The text to display as the label for the tab.
|
|
8
9
|
*/
|
|
9
10
|
children?: string;
|
|
10
|
-
selectedStyle?: NativeTabsLabelStyle
|
|
11
|
+
selectedStyle?: StyleProp<NativeTabsLabelStyle>;
|
|
11
12
|
/**
|
|
12
13
|
* If true, the label will be hidden.
|
|
13
14
|
* @default false
|
|
@@ -77,10 +78,13 @@ export interface DrawableIcon {
|
|
|
77
78
|
*/
|
|
78
79
|
drawable?: string;
|
|
79
80
|
}
|
|
81
|
+
export interface MaterialIcon {
|
|
82
|
+
md: AndroidSymbol;
|
|
83
|
+
}
|
|
80
84
|
export type BaseNativeTabsTriggerIconProps = {
|
|
81
85
|
selectedColor?: ColorValue;
|
|
82
86
|
};
|
|
83
|
-
export type NativeTabsTriggerIconProps = BaseNativeTabsTriggerIconProps & ((SFSymbolIcon & DrawableIcon) | (SFSymbolIcon & SrcIcon) | (DrawableIcon & SrcIcon) | SrcIcon);
|
|
87
|
+
export type NativeTabsTriggerIconProps = BaseNativeTabsTriggerIconProps & ((SFSymbolIcon & DrawableIcon) | (SFSymbolIcon & MaterialIcon) | (SFSymbolIcon & SrcIcon) | (MaterialIcon & SrcIcon) | (DrawableIcon & SrcIcon) | SrcIcon);
|
|
84
88
|
/**
|
|
85
89
|
* Renders an icon for the tab.
|
|
86
90
|
*
|
|
@@ -116,6 +120,10 @@ export declare const NativeTabsTriggerIcon: React.FC<NativeTabsTriggerIconProps>
|
|
|
116
120
|
* ```
|
|
117
121
|
*/
|
|
118
122
|
export declare const NativeTabsTriggerVectorIcon: typeof VectorIcon;
|
|
123
|
+
export interface NativeTabsTriggerPromiseIconProps {
|
|
124
|
+
loader: () => Promise<ImageSourcePropType | null>;
|
|
125
|
+
}
|
|
126
|
+
export declare const NativeTabsTriggerPromiseIcon: (props: NativeTabsTriggerPromiseIconProps) => null;
|
|
119
127
|
export interface NativeTabsTriggerBadgeProps {
|
|
120
128
|
/**
|
|
121
129
|
* The text to display as the badge for the tab.
|
|
@@ -130,4 +138,29 @@ export interface NativeTabsTriggerBadgeProps {
|
|
|
130
138
|
selectedBackgroundColor?: ColorValue;
|
|
131
139
|
}
|
|
132
140
|
export declare const NativeTabsTriggerBadge: React.FC<NativeTabsTriggerBadgeProps>;
|
|
141
|
+
export interface NativeTabsBottomAccessoryProps {
|
|
142
|
+
children?: React.ReactNode;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A [bottom accessory](https://developer.apple.com/documentation/uikit/uitabbarcontroller/bottomaccessory) for `NativeTabs` on iOS 26 and above.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```tsx
|
|
149
|
+
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
|
|
150
|
+
*
|
|
151
|
+
* export default Layout(){
|
|
152
|
+
* return (
|
|
153
|
+
* <NativeTabs>
|
|
154
|
+
* <NativeTabs.BottomAccessory>
|
|
155
|
+
* <YourAccessoryComponent />
|
|
156
|
+
* </NativeTabs.BottomAccessory>
|
|
157
|
+
* <NativeTabs.Trigger name="index" />
|
|
158
|
+
* </NativeTabs>
|
|
159
|
+
* );
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @platform iOS 26+
|
|
164
|
+
*/
|
|
165
|
+
export declare const NativeTabsBottomAccessory: React.FC<NativeTabsBottomAccessoryProps>;
|
|
133
166
|
//# sourceMappingURL=elements.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
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,E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AY,GAAG,OAAO,CAAC,GACxB,OAAO,CACV,CAAC;AAEJ;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAQ,CAAC;AAEhF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,2BAA2B,mBAAa,CAAC;AAEtD,MAAM,WAAW,iCAAiC;IAChD,MAAM,EAAE,MAAM,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,4BAA4B,GACvC,OAAO,iCAAiC,SAGzC,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NativeTabsTriggerBadge = exports.NativeTabsTriggerVectorIcon = exports.NativeTabsTriggerIcon = exports.NativeTabsTriggerLabel = void 0;
|
|
3
|
+
exports.NativeTabsBottomAccessory = exports.NativeTabsTriggerBadge = exports.NativeTabsTriggerPromiseIcon = exports.NativeTabsTriggerVectorIcon = exports.NativeTabsTriggerIcon = exports.NativeTabsTriggerLabel = void 0;
|
|
4
4
|
const primitives_1 = require("../../primitives");
|
|
5
5
|
exports.NativeTabsTriggerLabel = primitives_1.Label;
|
|
6
6
|
/**
|
|
@@ -38,5 +38,34 @@ exports.NativeTabsTriggerIcon = primitives_1.Icon;
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
exports.NativeTabsTriggerVectorIcon = primitives_1.VectorIcon;
|
|
41
|
+
const NativeTabsTriggerPromiseIcon = function NativeTabsTriggerPromiseIcon(props) {
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
exports.NativeTabsTriggerPromiseIcon = NativeTabsTriggerPromiseIcon;
|
|
41
45
|
exports.NativeTabsTriggerBadge = primitives_1.Badge;
|
|
46
|
+
/**
|
|
47
|
+
* A [bottom accessory](https://developer.apple.com/documentation/uikit/uitabbarcontroller/bottomaccessory) for `NativeTabs` on iOS 26 and above.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
|
|
52
|
+
*
|
|
53
|
+
* export default Layout(){
|
|
54
|
+
* return (
|
|
55
|
+
* <NativeTabs>
|
|
56
|
+
* <NativeTabs.BottomAccessory>
|
|
57
|
+
* <YourAccessoryComponent />
|
|
58
|
+
* </NativeTabs.BottomAccessory>
|
|
59
|
+
* <NativeTabs.Trigger name="index" />
|
|
60
|
+
* </NativeTabs>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @platform iOS 26+
|
|
66
|
+
*/
|
|
67
|
+
const NativeTabsBottomAccessory = () => {
|
|
68
|
+
return null;
|
|
69
|
+
};
|
|
70
|
+
exports.NativeTabsBottomAccessory = NativeTabsBottomAccessory;
|
|
42
71
|
//# sourceMappingURL=elements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../src/native-tabs/common/elements.tsx"],"names":[],"mappings":";;;AAIA,iDAAkE;AAgBrD,QAAA,sBAAsB,GAA0C,kBAAK,CAAC;AAmFnF;;;;;;;;;;;;;GAaG;AACU,QAAA,qBAAqB,GAAyC,iBAAI,CAAC;AAEhF;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,2BAA2B,GAAG,uBAAU,CAAC;AAM/C,MAAM,4BAA4B,GAAG,SAAS,4BAA4B,CAC/E,KAAwC;IAExC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,4BAA4B,gCAIvC;AAiBW,QAAA,sBAAsB,GAA0C,kBAAK,CAAC;AAMnF;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,yBAAyB,GAA6C,GAAG,EAAE;IACtF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAFW,QAAA,yBAAyB,6BAEpC","sourcesContent":["import type { AndroidSymbol } from 'expo-symbols';\nimport type { ColorValue, ImageSourcePropType, StyleProp } from 'react-native';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nimport { Label, Icon, Badge, VectorIcon } from '../../primitives';\nimport type { NativeTabsLabelStyle } from '../types';\n\nexport interface NativeTabsTriggerLabelProps {\n /**\n * The text to display as the label for the tab.\n */\n children?: string;\n selectedStyle?: StyleProp<NativeTabsLabelStyle>;\n /**\n * If true, the label will be hidden.\n * @default false\n */\n hidden?: boolean;\n}\n\nexport const NativeTabsTriggerLabel: React.FC<NativeTabsTriggerLabelProps> = Label;\n\nexport interface SrcIcon {\n /**\n * The image source to use as an icon.\n *\n * When `sf` prop is used it will override this prop on iOS.\n *\n * When `drawable` or `material` prop is used it will override this prop on Android.\n *\n * The value can be provided in two ways:\n * - As an image source\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon src={require('./path/to/icon.png')} />\n * ```\n *\n * @example\n * ```tsx\n * <Icon src={{ default: require('./path/to/icon.png'), selected: require('./path/to/icon-selected.png') }} />\n * ```\n *\n * @platform Android\n * @platform iOS\n */\n src?:\n | ImageSourcePropType\n | React.ReactElement\n | {\n default?: ImageSourcePropType | React.ReactElement;\n selected: ImageSourcePropType | React.ReactElement;\n };\n}\n\nexport interface SFSymbolIcon {\n /**\n * The name of the SF Symbol to use as an icon.\n *\n * The value can be provided in two ways:\n * - As a string with the SF Symbol name\n * - As an object specifying the default and selected states\n *\n * @example\n * ```tsx\n * <Icon sf=\"magnifyingglass\" />\n * ```\n *\n * @example\n * ```tsx\n * <Icon sf={{ default: \"house\", selected: \"house.fill\" }} />\n * ```\n *\n * @platform iOS\n */\n sf?: SFSymbol | { default?: SFSymbol; selected: SFSymbol };\n}\n\nexport interface DrawableIcon {\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n}\n\nexport interface MaterialIcon {\n md: AndroidSymbol;\n}\n\nexport type BaseNativeTabsTriggerIconProps = { selectedColor?: ColorValue };\n\nexport type NativeTabsTriggerIconProps = BaseNativeTabsTriggerIconProps &\n (\n | (SFSymbolIcon & DrawableIcon)\n | (SFSymbolIcon & MaterialIcon)\n | (SFSymbolIcon & SrcIcon)\n | (MaterialIcon & SrcIcon)\n | (DrawableIcon & SrcIcon)\n | SrcIcon\n );\n\n/**\n * Renders an icon for the tab.\n *\n * Accepts various icon sources such as SF Symbols, drawable resources, material icons, or image sources.\n *\n * Acceptable props combinations:\n * - `sf` and `drawable` - `sf` will be used for iOS icon, `drawable` for Android icon\n * - `sf` and `src` - `sf` will be used for iOS icon, `src` for Android icon\n * - `src` and `drawable` - `src` will be used for iOS icon, `drawable` for Android icon\n * - `src` only - `src` will be used for both iOS and Android icons\n *\n * @platform ios\n * @platform android\n */\nexport const NativeTabsTriggerIcon: React.FC<NativeTabsTriggerIconProps> = Icon;\n\n/**\n * Helper component which can be used to load vector icons for `NativeTabs`.\n *\n * @example\n * ```tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n * import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';\n *\n * export default Layout(){\n * return (\n * <NativeTabs>\n * <NativeTabs.Trigger name=\"index\">\n * <NativeTabs.Trigger.Icon src={<NativeTabs.Trigger.VectorIcon family={MaterialCommunityIcons} name=\"home\" />} />\n * </NativeTabs.Trigger>\n * </NativeTabs>\n * );\n * }\n * ```\n */\nexport const NativeTabsTriggerVectorIcon = VectorIcon;\n\nexport interface NativeTabsTriggerPromiseIconProps {\n loader: () => Promise<ImageSourcePropType | null>;\n}\n\nexport const NativeTabsTriggerPromiseIcon = function NativeTabsTriggerPromiseIcon(\n props: NativeTabsTriggerPromiseIconProps\n) {\n return null;\n};\n\nexport interface NativeTabsTriggerBadgeProps {\n /**\n * The text to display as the badge for the tab.\n * If not provided, the badge will not be displayed.\n */\n children?: string;\n\n /**\n * If true, the badge will be hidden.\n * @default false\n */\n hidden?: boolean;\n selectedBackgroundColor?: ColorValue;\n}\n\nexport const NativeTabsTriggerBadge: React.FC<NativeTabsTriggerBadgeProps> = Badge;\n\nexport interface NativeTabsBottomAccessoryProps {\n children?: React.ReactNode;\n}\n\n/**\n * A [bottom accessory](https://developer.apple.com/documentation/uikit/uitabbarcontroller/bottomaccessory) for `NativeTabs` on iOS 26 and above.\n *\n * @example\n * ```tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * export default Layout(){\n * return (\n * <NativeTabs>\n * <NativeTabs.BottomAccessory>\n * <YourAccessoryComponent />\n * </NativeTabs.BottomAccessory>\n * <NativeTabs.Trigger name=\"index\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @platform iOS 26+\n */\nexport const NativeTabsBottomAccessory: React.FC<NativeTabsBottomAccessoryProps> = () => {\n return null;\n};\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const BottomAccessoryPlacementContext: import("react").Context<"regular" | "inline" | undefined>;
|
|
2
|
+
/**
|
|
3
|
+
* A hook which returns the bottom accessory environment for given component.
|
|
4
|
+
*
|
|
5
|
+
* Note, that there can be two copies of the same component rendered for different environments.
|
|
6
|
+
* The hook will ensure that component with correct environment is displayed.
|
|
7
|
+
*
|
|
8
|
+
* Because two instances of the component will exist simultaneously, **any state kept
|
|
9
|
+
* inside the component will not be shared between the regular and inline versions**.
|
|
10
|
+
* If your accessory needs synchronized or persistent state you must store that state
|
|
11
|
+
* outside of bottom accessory component (e.g. passing via props or using context).
|
|
12
|
+
*
|
|
13
|
+
* Don't pass the environment obtained using this hook up the tree.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
*
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
|
|
19
|
+
*
|
|
20
|
+
* // This component will have two copies rendered, one for `inline` and one for `regular` environment
|
|
21
|
+
* function AccessoryContent(props) {
|
|
22
|
+
* const placement = NativeTabs.BottomAccessory.usePlacement();
|
|
23
|
+
* if (placement === 'inline') {
|
|
24
|
+
* return <InlineAccessoryComponent {...props} />;
|
|
25
|
+
* }
|
|
26
|
+
* return <RegularAccessoryComponent {...props} />;
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* export default function Layout(){
|
|
30
|
+
* const [isPlaying, setIsPlaying] = useState(false);
|
|
31
|
+
* return (
|
|
32
|
+
* <NativeTabs>
|
|
33
|
+
* <NativeTabs.BottomAccessory>
|
|
34
|
+
* <AccessoryContent isPlaying={isPlaying} setIsPlaying={setIsPlaying} />
|
|
35
|
+
* </NativeTabs.BottomAccessory>
|
|
36
|
+
* <NativeTabs.Trigger name="index" />
|
|
37
|
+
* </NativeTabs>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @platform iOS 26+
|
|
43
|
+
*/
|
|
44
|
+
export declare const usePlacement: () => "regular" | "inline";
|
|
45
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/native-tabs/hooks.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,+BAA+B,2DAE3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,YAAY,QAAO,SAAS,GAAG,QAQ3C,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.usePlacement = exports.BottomAccessoryPlacementContext = void 0;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.BottomAccessoryPlacementContext = (0, react_1.createContext)(undefined);
|
|
7
|
+
/**
|
|
8
|
+
* A hook which returns the bottom accessory environment for given component.
|
|
9
|
+
*
|
|
10
|
+
* Note, that there can be two copies of the same component rendered for different environments.
|
|
11
|
+
* The hook will ensure that component with correct environment is displayed.
|
|
12
|
+
*
|
|
13
|
+
* Because two instances of the component will exist simultaneously, **any state kept
|
|
14
|
+
* inside the component will not be shared between the regular and inline versions**.
|
|
15
|
+
* If your accessory needs synchronized or persistent state you must store that state
|
|
16
|
+
* outside of bottom accessory component (e.g. passing via props or using context).
|
|
17
|
+
*
|
|
18
|
+
* Don't pass the environment obtained using this hook up the tree.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* import { NativeTabs } from 'expo-router/unstable-native-tabs';
|
|
24
|
+
*
|
|
25
|
+
* // This component will have two copies rendered, one for `inline` and one for `regular` environment
|
|
26
|
+
* function AccessoryContent(props) {
|
|
27
|
+
* const placement = NativeTabs.BottomAccessory.usePlacement();
|
|
28
|
+
* if (placement === 'inline') {
|
|
29
|
+
* return <InlineAccessoryComponent {...props} />;
|
|
30
|
+
* }
|
|
31
|
+
* return <RegularAccessoryComponent {...props} />;
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* export default function Layout(){
|
|
35
|
+
* const [isPlaying, setIsPlaying] = useState(false);
|
|
36
|
+
* return (
|
|
37
|
+
* <NativeTabs>
|
|
38
|
+
* <NativeTabs.BottomAccessory>
|
|
39
|
+
* <AccessoryContent isPlaying={isPlaying} setIsPlaying={setIsPlaying} />
|
|
40
|
+
* </NativeTabs.BottomAccessory>
|
|
41
|
+
* <NativeTabs.Trigger name="index" />
|
|
42
|
+
* </NativeTabs>
|
|
43
|
+
* );
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @platform iOS 26+
|
|
48
|
+
*/
|
|
49
|
+
const usePlacement = () => {
|
|
50
|
+
const value = (0, react_1.use)(exports.BottomAccessoryPlacementContext);
|
|
51
|
+
if (!value) {
|
|
52
|
+
throw new Error('usePlacement can only be used within a <NativeTabs.BottomAccessory> component.');
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
};
|
|
56
|
+
exports.usePlacement = usePlacement;
|
|
57
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/native-tabs/hooks.ts"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAEb,iCAA2C;AAE9B,QAAA,+BAA+B,GAAG,IAAA,qBAAa,EAC1D,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACI,MAAM,YAAY,GAAG,GAAyB,EAAE;IACrD,MAAM,KAAK,GAAG,IAAA,WAAG,EAAC,uCAA+B,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB","sourcesContent":["'use client';\n\nimport { createContext, use } from 'react';\n\nexport const BottomAccessoryPlacementContext = createContext<'regular' | 'inline' | undefined>(\n undefined\n);\n\n/**\n * A hook which returns the bottom accessory environment for given component.\n *\n * Note, that there can be two copies of the same component rendered for different environments.\n * The hook will ensure that component with correct environment is displayed.\n *\n * Because two instances of the component will exist simultaneously, **any state kept\n * inside the component will not be shared between the regular and inline versions**.\n * If your accessory needs synchronized or persistent state you must store that state\n * outside of bottom accessory component (e.g. passing via props or using context).\n *\n * Don't pass the environment obtained using this hook up the tree.\n *\n * @example\n *\n * ```tsx\n * import { NativeTabs } from 'expo-router/unstable-native-tabs';\n *\n * // This component will have two copies rendered, one for `inline` and one for `regular` environment\n * function AccessoryContent(props) {\n * const placement = NativeTabs.BottomAccessory.usePlacement();\n * if (placement === 'inline') {\n * return <InlineAccessoryComponent {...props} />;\n * }\n * return <RegularAccessoryComponent {...props} />;\n * }\n *\n * export default function Layout(){\n * const [isPlaying, setIsPlaying] = useState(false);\n * return (\n * <NativeTabs>\n * <NativeTabs.BottomAccessory>\n * <AccessoryContent isPlaying={isPlaying} setIsPlaying={setIsPlaying} />\n * </NativeTabs.BottomAccessory>\n * <NativeTabs.Trigger name=\"index\" />\n * </NativeTabs>\n * );\n * }\n * ```\n *\n * @platform iOS 26+\n */\nexport const usePlacement = (): 'regular' | 'inline' => {\n const value = use(BottomAccessoryPlacementContext);\n if (!value) {\n throw new Error(\n 'usePlacement can only be used within a <NativeTabs.BottomAccessory> component.'\n );\n }\n return value;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './common/elements';
|
|
2
|
-
export type { NativeTabsProps, NativeTabTriggerProps, NativeTabsLabelStyle,
|
|
2
|
+
export type { NativeTabsProps, NativeTabTriggerProps, NativeTabsLabelStyle, SymbolOrImageSource, NativeTabsTabBarItemLabelVisibilityMode, NativeTabsBlurEffect, NativeTabsTabBarMinimizeBehavior, NativeTabsTabBarItemRole, } from './types';
|
|
3
3
|
export { NativeTabTrigger } from './NativeTabTrigger';
|
|
4
4
|
export { NativeTabs } from './NativeTabs';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,uCAAuC,EACvC,oBAAoB,EACpB,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/native-tabs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAkC;AAWlC,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA","sourcesContent":["export * from './common/elements';\nexport type {\n NativeTabsProps,\n NativeTabTriggerProps,\n NativeTabsLabelStyle,\n SymbolOrImageSource,\n NativeTabsTabBarItemLabelVisibilityMode,\n NativeTabsBlurEffect,\n NativeTabsTabBarMinimizeBehavior,\n NativeTabsTabBarItemRole,\n} from './types';\nexport { NativeTabTrigger } from './NativeTabTrigger';\nexport { NativeTabs } from './NativeTabs';\n"]}
|