@luckylca/react-native-liquid-glass 0.2.0 → 0.3.0
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/README.md +20 -33
- package/README.zh-CN.md +20 -33
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/android/build.gradle +4 -4
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/EffectiveScrollInputBridge.kt +2 -2
- package/android/src/main/java/expo/modules/{newhuliquidglass/ExpoGlassProviderCoreView.kt → liquidglass/GlassCaptureView.kt} +39 -39
- package/android/src/main/java/expo/modules/{newhuliquidglass/CoreLiquidGlassRegistry.kt → liquidglass/GlassRegistry.kt} +7 -7
- package/android/src/main/java/expo/modules/{newhuliquidglass/ExpoGlassSurfaceCoreView.kt → liquidglass/GlassSurfaceView.kt} +17 -17
- package/android/src/main/java/expo/modules/liquidglass/LiquidGlassModule.kt +205 -0
- package/android/src/main/java/expo/modules/{localglass/ExpoLocalGlassEngineModule.kt → liquidglass/LocalMaterialView.kt} +24 -27
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/PassSurfaceSuppression.kt +1 -1
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/SharedGlassPassProbeLog.kt +1 -1
- package/android/src/main/java/expo/modules/{newhuliquidglass → liquidglass}/SharedGlassPassWiring.kt +3 -3
- package/android-core/build.gradle +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/BackdropRecorder.kt +4 -4
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/FrozenBackdrop.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassBackdropCoordinator.kt +5 -5
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassBackdropSourceHandle.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassScrollSource.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/GlassViewController.kt +119 -722
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/LiquidGlassProviderLayout.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/LiquidGlassView.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/ReferenceSourceWindowPolicy.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/StableSceneTexturePolicy.kt +1 -1
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceFrameBuilder.kt +278 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/SurfaceInteraction.kt +359 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/GlassFrame.kt +110 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/GlassViewRenderer.kt +728 -0
- package/android-core/src/main/java/io/github/luckylca/liquidglass/backdrop/internal/ReferenceParityPasses.kt +705 -0
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/internal/ReferenceTabSampling.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/backdrop/internal/SharedSceneCapture.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassCapabilities.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassEngine.kt +7 -7
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassMaterial.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassMath.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassOpticalInsets.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassRenderTier.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassShapePacker.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassSurfaceState.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/GlassUniforms.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/LiquidGlassShaders.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/SharedGlassPass.kt +6 -6
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/geometry/G2RoundedRectangle.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/geometry/ReferenceG2MaskTexture.kt +1 -1
- package/android-core/src/main/java/io/github/luckylca/liquidglass/core/shader/HeightFieldGlassShader.kt +7 -0
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceBackdropBlurShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceGaussianDiscBackdropBlur.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceGlassUniforms.kt +4 -4
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceParityGlassShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/ReferenceParityMultiShapeShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/core/shader/SdfScaleLensShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassHardwareLayerExperiment.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassMaterial.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassRenderer.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassRuntimeShader.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassShader.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/local/LocalGlassView.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/GlassMotionDriver.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/GlassMotionState.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/PointerVelocityTracker.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/motion/SpringSpec.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/G2Corner.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassMaterial.kt +3 -3
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassOpticsShader.kt +3 -3
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassParityProbe.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassShapeGeometry.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/GlassUniformBinder.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/PixelDiff.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/optics/ReferenceOptics.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/rendering/GlassSurfaceHost.kt +17 -17
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/rendering/GlassSurfaceRenderer.kt +9 -9
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/rendering/RetainedBackdropLayer.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/scheduler/GlassFrameScheduler.kt +2 -2
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/EffectiveScrollFpsProbe.kt +13 -13
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/GlassTelemetry.kt +1 -1
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/LiquidGlassPerfTelemetry.kt +13 -13
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/LiquidGlassTrace.kt +3 -3
- package/android-core/src/main/java/{com/newhu → io/github/luckylca}/liquidglass/telemetry/LocalGlassTelemetry.kt +1 -1
- package/docs/architecture.md +61 -0
- package/docs/migration-0.3.md +19 -0
- package/docs/publishing.md +29 -7
- package/expo-module.config.json +4 -4
- package/lib/commonjs/GlassSurface.js +157 -585
- package/lib/commonjs/GlassSurface.js.map +1 -1
- package/lib/commonjs/GlassTabBar.js +18 -957
- package/lib/commonjs/GlassTabBar.js.map +1 -1
- package/lib/commonjs/LocalGlassMaterial.js +3 -9
- package/lib/commonjs/LocalGlassMaterial.js.map +1 -1
- package/lib/commonjs/glassController.js +3 -7
- package/lib/commonjs/glassController.js.map +1 -1
- package/lib/commonjs/glassRuntime.js +7 -19
- package/lib/commonjs/glassRuntime.js.map +1 -1
- package/lib/commonjs/localGlassTelemetry.js +4 -13
- package/lib/commonjs/localGlassTelemetry.js.map +1 -1
- package/lib/commonjs/nativeGlassViews.js +8 -11
- package/lib/commonjs/nativeGlassViews.js.map +1 -1
- package/lib/commonjs/performanceTelemetry.js +2 -6
- package/lib/commonjs/performanceTelemetry.js.map +1 -1
- package/lib/commonjs/surface/InlineSurface.js +134 -0
- package/lib/commonjs/surface/InlineSurface.js.map +1 -0
- package/lib/commonjs/surface/MaterialProvider.js +78 -0
- package/lib/commonjs/surface/MaterialProvider.js.map +1 -0
- package/lib/commonjs/surface/NativeSurface.js +55 -0
- package/lib/commonjs/surface/NativeSurface.js.map +1 -0
- package/lib/commonjs/surface/PortalLayers.js +331 -0
- package/lib/commonjs/surface/PortalLayers.js.map +1 -0
- package/lib/commonjs/surface/contexts.js +108 -0
- package/lib/commonjs/surface/contexts.js.map +1 -0
- package/lib/commonjs/surface/registry.js +113 -0
- package/lib/commonjs/surface/registry.js.map +1 -0
- package/lib/commonjs/surface/styles.js +34 -0
- package/lib/commonjs/surface/styles.js.map +1 -0
- package/lib/commonjs/surface/types.js +3 -0
- package/lib/commonjs/surface/types.js.map +1 -0
- package/lib/commonjs/tabs/GlassTabItem.js +66 -0
- package/lib/commonjs/tabs/GlassTabItem.js.map +1 -0
- package/lib/commonjs/tabs/InlineTabBar.js +867 -0
- package/lib/commonjs/tabs/InlineTabBar.js.map +1 -0
- package/lib/commonjs/tabs/tabConstants.js +22 -0
- package/lib/commonjs/tabs/tabConstants.js.map +1 -0
- package/lib/commonjs/tabs/tabDebug.js +50 -0
- package/lib/commonjs/tabs/tabDebug.js.map +1 -0
- package/lib/commonjs/tabs/tabStyles.js +107 -0
- package/lib/commonjs/tabs/tabStyles.js.map +1 -0
- package/lib/commonjs/tabs/useInlineTabGesture.js +227 -0
- package/lib/commonjs/tabs/useInlineTabGesture.js.map +1 -0
- package/lib/commonjs/theme/buildTheme.js +1 -1
- package/lib/commonjs/theme/buildTheme.js.map +1 -1
- package/lib/module/GlassSurface.js +135 -563
- package/lib/module/GlassSurface.js.map +1 -1
- package/lib/module/GlassTabBar.js +18 -925
- package/lib/module/GlassTabBar.js.map +1 -1
- package/lib/module/LocalGlassMaterial.js +5 -11
- package/lib/module/LocalGlassMaterial.js.map +1 -1
- package/lib/module/glassController.js +3 -7
- package/lib/module/glassController.js.map +1 -1
- package/lib/module/glassRuntime.js +7 -19
- package/lib/module/glassRuntime.js.map +1 -1
- package/lib/module/localGlassTelemetry.js +4 -13
- package/lib/module/localGlassTelemetry.js.map +1 -1
- package/lib/module/nativeGlassViews.js +7 -10
- package/lib/module/nativeGlassViews.js.map +1 -1
- package/lib/module/performanceTelemetry.js +2 -6
- package/lib/module/performanceTelemetry.js.map +1 -1
- package/lib/module/surface/InlineSurface.js +97 -0
- package/lib/module/surface/InlineSurface.js.map +1 -0
- package/lib/module/surface/MaterialProvider.js +74 -0
- package/lib/module/surface/MaterialProvider.js.map +1 -0
- package/lib/module/surface/NativeSurface.js +47 -0
- package/lib/module/surface/NativeSurface.js.map +1 -0
- package/lib/module/surface/PortalLayers.js +292 -0
- package/lib/module/surface/PortalLayers.js.map +1 -0
- package/lib/module/surface/contexts.js +96 -0
- package/lib/module/surface/contexts.js.map +1 -0
- package/lib/module/surface/registry.js +103 -0
- package/lib/module/surface/registry.js.map +1 -0
- package/lib/module/surface/styles.js +31 -0
- package/lib/module/surface/styles.js.map +1 -0
- package/lib/module/surface/types.js +2 -0
- package/lib/module/surface/types.js.map +1 -0
- package/lib/module/tabs/GlassTabItem.js +30 -0
- package/lib/module/tabs/GlassTabItem.js.map +1 -0
- package/lib/module/tabs/InlineTabBar.js +829 -0
- package/lib/module/tabs/InlineTabBar.js.map +1 -0
- package/lib/module/tabs/tabConstants.js +19 -0
- package/lib/module/tabs/tabConstants.js.map +1 -0
- package/lib/module/tabs/tabDebug.js +13 -0
- package/lib/module/tabs/tabDebug.js.map +1 -0
- package/lib/module/tabs/tabStyles.js +104 -0
- package/lib/module/tabs/tabStyles.js.map +1 -0
- package/lib/module/tabs/useInlineTabGesture.js +221 -0
- package/lib/module/tabs/useInlineTabGesture.js.map +1 -0
- package/lib/module/theme/buildTheme.js +1 -1
- package/lib/module/theme/buildTheme.js.map +1 -1
- package/lib/types/GlassSurface.d.ts +17 -86
- package/lib/types/GlassTabBar.d.ts +1 -0
- package/lib/types/glassNativeEngine.d.ts +1 -1
- package/lib/types/glassRuntime.d.ts +5 -2
- package/lib/types/localGlassTelemetry.d.ts +2 -2
- package/lib/types/nativeGlassViews.d.ts +2 -4
- package/lib/types/surface/InlineSurface.d.ts +42 -0
- package/lib/types/surface/MaterialProvider.d.ts +46 -0
- package/lib/types/surface/NativeSurface.d.ts +11 -0
- package/lib/types/surface/PortalLayers.d.ts +33 -0
- package/lib/types/surface/contexts.d.ts +66 -0
- package/lib/types/surface/registry.d.ts +6 -0
- package/lib/types/surface/styles.d.ts +74 -0
- package/lib/types/surface/types.d.ts +118 -0
- package/lib/types/tabs/GlassTabItem.d.ts +20 -0
- package/lib/types/tabs/InlineTabBar.d.ts +5 -0
- package/lib/types/tabs/tabConstants.d.ts +34 -0
- package/lib/types/tabs/tabDebug.d.ts +15 -0
- package/lib/types/tabs/tabStyles.d.ts +119 -0
- package/lib/types/tabs/useInlineTabGesture.d.ts +34 -0
- package/package.json +6 -14
- package/src/GlassSurface.tsx +227 -1337
- package/src/GlassTabBar.tsx +43 -1241
- package/src/LocalGlassMaterial.tsx +5 -11
- package/src/glassController.ts +3 -7
- package/src/glassRuntime.ts +9 -26
- package/src/localGlassTelemetry.ts +6 -15
- package/src/nativeGlassViews.ts +7 -10
- package/src/performanceTelemetry.ts +2 -6
- package/src/surface/InlineSurface.tsx +299 -0
- package/src/surface/MaterialProvider.tsx +235 -0
- package/src/surface/NativeSurface.tsx +115 -0
- package/src/surface/PortalLayers.tsx +574 -0
- package/src/surface/contexts.tsx +188 -0
- package/src/surface/registry.ts +109 -0
- package/src/surface/styles.ts +31 -0
- package/src/surface/types.ts +139 -0
- package/src/tabs/GlassTabItem.tsx +100 -0
- package/src/tabs/InlineTabBar.tsx +1193 -0
- package/src/tabs/tabConstants.ts +35 -0
- package/src/tabs/tabDebug.ts +29 -0
- package/src/tabs/tabStyles.ts +104 -0
- package/src/tabs/useInlineTabGesture.ts +306 -0
- package/src/theme/buildTheme.ts +1 -1
- package/android/src/main/java/expo/modules/localglass/ExpoLocalGlassModule.kt +0 -341
- package/android/src/main/java/expo/modules/localglass/LocalGlassShader.kt +0 -59
- package/android/src/main/java/expo/modules/newhuliquidglass/ExpoGlassCoreModule.kt +0 -226
- package/android-core/src/main/java/com/newhu/liquidglass/backdrop/internal/GlassViewRenderer.kt +0 -1459
- package/android-core/src/main/java/com/newhu/liquidglass/core/shader/HeightFieldGlassShader.kt +0 -7
- package/android-core/src/main/java/com/newhu/liquidglass/rendering/GlassEngineSelection.kt +0 -30
- package/patches/liquid-glass-kit+1.0.0.patch +0 -2015
- package/patches/liquid-glass-kit-invalidation-coalescing.diff +0 -249
- package/patches/liquid-glass-kit-native-infra.diff +0 -624
- package/scripts/apply-legacy-patches.mjs +0 -116
|
@@ -1,976 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.GLASS_TAB_BAR_CONTENT_INSET = void 0;
|
|
37
4
|
exports.GlassTabBar = GlassTabBar;
|
|
5
|
+
exports.FloatingGlassTabBar = FloatingGlassTabBar;
|
|
38
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
-
const react_1 = __importStar(require("react"));
|
|
40
7
|
const react_native_1 = require("react-native");
|
|
41
|
-
const Haptics = __importStar(require("expo-haptics"));
|
|
42
|
-
const react_native_gesture_handler_1 = require("react-native-gesture-handler");
|
|
43
|
-
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
44
8
|
const ReferenceTabBar_1 = require("./components/ReferenceTabBar");
|
|
45
9
|
const GlassSurface_1 = require("./GlassSurface");
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const TAB_BAR_MAX_WIDTH = 280;
|
|
53
|
-
const TAB_BAR_MIN_WIDTH = 208;
|
|
54
|
-
const TAB_BAR_HORIZONTAL_PADDING = 8;
|
|
55
|
-
const SELECTION_LENS_HEIGHT = 48;
|
|
56
|
-
const SELECTION_LENS_MAX_WIDTH = 94;
|
|
57
|
-
const LONG_PRESS_THRESHOLD_MS = 300;
|
|
58
|
-
const PRE_HOLD_SLOP = 20;
|
|
59
|
-
const DRAG_START_SLOP = 3;
|
|
60
|
-
const TAB_BAR_PORTAL_Z_INDEX = 80;
|
|
61
|
-
const GESTURE_DEBUG_ENABLED = __DEV__ && process.env.EXPO_PUBLIC_GLASS_TAB_DEBUG === '1';
|
|
62
|
-
const IDLE_SPRING = { damping: 24, stiffness: 330, mass: 0.68 };
|
|
63
|
-
const TAP_SELECTION_SPRING = { damping: 26, stiffness: 520, mass: 0.56 };
|
|
64
|
-
const EDGE_SPRING_FAST = { damping: 31, stiffness: 620, mass: 0.62 };
|
|
65
|
-
const EDGE_SPRING_SLOW = { damping: 29, stiffness: 260, mass: 0.76 };
|
|
66
|
-
const AnimatedLegacyGlassSurface = (0, react_native_reanimated_1.createAnimatedComponent)(nativeGlassViews_1.LegacyGlassSurfaceView);
|
|
67
|
-
const AnimatedCoreGlassSurface = nativeGlassViews_1.CoreGlassSurfaceView
|
|
68
|
-
? (0, react_native_reanimated_1.createAnimatedComponent)(nativeGlassViews_1.CoreGlassSurfaceView)
|
|
69
|
-
: null;
|
|
70
|
-
function logGlassTabGesture(event, detail) {
|
|
71
|
-
if (GESTURE_DEBUG_ENABLED) {
|
|
72
|
-
const timestamp = globalThis.performance?.now?.();
|
|
73
|
-
const time = typeof timestamp === 'number' ? timestamp.toFixed(1) : 'n/a';
|
|
74
|
-
console.info(`[GlassTab ${time}ms] ${event}${detail ? ` ${detail}` : ''}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
10
|
+
const tabConstants_1 = require("./tabs/tabConstants");
|
|
11
|
+
const tabConstants_2 = require("./tabs/tabConstants");
|
|
12
|
+
const tabConstants_3 = require("./tabs/tabConstants");
|
|
13
|
+
const tabConstants_4 = require("./tabs/tabConstants");
|
|
14
|
+
const tabConstants_5 = require("./tabs/tabConstants");
|
|
15
|
+
const InlineTabBar_1 = require("./tabs/InlineTabBar");
|
|
77
16
|
/** Extra scroll room below content: bar height + bottom gap + visual clearance. */
|
|
78
|
-
exports.GLASS_TAB_BAR_CONTENT_INSET = TAB_BAR_HEIGHT + TAB_BAR_BOTTOM_GAP + TAB_BAR_SCROLL_CLEARANCE;
|
|
79
|
-
function emitTargetHaptic(_index) {
|
|
80
|
-
void Haptics.selectionAsync().catch(() => undefined);
|
|
81
|
-
}
|
|
82
|
-
function withAlpha(color, alpha, fallback) {
|
|
83
|
-
const value = color.trim();
|
|
84
|
-
const rgba = value.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);
|
|
85
|
-
if (rgba)
|
|
86
|
-
return `rgba(${Math.round(Number(rgba[1]))},${Math.round(Number(rgba[2]))},${Math.round(Number(rgba[3]))},${alpha})`;
|
|
87
|
-
const hex = value.replace(/^#/, '');
|
|
88
|
-
if (/^[\da-f]{3}$/i.test(hex)) {
|
|
89
|
-
return `rgba(${parseInt(hex[0] + hex[0], 16)},${parseInt(hex[1] + hex[1], 16)},${parseInt(hex[2] + hex[2], 16)},${alpha})`;
|
|
90
|
-
}
|
|
91
|
-
if (/^[\da-f]{6}([\da-f]{2})?$/i.test(hex)) {
|
|
92
|
-
return `rgba(${parseInt(hex.slice(0, 2), 16)},${parseInt(hex.slice(2, 4), 16)},${parseInt(hex.slice(4, 6), 16)},${alpha})`;
|
|
93
|
-
}
|
|
94
|
-
return fallback;
|
|
95
|
-
}
|
|
17
|
+
exports.GLASS_TAB_BAR_CONTENT_INSET = tabConstants_1.TAB_BAR_HEIGHT + tabConstants_2.TAB_BAR_BOTTOM_GAP + tabConstants_3.TAB_BAR_SCROLL_CLEARANCE;
|
|
96
18
|
/**
|
|
97
19
|
* Floating navigation shares the catalog's reference renderer. Inline custom
|
|
98
20
|
* selectors retain their content API and independent interaction geometry.
|
|
99
21
|
*/
|
|
100
22
|
function GlassTabBar(props) {
|
|
101
|
-
return props.presentation === 'inline'
|
|
102
|
-
? (0, jsx_runtime_1.jsx)(InlineGlassTabBar, { ...props })
|
|
103
|
-
: (0, jsx_runtime_1.jsx)(FloatingGlassTabBar, { ...props });
|
|
23
|
+
return props.presentation === 'inline' ? ((0, jsx_runtime_1.jsx)(InlineTabBar_1.InlineGlassTabBar, { ...props })) : ((0, jsx_runtime_1.jsx)(FloatingGlassTabBar, { ...props }));
|
|
104
24
|
}
|
|
105
|
-
function FloatingGlassTabBar({ items, selected, onSelect, onSelectFromDrag, renderIcon, renderItem, bottomInset = 0, height = TAB_BAR_HEIGHT, width: requestedWidth, accessibilityHint, }) {
|
|
25
|
+
function FloatingGlassTabBar({ items, selected, onSelect, onSelectFromDrag, renderIcon, renderItem, bottomInset = 0, height = tabConstants_1.TAB_BAR_HEIGHT, width: requestedWidth, accessibilityHint, }) {
|
|
106
26
|
const { width: windowWidth } = (0, react_native_1.useWindowDimensions)();
|
|
107
27
|
const samplingProviderId = (0, GlassSurface_1.useGlassSamplingProviderId)('routeScene');
|
|
108
|
-
const width = Math.min(typeof requestedWidth === 'number' ? requestedWidth : 320, Math.max(0, windowWidth - TAB_BAR_SIDE_MARGIN * 2));
|
|
109
|
-
return ((0, jsx_runtime_1.jsx)(GlassSurface_1.GlassOverlay, { zIndex: TAB_BAR_PORTAL_Z_INDEX + 1, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const reducedMotion = (0, GlassSurface_1.useGlassReducedMotion)();
|
|
117
|
-
const tabBarMaterial = appearance?.tokens.materials.tabBarShell ?? appearance?.tokens.materials.tabBar;
|
|
118
|
-
const nativeLiveAvailable = react_native_1.Platform.OS === 'android' && appearance?.tokens.quality !== 'fallback';
|
|
119
|
-
const NativeGlassSurface = nativeEngine === 'core' && AnimatedCoreGlassSurface
|
|
120
|
-
? AnimatedCoreGlassSurface
|
|
121
|
-
: AnimatedLegacyGlassSurface;
|
|
122
|
-
const dark = appearance?.dark ?? false;
|
|
123
|
-
const shellSurfaceColor = shellBackgroundColor
|
|
124
|
-
? withAlpha(shellBackgroundColor, 0.4, dark ? 'rgba(18,18,18,0.4)' : 'rgba(250,250,250,0.4)')
|
|
125
|
-
: dark ? 'rgba(18,18,18,0.4)' : 'rgba(250,250,250,0.4)';
|
|
126
|
-
// An inline bar is drawn inside the page's route capture source. Pointing the
|
|
127
|
-
// selection lens at that same source makes the captured RenderNode contain the
|
|
128
|
-
// lens whose RenderEffect consumes it - a cycle that overflowed the stack in
|
|
129
|
-
// RenderNode::prepareTreeImpl on the User page. Inline lenses sample the theme
|
|
130
|
-
// backdrop instead, which is never an ancestor of the lens itself.
|
|
131
|
-
const samplingProviderId = (0, GlassSurface_1.useGlassSamplingProviderId)(presentation === 'inline' ? 'themeBackdrop' : 'routeScene') ?? '';
|
|
132
|
-
const tabScopeId = (0, react_1.useId)();
|
|
133
|
-
const [inlineWidth, setInlineWidth] = (0, react_1.useState)(0);
|
|
134
|
-
const shellBorderColor = appearance?.tokens.fallbackBorder[dark ? 'dark' : 'light'] ?? 'transparent';
|
|
135
|
-
const shellShadowColor = appearance?.tokens.procedural.outerShadow[dark ? 'dark' : 'light'] ?? 'transparent';
|
|
136
|
-
const itemCount = Math.max(items.length, 1);
|
|
137
|
-
const desiredWidth = itemCount * 100 + TAB_BAR_HORIZONTAL_PADDING * 2;
|
|
138
|
-
const floatingWidth = Math.min(Math.min(TAB_BAR_MAX_WIDTH, Math.max(TAB_BAR_MIN_WIDTH, desiredWidth)), Math.max(0, windowWidth - TAB_BAR_SIDE_MARGIN * 2));
|
|
139
|
-
const barWidth = presentation === 'inline'
|
|
140
|
-
? (typeof requestedWidth === 'number' ? requestedWidth : inlineWidth)
|
|
141
|
-
: floatingWidth;
|
|
142
|
-
const itemWidth = Math.max(0, (barWidth - horizontalPadding * 2) / itemCount);
|
|
143
|
-
const lensWidth = Math.max(44, Math.min(lensMaxWidth, itemWidth - 8));
|
|
144
|
-
const lensBaseHeight = Math.min(SELECTION_LENS_HEIGHT, height - 8);
|
|
145
|
-
const verticalInset = (height - lensBaseHeight) / 2;
|
|
146
|
-
const selectedCenterX = horizontalPadding + itemWidth * (selected + 0.5);
|
|
147
|
-
const selectedLeft = selectedCenterX - lensWidth / 2;
|
|
148
|
-
const [inlineScreenLeft, setInlineScreenLeft] = (0, react_1.useState)(0);
|
|
149
|
-
const inlineHostRef = (0, react_1.useRef)(null);
|
|
150
|
-
const shellScreenLeft = presentation === 'floating' ? (windowWidth - barWidth) / 2 : inlineScreenLeft;
|
|
151
|
-
// The shell lives inside the floating glass overlay, where measureInWindow
|
|
152
|
-
// returns a rect from the wrong native branch. Publish the geometry the bar
|
|
153
|
-
// is actually laid out at instead of trusting that measurement.
|
|
154
|
-
const shellFrameOverride = presentation === 'floating'
|
|
155
|
-
? {
|
|
156
|
-
x: shellScreenLeft,
|
|
157
|
-
y: windowHeight - bottomInset - TAB_BAR_BOTTOM_GAP - height,
|
|
158
|
-
width: barWidth,
|
|
159
|
-
height,
|
|
160
|
-
}
|
|
161
|
-
: undefined;
|
|
162
|
-
const lensLeft = (0, react_native_reanimated_1.useSharedValue)(selectedLeft);
|
|
163
|
-
const lensRight = (0, react_native_reanimated_1.useSharedValue)(selectedLeft + lensWidth);
|
|
164
|
-
const lensHeight = (0, react_native_reanimated_1.useSharedValue)(lensBaseHeight);
|
|
165
|
-
const lensOffsetY = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
166
|
-
const interactionProgress = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
167
|
-
const phase = (0, react_native_reanimated_1.useSharedValue)('idle');
|
|
168
|
-
const grabOffsetX = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
169
|
-
const originSelectedIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
|
|
170
|
-
const hoveredIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
|
|
171
|
-
const pendingIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
|
|
172
|
-
const snapStarted = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
173
|
-
const interactionActive = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
174
|
-
const holdCandidate = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
175
|
-
const holdActivated = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
176
|
-
const panActivated = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
177
|
-
const panActivationRequested = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
178
|
-
const panUpdateLogged = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
179
|
-
const touchSessionActive = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
180
|
-
const touchMovedPastSlop = (0, react_native_reanimated_1.useSharedValue)(false);
|
|
181
|
-
const sessionId = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
182
|
-
const touchedIndex = (0, react_native_reanimated_1.useSharedValue)(selected);
|
|
183
|
-
const holdTimerProgress = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
184
|
-
const touchStartX = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
185
|
-
const touchStartY = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
186
|
-
const lastHapticIndex = (0, react_native_reanimated_1.useSharedValue)(-1);
|
|
187
|
-
const dragVelocityX = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
188
|
-
const dragVelocityY = (0, react_native_reanimated_1.useSharedValue)(0);
|
|
189
|
-
const [liveBackdropEnabled, setLiveBackdropEnabled] = (0, react_1.useState)(false);
|
|
190
|
-
const interactionActiveRef = (0, react_1.useRef)(false);
|
|
191
|
-
const dragCommittedTargetRef = (0, react_1.useRef)(null);
|
|
192
|
-
const previousGeometryRef = (0, react_1.useRef)({ selected, barWidth: 0 });
|
|
193
|
-
const [gestureDebug, setGestureDebug] = (0, react_1.useState)({
|
|
194
|
-
phase: 'idle',
|
|
195
|
-
holdCandidate: false,
|
|
196
|
-
holdActivated: false,
|
|
197
|
-
dragging: false,
|
|
198
|
-
snapStarted: false,
|
|
199
|
-
gestureCount: 0,
|
|
200
|
-
origin: selected,
|
|
201
|
-
hovered: selected,
|
|
202
|
-
pending: selected,
|
|
203
|
-
touchCount: 0,
|
|
204
|
-
});
|
|
205
|
-
const noteTabViewTouch = (0, react_1.useCallback)(() => {
|
|
206
|
-
if (GESTURE_DEBUG_ENABLED)
|
|
207
|
-
setGestureDebug((current) => ({ ...current, touchCount: current.touchCount + 1 }));
|
|
208
|
-
}, []);
|
|
209
|
-
const noteGestureDown = (0, react_1.useCallback)(() => {
|
|
210
|
-
if (GESTURE_DEBUG_ENABLED)
|
|
211
|
-
setGestureDebug((current) => ({ ...current, gestureCount: current.gestureCount + 1 }));
|
|
212
|
-
}, []);
|
|
213
|
-
const updateGestureDebug = (0, react_1.useCallback)((nextPhase, nextHoldCandidate, nextHoldActivated, nextDragging, nextSnapStarted, origin, hovered, pending) => {
|
|
214
|
-
if (!GESTURE_DEBUG_ENABLED)
|
|
215
|
-
return;
|
|
216
|
-
setGestureDebug((current) => ({
|
|
217
|
-
...current,
|
|
218
|
-
phase: nextPhase,
|
|
219
|
-
holdCandidate: nextHoldCandidate,
|
|
220
|
-
holdActivated: nextHoldActivated,
|
|
221
|
-
dragging: nextDragging,
|
|
222
|
-
snapStarted: nextSnapStarted,
|
|
223
|
-
origin,
|
|
224
|
-
hovered,
|
|
225
|
-
pending,
|
|
226
|
-
}));
|
|
227
|
-
}, []);
|
|
228
|
-
(0, react_native_reanimated_1.useAnimatedReaction)(() => ({
|
|
229
|
-
phase: phase.value,
|
|
230
|
-
holdCandidate: holdCandidate.value,
|
|
231
|
-
holdActivated: holdActivated.value,
|
|
232
|
-
dragging: panActivated.value,
|
|
233
|
-
snapStarted: snapStarted.value,
|
|
234
|
-
origin: originSelectedIndex.value,
|
|
235
|
-
hovered: hoveredIndex.value,
|
|
236
|
-
pending: pendingIndex.value,
|
|
237
|
-
}), (current, previous) => {
|
|
238
|
-
if (!GESTURE_DEBUG_ENABLED)
|
|
239
|
-
return;
|
|
240
|
-
if (previous == null ||
|
|
241
|
-
current.phase !== previous.phase ||
|
|
242
|
-
current.holdCandidate !== previous.holdCandidate ||
|
|
243
|
-
current.holdActivated !== previous.holdActivated ||
|
|
244
|
-
current.dragging !== previous.dragging ||
|
|
245
|
-
current.snapStarted !== previous.snapStarted ||
|
|
246
|
-
current.origin !== previous.origin ||
|
|
247
|
-
current.hovered !== previous.hovered ||
|
|
248
|
-
current.pending !== previous.pending) {
|
|
249
|
-
(0, react_native_reanimated_1.runOnJS)(updateGestureDebug)(current.phase, current.holdCandidate, current.holdActivated, current.dragging, current.snapStarted, current.origin, current.hovered, current.pending);
|
|
250
|
-
}
|
|
251
|
-
}, [holdCandidate, holdActivated, hoveredIndex, originSelectedIndex, panActivated, pendingIndex, phase, snapStarted, updateGestureDebug]);
|
|
252
|
-
const beginInteraction = (0, react_1.useCallback)(() => {
|
|
253
|
-
interactionActiveRef.current = true;
|
|
254
|
-
dragCommittedTargetRef.current = null;
|
|
255
|
-
if (nativeLiveAvailable)
|
|
256
|
-
setLiveBackdropEnabled(true);
|
|
257
|
-
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => undefined);
|
|
258
|
-
}, [nativeLiveAvailable]);
|
|
259
|
-
const activateHoldOnUI = (0, react_1.useCallback)((expectedSessionId, expectedIndex) => {
|
|
260
|
-
'worklet';
|
|
261
|
-
if (!touchSessionActive.value ||
|
|
262
|
-
sessionId.value !== expectedSessionId ||
|
|
263
|
-
!holdCandidate.value ||
|
|
264
|
-
touchMovedPastSlop.value ||
|
|
265
|
-
expectedIndex !== selected)
|
|
266
|
-
return;
|
|
267
|
-
holdCandidate.value = false;
|
|
268
|
-
holdActivated.value = true;
|
|
269
|
-
phase.value = 'inflating';
|
|
270
|
-
interactionActive.value = true;
|
|
271
|
-
originSelectedIndex.value = selected;
|
|
272
|
-
hoveredIndex.value = selected;
|
|
273
|
-
pendingIndex.value = selected;
|
|
274
|
-
const currentCenter = (lensLeft.value + lensRight.value) / 2;
|
|
275
|
-
grabOffsetX.value = touchStartX.value - shellScreenLeft - currentCenter;
|
|
276
|
-
const expandedWidth = lensWidth + (reducedMotion ? 8 : 20);
|
|
277
|
-
const expandedHeight = lensBaseHeight + (reducedMotion ? 4 : 10);
|
|
278
|
-
lensLeft.value = (0, react_native_reanimated_1.withSpring)(currentCenter - expandedWidth / 2, reducedMotion ? IDLE_SPRING : { damping: 23, stiffness: 360, mass: 0.7 });
|
|
279
|
-
lensRight.value = (0, react_native_reanimated_1.withSpring)(currentCenter + expandedWidth / 2, reducedMotion ? IDLE_SPRING : { damping: 23, stiffness: 360, mass: 0.7 });
|
|
280
|
-
lensHeight.value = (0, react_native_reanimated_1.withSpring)(expandedHeight, reducedMotion ? { damping: 25, stiffness: 390 } : { damping: 23, stiffness: 350, mass: 0.7 });
|
|
281
|
-
interactionProgress.value = (0, react_native_reanimated_1.withTiming)(1, { duration: reducedMotion ? 85 : 135 });
|
|
282
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('HOLD_ACTIVE', `index=${selected}`);
|
|
283
|
-
(0, react_native_reanimated_1.runOnJS)(beginInteraction)();
|
|
284
|
-
if (GESTURE_DEBUG_ENABLED) {
|
|
285
|
-
(0, react_native_reanimated_1.runOnJS)(updateGestureDebug)('inflating', false, true, false, false, selected, selected, selected);
|
|
286
|
-
}
|
|
287
|
-
}, [beginInteraction, grabOffsetX, holdActivated, holdCandidate, hoveredIndex, interactionActive, interactionProgress, lensBaseHeight, lensHeight, lensLeft, lensRight, lensWidth, originSelectedIndex, pendingIndex, phase, reducedMotion, selected, sessionId, shellScreenLeft, touchMovedPastSlop, touchSessionActive, touchStartX, updateGestureDebug]);
|
|
288
|
-
const commitDragSelection = (0, react_1.useCallback)((targetIndex, startIndex) => {
|
|
289
|
-
const safeTarget = Math.max(0, Math.min(itemCount - 1, targetIndex));
|
|
290
|
-
const safeStart = Math.max(0, Math.min(itemCount - 1, startIndex));
|
|
291
|
-
if (safeTarget === safeStart || dragCommittedTargetRef.current !== null)
|
|
292
|
-
return;
|
|
293
|
-
// Mark this as the drag's own page change before notifying navigation.
|
|
294
|
-
// The selection effect must leave the remaining glass settle intact.
|
|
295
|
-
dragCommittedTargetRef.current = safeTarget;
|
|
296
|
-
previousGeometryRef.current = { selected: safeTarget, barWidth };
|
|
297
|
-
logGlassTabGesture('COMMIT', `target=${safeTarget}`);
|
|
298
|
-
(onSelectFromDrag ?? onSelect)(safeTarget);
|
|
299
|
-
}, [barWidth, itemCount, onSelect, onSelectFromDrag]);
|
|
300
|
-
const finishInteraction = (0, react_1.useCallback)((targetIndex) => {
|
|
301
|
-
const safeTarget = Math.max(0, Math.min(itemCount - 1, targetIndex));
|
|
302
|
-
interactionActiveRef.current = false;
|
|
303
|
-
setLiveBackdropEnabled(false);
|
|
304
|
-
previousGeometryRef.current = { selected: safeTarget, barWidth };
|
|
305
|
-
dragCommittedTargetRef.current = null;
|
|
306
|
-
logGlassTabGesture('BACKDROP_OFF');
|
|
307
|
-
logGlassTabGesture('RESET');
|
|
308
|
-
}, [barWidth, itemCount]);
|
|
309
|
-
const resetInteractionOnUI = (0, react_1.useCallback)((targetIndex) => {
|
|
310
|
-
'worklet';
|
|
311
|
-
const safeTarget = Math.max(0, Math.min(itemCount - 1, targetIndex));
|
|
312
|
-
if (phase.value === 'idle' && !interactionActive.value && !snapStarted.value)
|
|
313
|
-
return;
|
|
314
|
-
// Mark idle before cancelling. A cancelled animation callback can
|
|
315
|
-
// re-enter this function, where it will now be a harmless no-op.
|
|
316
|
-
phase.value = 'idle';
|
|
317
|
-
interactionActive.value = false;
|
|
318
|
-
snapStarted.value = false;
|
|
319
|
-
holdCandidate.value = false;
|
|
320
|
-
holdActivated.value = false;
|
|
321
|
-
panActivated.value = false;
|
|
322
|
-
panActivationRequested.value = false;
|
|
323
|
-
panUpdateLogged.value = false;
|
|
324
|
-
touchSessionActive.value = false;
|
|
325
|
-
touchMovedPastSlop.value = false;
|
|
326
|
-
touchStartX.value = 0;
|
|
327
|
-
touchStartY.value = 0;
|
|
328
|
-
touchedIndex.value = safeTarget;
|
|
329
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
330
|
-
holdTimerProgress.value = 0;
|
|
331
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensLeft);
|
|
332
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensRight);
|
|
333
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensHeight);
|
|
334
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensOffsetY);
|
|
335
|
-
(0, react_native_reanimated_1.cancelAnimation)(interactionProgress);
|
|
336
|
-
const center = horizontalPadding + itemWidth * (safeTarget + 0.5);
|
|
337
|
-
const left = center - lensWidth / 2;
|
|
338
|
-
lensLeft.value = left;
|
|
339
|
-
lensRight.value = left + lensWidth;
|
|
340
|
-
lensHeight.value = lensBaseHeight;
|
|
341
|
-
lensOffsetY.value = 0;
|
|
342
|
-
interactionProgress.value = 0;
|
|
343
|
-
dragVelocityX.value = 0;
|
|
344
|
-
dragVelocityY.value = 0;
|
|
345
|
-
originSelectedIndex.value = safeTarget;
|
|
346
|
-
hoveredIndex.value = safeTarget;
|
|
347
|
-
pendingIndex.value = safeTarget;
|
|
348
|
-
lastHapticIndex.value = -1;
|
|
349
|
-
(0, react_native_reanimated_1.runOnJS)(finishInteraction)(safeTarget);
|
|
350
|
-
}, [dragVelocityX, dragVelocityY, finishInteraction, holdActivated, holdCandidate, holdTimerProgress, horizontalPadding, hoveredIndex, interactionActive, interactionProgress, itemCount, itemWidth, lastHapticIndex, lensBaseHeight, lensHeight, lensLeft, lensOffsetY, lensRight, lensWidth, originSelectedIndex, panActivated, panActivationRequested, panUpdateLogged, pendingIndex, phase, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex]);
|
|
351
|
-
(0, react_1.useEffect)(() => {
|
|
352
|
-
if (barWidth <= 0)
|
|
353
|
-
return;
|
|
354
|
-
const previous = previousGeometryRef.current;
|
|
355
|
-
const initialMeasurement = previous.barWidth <= 0;
|
|
356
|
-
const selectionChanged = previous.selected !== selected;
|
|
357
|
-
const widthChanged = previous.barWidth > 0 && previous.barWidth !== barWidth;
|
|
358
|
-
if (dragCommittedTargetRef.current === selected) {
|
|
359
|
-
// Our drag already placed the lens at this page. Do not cancel its
|
|
360
|
-
// settling animation or run the normal tap-selection spring again.
|
|
361
|
-
previousGeometryRef.current = { selected, barWidth };
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
if (interactionActiveRef.current || interactionActive.value || phase.value !== 'idle') {
|
|
365
|
-
// An external page change during a live gesture takes ownership:
|
|
366
|
-
// cancel its animations and reconcile once the external selection
|
|
367
|
-
// is known. A drag's own commit pre-updates previousGeometryRef.
|
|
368
|
-
if (selectionChanged) {
|
|
369
|
-
phase.value = 'idle';
|
|
370
|
-
interactionActive.value = false;
|
|
371
|
-
snapStarted.value = false;
|
|
372
|
-
holdCandidate.value = false;
|
|
373
|
-
holdActivated.value = false;
|
|
374
|
-
panActivated.value = false;
|
|
375
|
-
panActivationRequested.value = false;
|
|
376
|
-
panUpdateLogged.value = false;
|
|
377
|
-
touchSessionActive.value = false;
|
|
378
|
-
touchMovedPastSlop.value = false;
|
|
379
|
-
touchStartX.value = 0;
|
|
380
|
-
touchStartY.value = 0;
|
|
381
|
-
touchedIndex.value = selected;
|
|
382
|
-
sessionId.value += 1;
|
|
383
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
384
|
-
holdTimerProgress.value = 0;
|
|
385
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensLeft);
|
|
386
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensRight);
|
|
387
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensHeight);
|
|
388
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensOffsetY);
|
|
389
|
-
(0, react_native_reanimated_1.cancelAnimation)(interactionProgress);
|
|
390
|
-
const safeIndex = Math.max(0, Math.min(itemCount - 1, selected));
|
|
391
|
-
const center = horizontalPadding + itemWidth * (safeIndex + 0.5);
|
|
392
|
-
const left = center - lensWidth / 2;
|
|
393
|
-
lensLeft.value = left;
|
|
394
|
-
lensRight.value = left + lensWidth;
|
|
395
|
-
lensHeight.value = lensBaseHeight;
|
|
396
|
-
lensOffsetY.value = 0;
|
|
397
|
-
interactionProgress.value = 0;
|
|
398
|
-
dragVelocityX.value = 0;
|
|
399
|
-
dragVelocityY.value = 0;
|
|
400
|
-
hoveredIndex.value = safeIndex;
|
|
401
|
-
pendingIndex.value = safeIndex;
|
|
402
|
-
originSelectedIndex.value = safeIndex;
|
|
403
|
-
lastHapticIndex.value = -1;
|
|
404
|
-
interactionActiveRef.current = false;
|
|
405
|
-
setLiveBackdropEnabled(false);
|
|
406
|
-
dragCommittedTargetRef.current = null;
|
|
407
|
-
logGlassTabGesture('BACKDROP_OFF');
|
|
408
|
-
logGlassTabGesture('RESET', 'external_selection');
|
|
409
|
-
previousGeometryRef.current = { selected, barWidth };
|
|
410
|
-
}
|
|
411
|
-
// Keep same-selection and layout changes pending while the
|
|
412
|
-
// session owns the lens; reconcile them after it finishes.
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
if (!initialMeasurement && !selectionChanged && !widthChanged)
|
|
416
|
-
return;
|
|
417
|
-
const safeIndex = Math.max(0, Math.min(itemCount - 1, selected));
|
|
418
|
-
const nextCenter = horizontalPadding + itemWidth * (safeIndex + 0.5);
|
|
419
|
-
const nextLeft = nextCenter - lensWidth / 2;
|
|
420
|
-
if (initialMeasurement) {
|
|
421
|
-
lensLeft.value = nextLeft;
|
|
422
|
-
lensRight.value = nextLeft + lensWidth;
|
|
423
|
-
lensHeight.value = lensBaseHeight;
|
|
424
|
-
}
|
|
425
|
-
else if (reducedMotion) {
|
|
426
|
-
lensLeft.value = (0, react_native_reanimated_1.withTiming)(nextLeft, { duration: 115 });
|
|
427
|
-
lensRight.value = (0, react_native_reanimated_1.withTiming)(nextLeft + lensWidth, { duration: 115 });
|
|
428
|
-
lensHeight.value = (0, react_native_reanimated_1.withTiming)(lensBaseHeight, { duration: 95 });
|
|
429
|
-
}
|
|
430
|
-
else {
|
|
431
|
-
lensLeft.value = (0, react_native_reanimated_1.withSpring)(nextLeft, TAP_SELECTION_SPRING);
|
|
432
|
-
lensRight.value = (0, react_native_reanimated_1.withSpring)(nextLeft + lensWidth, TAP_SELECTION_SPRING);
|
|
433
|
-
lensHeight.value = (0, react_native_reanimated_1.withSpring)(lensBaseHeight, { damping: 28, stiffness: 500, mass: 0.55 });
|
|
434
|
-
}
|
|
435
|
-
lensOffsetY.value = (0, react_native_reanimated_1.withTiming)(0, { duration: 110 });
|
|
436
|
-
previousGeometryRef.current = { selected, barWidth };
|
|
437
|
-
}, [barWidth, dragVelocityX, dragVelocityY, holdActivated, holdCandidate, holdTimerProgress, horizontalPadding, hoveredIndex, interactionActive, interactionProgress, itemCount, itemWidth, lastHapticIndex, lensBaseHeight, lensHeight, lensLeft, lensOffsetY, lensRight, lensWidth, originSelectedIndex, panActivated, panActivationRequested, panUpdateLogged, pendingIndex, phase, reducedMotion, selected, sessionId, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex]);
|
|
438
|
-
(0, react_1.useEffect)(() => () => {
|
|
439
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
440
|
-
phase.value = 'idle';
|
|
441
|
-
interactionActive.value = false;
|
|
442
|
-
snapStarted.value = false;
|
|
443
|
-
holdCandidate.value = false;
|
|
444
|
-
holdActivated.value = false;
|
|
445
|
-
panActivated.value = false;
|
|
446
|
-
panActivationRequested.value = false;
|
|
447
|
-
panUpdateLogged.value = false;
|
|
448
|
-
touchSessionActive.value = false;
|
|
449
|
-
touchMovedPastSlop.value = false;
|
|
450
|
-
sessionId.value += 1;
|
|
451
|
-
touchedIndex.value = -1;
|
|
452
|
-
touchStartX.value = 0;
|
|
453
|
-
touchStartY.value = 0;
|
|
454
|
-
interactionActiveRef.current = false;
|
|
455
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensLeft);
|
|
456
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensRight);
|
|
457
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensHeight);
|
|
458
|
-
(0, react_native_reanimated_1.cancelAnimation)(lensOffsetY);
|
|
459
|
-
(0, react_native_reanimated_1.cancelAnimation)(interactionProgress);
|
|
460
|
-
}, [holdActivated, holdCandidate, holdTimerProgress, interactionActive, interactionProgress, lensHeight, lensLeft, lensOffsetY, lensRight, panActivated, panActivationRequested, panUpdateLogged, phase, sessionId, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex]);
|
|
461
|
-
const onDragUpdate = (0, react_1.useCallback)((absoluteX, relativeY, velocityX, velocityY, startIndex) => {
|
|
462
|
-
'worklet';
|
|
463
|
-
if (phase.value === 'inflating')
|
|
464
|
-
phase.value = 'dragging';
|
|
465
|
-
const rawCenter = absoluteX - shellScreenLeft - grabOffsetX.value;
|
|
466
|
-
const baseHalf = lensWidth / 2;
|
|
467
|
-
const minCenter = baseHalf;
|
|
468
|
-
const maxCenter = barWidth - baseHalf;
|
|
469
|
-
let center = rawCenter;
|
|
470
|
-
if (center < minCenter)
|
|
471
|
-
center = minCenter + (center - minCenter) * 0.2;
|
|
472
|
-
if (center > maxCenter)
|
|
473
|
-
center = maxCenter + (center - maxCenter) * 0.2;
|
|
474
|
-
center = Math.max(minCenter - 16, Math.min(maxCenter + 16, center));
|
|
475
|
-
let nearestIndex = 0;
|
|
476
|
-
let nearestDistance = Number.MAX_VALUE;
|
|
477
|
-
for (let index = 0; index < itemCount; index += 1) {
|
|
478
|
-
const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
|
|
479
|
-
const distance = Math.abs(center - tabCenter);
|
|
480
|
-
if (distance < nearestDistance) {
|
|
481
|
-
nearestIndex = index;
|
|
482
|
-
nearestDistance = distance;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
hoveredIndex.value = nearestIndex;
|
|
486
|
-
const magneticRange = Math.max(itemWidth * 0.9, 1);
|
|
487
|
-
const magneticStrength = 0.075 * (1 - Math.min(nearestDistance / magneticRange, 1));
|
|
488
|
-
center += (horizontalPadding + itemWidth * (nearestIndex + 0.5) - center) * magneticStrength;
|
|
489
|
-
const speed = Math.min(Math.abs(velocityX) / 1800, 1);
|
|
490
|
-
const stretch = reducedMotion ? 0 : speed * 16;
|
|
491
|
-
const activeWidth = lensWidth + (reducedMotion ? 0 : 20) + stretch;
|
|
492
|
-
const direction = velocityX > 28 ? 1 : velocityX < -28 ? -1 : 0;
|
|
493
|
-
const leadingExtra = stretch * 0.62;
|
|
494
|
-
const trailingExtra = stretch * 0.14;
|
|
495
|
-
const targetLeft = center - activeWidth / 2 - (direction < 0 ? leadingExtra : trailingExtra);
|
|
496
|
-
const targetRight = center + activeWidth / 2 + (direction > 0 ? leadingExtra : trailingExtra);
|
|
497
|
-
const yOffset = reducedMotion ? 0 : Math.max(-8, Math.min(8, relativeY - height / 2));
|
|
498
|
-
dragVelocityX.value = velocityX;
|
|
499
|
-
dragVelocityY.value = velocityY;
|
|
500
|
-
lensOffsetY.value = yOffset;
|
|
501
|
-
lensHeight.value = lensBaseHeight + interactionProgress.value * 10 - (reducedMotion ? 0 : speed * 3);
|
|
502
|
-
// Keep the leading edge locked to the finger. Only the trailing edge
|
|
503
|
-
// chases it with a spring, so the lens translates continuously while
|
|
504
|
-
// still stretching like a viscous surface.
|
|
505
|
-
if (direction > 0) {
|
|
506
|
-
lensRight.value = targetRight;
|
|
507
|
-
lensLeft.value = (0, react_native_reanimated_1.withSpring)(targetLeft, EDGE_SPRING_SLOW);
|
|
508
|
-
}
|
|
509
|
-
else if (direction < 0) {
|
|
510
|
-
lensLeft.value = targetLeft;
|
|
511
|
-
lensRight.value = (0, react_native_reanimated_1.withSpring)(targetRight, EDGE_SPRING_SLOW);
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
lensLeft.value = (0, react_native_reanimated_1.withSpring)(targetLeft, IDLE_SPRING);
|
|
515
|
-
lensRight.value = (0, react_native_reanimated_1.withSpring)(targetRight, IDLE_SPRING);
|
|
516
|
-
}
|
|
517
|
-
const hapticIndex = nearestDistance < itemWidth * 0.36 && nearestIndex !== startIndex ? nearestIndex : -1;
|
|
518
|
-
if (hapticIndex !== lastHapticIndex.value) {
|
|
519
|
-
lastHapticIndex.value = hapticIndex;
|
|
520
|
-
if (hapticIndex >= 0)
|
|
521
|
-
(0, react_native_reanimated_1.runOnJS)(emitTargetHaptic)(hapticIndex);
|
|
522
|
-
}
|
|
523
|
-
}, [barWidth, dragVelocityX, dragVelocityY, grabOffsetX, height, horizontalPadding, hoveredIndex, interactionProgress, itemCount, itemWidth, lastHapticIndex, lensBaseHeight, lensHeight, lensLeft, lensRight, lensWidth, phase, reducedMotion, shellScreenLeft, lensOffsetY]);
|
|
524
|
-
const onBeginSnap = (0, react_1.useCallback)((velocityX, startIndex, cancelled = false) => {
|
|
525
|
-
'worklet';
|
|
526
|
-
if (snapStarted.value || (phase.value !== 'inflating' && phase.value !== 'dragging'))
|
|
527
|
-
return;
|
|
528
|
-
snapStarted.value = true;
|
|
529
|
-
phase.value = 'snapping';
|
|
530
|
-
const originIndex = cancelled ? startIndex : originSelectedIndex.value;
|
|
531
|
-
const currentCenter = (lensLeft.value + lensRight.value) / 2;
|
|
532
|
-
const projectedCenter = currentCenter + velocityX * 0.075;
|
|
533
|
-
let targetIndex = 0;
|
|
534
|
-
let nearestDistance = Number.MAX_VALUE;
|
|
535
|
-
if (cancelled) {
|
|
536
|
-
targetIndex = originIndex;
|
|
537
|
-
}
|
|
538
|
-
else {
|
|
539
|
-
for (let index = 0; index < itemCount; index += 1) {
|
|
540
|
-
const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
|
|
541
|
-
const distance = Math.abs(projectedCenter - tabCenter);
|
|
542
|
-
if (distance < nearestDistance) {
|
|
543
|
-
nearestDistance = distance;
|
|
544
|
-
targetIndex = index;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
const targetCenter = horizontalPadding + itemWidth * (targetIndex + 0.5);
|
|
549
|
-
const targetLeft = targetCenter - lensWidth / 2;
|
|
550
|
-
pendingIndex.value = targetIndex;
|
|
551
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('SNAP_START', `target=${targetIndex}${cancelled ? ' rollback' : ''}`);
|
|
552
|
-
// Page ownership changes as soon as the finger is released and the
|
|
553
|
-
// destination is known. The glass snap/settle continues independently,
|
|
554
|
-
// so navigation never waits for the trailing spring to finish.
|
|
555
|
-
if (!cancelled && targetIndex !== originIndex) {
|
|
556
|
-
(0, react_native_reanimated_1.runOnJS)(commitDragSelection)(targetIndex, originIndex);
|
|
557
|
-
}
|
|
558
|
-
lensOffsetY.value = (0, react_native_reanimated_1.withSpring)(0, { damping: 24, stiffness: 300 });
|
|
559
|
-
lensHeight.value = reducedMotion
|
|
560
|
-
? (0, react_native_reanimated_1.withTiming)(lensBaseHeight, { duration: 100 })
|
|
561
|
-
: (0, react_native_reanimated_1.withSpring)(lensBaseHeight, { damping: 25, stiffness: 320, mass: 0.7 });
|
|
562
|
-
const finishSnap = (finished) => {
|
|
563
|
-
'worklet';
|
|
564
|
-
if (phase.value !== 'snapping')
|
|
565
|
-
return;
|
|
566
|
-
if (!finished) {
|
|
567
|
-
resetInteractionOnUI(originIndex);
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
phase.value = 'settling';
|
|
571
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('SNAP_END', `target=${targetIndex}`);
|
|
572
|
-
interactionProgress.value = (0, react_native_reanimated_1.withTiming)(0, { duration: reducedMotion ? 95 : 145 }, (settled) => {
|
|
573
|
-
if (settled) {
|
|
574
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('SETTLE_END');
|
|
575
|
-
resetInteractionOnUI(targetIndex);
|
|
576
|
-
}
|
|
577
|
-
else {
|
|
578
|
-
resetInteractionOnUI(originIndex);
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
};
|
|
582
|
-
if (reducedMotion) {
|
|
583
|
-
lensLeft.value = (0, react_native_reanimated_1.withTiming)(targetLeft, { duration: 120 });
|
|
584
|
-
// One trailing edge owns completion. This avoids a two-callback
|
|
585
|
-
// counter getting stranded if either independent animation cancels.
|
|
586
|
-
lensRight.value = (0, react_native_reanimated_1.withTiming)(targetLeft + lensWidth, { duration: 120 }, finishSnap);
|
|
587
|
-
}
|
|
588
|
-
else {
|
|
589
|
-
// The trailing edge is the sole completion signal. It uses the
|
|
590
|
-
// slower spring, while the leading edge reaches the target first.
|
|
591
|
-
const wasMovingRight = velocityX >= 0;
|
|
592
|
-
lensLeft.value = (0, react_native_reanimated_1.withSpring)(targetLeft, wasMovingRight ? EDGE_SPRING_SLOW : EDGE_SPRING_FAST, wasMovingRight ? finishSnap : undefined);
|
|
593
|
-
lensRight.value = (0, react_native_reanimated_1.withSpring)(targetLeft + lensWidth, wasMovingRight ? EDGE_SPRING_FAST : EDGE_SPRING_SLOW, wasMovingRight ? undefined : finishSnap);
|
|
594
|
-
}
|
|
595
|
-
}, [commitDragSelection, horizontalPadding, interactionProgress, itemCount, itemWidth, lensBaseHeight, lensHeight, lensLeft, lensOffsetY, lensRight, lensWidth, originSelectedIndex, pendingIndex, phase, reducedMotion, resetInteractionOnUI, snapStarted]);
|
|
596
|
-
const tabBarGesture = react_1.default.useMemo(() => react_native_gesture_handler_1.Gesture.Pan()
|
|
597
|
-
// Horizontal controls must not steal vertical drags: without this the
|
|
598
|
-
// parent page stops scrolling whenever the finger lands on the control.
|
|
599
|
-
.activeOffsetX([-8, 8])
|
|
600
|
-
.failOffsetY([-16, 16])
|
|
601
|
-
.manualActivation(true)
|
|
602
|
-
.shouldCancelWhenOutside(false)
|
|
603
|
-
.maxPointers(1)
|
|
604
|
-
.onTouchesDown((event, manager) => {
|
|
605
|
-
'worklet';
|
|
606
|
-
const touch = event.changedTouches[0] ?? event.allTouches[0];
|
|
607
|
-
if (!touch) {
|
|
608
|
-
manager.fail();
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
|
-
(0, react_native_reanimated_1.runOnJS)(noteGestureDown)();
|
|
612
|
-
if (touchSessionActive.value || phase.value !== 'idle') {
|
|
613
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('INTERACTION_DOWN_BLOCKED', `phase=${phase.value}`);
|
|
614
|
-
manager.fail();
|
|
615
|
-
return;
|
|
616
|
-
}
|
|
617
|
-
const localX = touch.absoluteX - shellScreenLeft;
|
|
618
|
-
const rawIndex = Math.floor((localX - horizontalPadding) / Math.max(itemWidth, 1));
|
|
619
|
-
const hitIndex = Math.max(0, Math.min(itemCount - 1, rawIndex));
|
|
620
|
-
const nextSessionId = sessionId.value + 1;
|
|
621
|
-
sessionId.value = nextSessionId;
|
|
622
|
-
touchSessionActive.value = true;
|
|
623
|
-
touchMovedPastSlop.value = false;
|
|
624
|
-
touchedIndex.value = hitIndex;
|
|
625
|
-
touchStartX.value = touch.absoluteX;
|
|
626
|
-
touchStartY.value = touch.absoluteY;
|
|
627
|
-
originSelectedIndex.value = selected;
|
|
628
|
-
hoveredIndex.value = hitIndex;
|
|
629
|
-
pendingIndex.value = hitIndex;
|
|
630
|
-
holdCandidate.value = hitIndex === selected;
|
|
631
|
-
holdActivated.value = false;
|
|
632
|
-
panActivated.value = false;
|
|
633
|
-
panActivationRequested.value = false;
|
|
634
|
-
panUpdateLogged.value = false;
|
|
635
|
-
snapStarted.value = false;
|
|
636
|
-
interactionActive.value = false;
|
|
637
|
-
lastHapticIndex.value = -1;
|
|
638
|
-
phase.value = 'pressing';
|
|
639
|
-
manager.begin();
|
|
640
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('INTERACTION_DOWN', `hit=${hitIndex} selected=${selected}`);
|
|
641
|
-
if (hitIndex === selected) {
|
|
642
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('HOLD_BEGIN', `index=${selected}`);
|
|
643
|
-
holdTimerProgress.value = (0, react_native_reanimated_1.withDelay)(LONG_PRESS_THRESHOLD_MS, (0, react_native_reanimated_1.withTiming)(1, { duration: 1 }, (finished) => {
|
|
644
|
-
if (finished)
|
|
645
|
-
activateHoldOnUI(nextSessionId, selected);
|
|
646
|
-
}));
|
|
647
|
-
}
|
|
648
|
-
})
|
|
649
|
-
.onTouchesMove((event, manager) => {
|
|
650
|
-
'worklet';
|
|
651
|
-
if (!touchSessionActive.value)
|
|
652
|
-
return;
|
|
653
|
-
const touch = event.changedTouches[0] ?? event.allTouches[0];
|
|
654
|
-
if (!touch)
|
|
655
|
-
return;
|
|
656
|
-
const dx = touch.absoluteX - touchStartX.value;
|
|
657
|
-
const dy = touch.absoluteY - touchStartY.value;
|
|
658
|
-
const distanceSquared = dx * dx + dy * dy;
|
|
659
|
-
if (!holdActivated.value) {
|
|
660
|
-
if (Math.abs(dy) > Math.abs(dx) && distanceSquared > PRE_HOLD_SLOP * PRE_HOLD_SLOP) {
|
|
661
|
-
touchMovedPastSlop.value = true;
|
|
662
|
-
holdCandidate.value = false;
|
|
663
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
664
|
-
holdTimerProgress.value = 0;
|
|
665
|
-
manager.fail();
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
|
-
if (holdCandidate.value && Math.abs(dx) >= DRAG_START_SLOP && Math.abs(dx) >= Math.abs(dy) * 1.25) {
|
|
669
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
670
|
-
holdTimerProgress.value = 0;
|
|
671
|
-
activateHoldOnUI(sessionId.value, originSelectedIndex.value);
|
|
672
|
-
if (holdActivated.value) {
|
|
673
|
-
panActivationRequested.value = true;
|
|
674
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_REQUEST_ACTIVATE', 'immediate');
|
|
675
|
-
manager.activate();
|
|
676
|
-
}
|
|
677
|
-
return;
|
|
678
|
-
}
|
|
679
|
-
if (!holdCandidate.value && distanceSquared > PRE_HOLD_SLOP * PRE_HOLD_SLOP) {
|
|
680
|
-
touchMovedPastSlop.value = true;
|
|
681
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
682
|
-
holdTimerProgress.value = 0;
|
|
683
|
-
manager.fail();
|
|
684
|
-
}
|
|
685
|
-
return;
|
|
686
|
-
}
|
|
687
|
-
if (distanceSquared >= DRAG_START_SLOP * DRAG_START_SLOP && !panActivationRequested.value) {
|
|
688
|
-
panActivationRequested.value = true;
|
|
689
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_REQUEST_ACTIVATE');
|
|
690
|
-
manager.activate();
|
|
691
|
-
}
|
|
692
|
-
})
|
|
693
|
-
.onTouchesUp((event, manager) => {
|
|
694
|
-
'worklet';
|
|
695
|
-
if (!touchSessionActive.value)
|
|
696
|
-
return;
|
|
697
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('RELEASE');
|
|
698
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
699
|
-
holdTimerProgress.value = 0;
|
|
700
|
-
if (panActivated.value) {
|
|
701
|
-
// Pan's normal END event owns snap/commit after activation.
|
|
702
|
-
touchSessionActive.value = false;
|
|
703
|
-
return;
|
|
704
|
-
}
|
|
705
|
-
const touch = event.changedTouches[0] ?? event.allTouches[0];
|
|
706
|
-
const localX = touch ? touch.absoluteX - shellScreenLeft : touchStartX.value - shellScreenLeft;
|
|
707
|
-
const rawIndex = Math.floor((localX - horizontalPadding) / Math.max(itemWidth, 1));
|
|
708
|
-
const releaseIndex = Math.max(0, Math.min(itemCount - 1, rawIndex));
|
|
709
|
-
const origin = originSelectedIndex.value;
|
|
710
|
-
const didHold = holdActivated.value;
|
|
711
|
-
const wasCancelledByMovement = touchMovedPastSlop.value;
|
|
712
|
-
touchSessionActive.value = false;
|
|
713
|
-
if (didHold) {
|
|
714
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('HOLD_RELEASE', 'without_drag');
|
|
715
|
-
onBeginSnap(0, origin, true);
|
|
716
|
-
}
|
|
717
|
-
else if (!wasCancelledByMovement) {
|
|
718
|
-
phase.value = 'idle';
|
|
719
|
-
holdCandidate.value = false;
|
|
720
|
-
holdActivated.value = false;
|
|
721
|
-
interactionActive.value = false;
|
|
722
|
-
touchedIndex.value = releaseIndex;
|
|
723
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('TAP', `target=${releaseIndex}`);
|
|
724
|
-
(0, react_native_reanimated_1.runOnJS)(onSelect)(releaseIndex);
|
|
725
|
-
}
|
|
726
|
-
manager.fail();
|
|
727
|
-
})
|
|
728
|
-
.onStart(() => {
|
|
729
|
-
'worklet';
|
|
730
|
-
if (!holdActivated.value || phase.value !== 'inflating')
|
|
731
|
-
return;
|
|
732
|
-
panActivated.value = true;
|
|
733
|
-
phase.value = 'dragging';
|
|
734
|
-
// Keep the finger offset captured when the hold inflated the lens;
|
|
735
|
-
// that preserves the initial 3dp of movement instead of jumping.
|
|
736
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_ACTIVE');
|
|
737
|
-
})
|
|
738
|
-
.onUpdate((event) => {
|
|
739
|
-
'worklet';
|
|
740
|
-
if (phase.value !== 'dragging')
|
|
741
|
-
return;
|
|
742
|
-
if (!panUpdateLogged.value) {
|
|
743
|
-
panUpdateLogged.value = true;
|
|
744
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_UPDATE_FIRST');
|
|
745
|
-
}
|
|
746
|
-
onDragUpdate(event.absoluteX, event.y, event.velocityX, event.velocityY, originSelectedIndex.value);
|
|
747
|
-
})
|
|
748
|
-
.onEnd((event, success) => {
|
|
749
|
-
'worklet';
|
|
750
|
-
if (!success || !panActivated.value)
|
|
751
|
-
return;
|
|
752
|
-
touchSessionActive.value = false;
|
|
753
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
754
|
-
holdTimerProgress.value = 0;
|
|
755
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_END');
|
|
756
|
-
onBeginSnap(event.velocityX, originSelectedIndex.value, false);
|
|
757
|
-
})
|
|
758
|
-
.onFinalize((_event, success) => {
|
|
759
|
-
'worklet';
|
|
760
|
-
if (success)
|
|
761
|
-
return;
|
|
762
|
-
(0, react_native_reanimated_1.cancelAnimation)(holdTimerProgress);
|
|
763
|
-
holdTimerProgress.value = 0;
|
|
764
|
-
touchSessionActive.value = false;
|
|
765
|
-
if (phase.value === 'pressing') {
|
|
766
|
-
resetInteractionOnUI(originSelectedIndex.value);
|
|
767
|
-
}
|
|
768
|
-
else if (phase.value === 'inflating' || phase.value === 'dragging') {
|
|
769
|
-
(0, react_native_reanimated_1.runOnJS)(logGlassTabGesture)('PAN_END', 'cancel');
|
|
770
|
-
onBeginSnap(0, originSelectedIndex.value, true);
|
|
771
|
-
}
|
|
772
|
-
}), [activateHoldOnUI, horizontalPadding, holdActivated, holdCandidate, holdTimerProgress, interactionActive, itemCount, itemWidth, lastHapticIndex, noteGestureDown, onBeginSnap, onDragUpdate, onSelect, originSelectedIndex, panActivated, panActivationRequested, panUpdateLogged, pendingIndex, phase, resetInteractionOnUI, selected, sessionId, shellScreenLeft, snapStarted, touchMovedPastSlop, touchSessionActive, touchStartX, touchStartY, touchedIndex, hoveredIndex]);
|
|
773
|
-
const localLensStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
774
|
-
const width = Math.max(lensRight.value - lensLeft.value, 1);
|
|
775
|
-
const center = (lensLeft.value + lensRight.value) / 2;
|
|
776
|
-
return {
|
|
777
|
-
borderRadius: Math.min(lensHeight.value, width) / 2,
|
|
778
|
-
transform: [
|
|
779
|
-
{ translateX: center - selectedCenterX },
|
|
780
|
-
{ translateY: lensOffsetY.value },
|
|
781
|
-
{ scaleX: width / lensWidth },
|
|
782
|
-
{ scaleY: lensHeight.value / lensBaseHeight },
|
|
783
|
-
],
|
|
784
|
-
};
|
|
785
|
-
}, [lensBaseHeight, lensWidth, selectedCenterX]);
|
|
786
|
-
const liveLensStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
787
|
-
left: lensLeft.value,
|
|
788
|
-
top: (height - lensHeight.value) / 2 + lensOffsetY.value,
|
|
789
|
-
width: Math.max(lensRight.value - lensLeft.value, 1),
|
|
790
|
-
height: lensHeight.value,
|
|
791
|
-
borderRadius: Math.min(lensHeight.value, lensRight.value - lensLeft.value) / 2,
|
|
792
|
-
}), [height]);
|
|
793
|
-
const liveLensAnimatedProps = (0, react_native_reanimated_1.useAnimatedProps)(() => ({
|
|
794
|
-
interactionProgress: interactionProgress.value,
|
|
795
|
-
motionX: Math.max(-1, Math.min(1, dragVelocityX.value / 1800)),
|
|
796
|
-
motionY: Math.max(-1, Math.min(1, dragVelocityY.value / 1800)),
|
|
797
|
-
}));
|
|
798
|
-
const renderVisual = renderItem ?? renderIcon ?? ((item) => item.label);
|
|
799
|
-
const renderTabItems = (sampled = false) => items.map((item, index) => ((0, jsx_runtime_1.jsx)(GlassTabItem, { item: item, index: index, selected: index === selected, itemWidth: itemWidth, horizontalPadding: horizontalPadding, barHeight: height, renderVisual: renderVisual, customContent: renderItem != null, sampled: sampled, lensLeft: lensLeft, lensRight: lensRight }, `${item.label}-${index}`)));
|
|
800
|
-
const tabItems = renderTabItems();
|
|
801
|
-
const accessibilityTargets = items.map((item, index) => ((0, jsx_runtime_1.jsx)(react_native_1.View, { accessible: true, accessibilityRole: "tab", accessibilityLabel: item.label, accessibilityHint: accessibilityHint ?? '长按并拖动当前选中页签可切换页面', accessibilityState: { selected: index === selected }, accessibilityActions: [{ name: 'activate', label: item.label }], onAccessibilityAction: () => onSelect(index), style: styles.interactionTarget }, `tab-accessibility-${item.label}-${index}`)));
|
|
802
|
-
const resolvedShellRadius = shellRadius ?? height / 2;
|
|
803
|
-
const shellMaterial = {
|
|
804
|
-
opticsModel: 'referenceParity',
|
|
805
|
-
referenceDepthEffect: true,
|
|
806
|
-
radius: resolvedShellRadius,
|
|
807
|
-
surfaceColor: { light: shellSurfaceColor, dark: shellSurfaceColor },
|
|
808
|
-
blurRadius: tabBarMaterial?.blurRadius ?? 8,
|
|
809
|
-
refractionHeight: tabBarMaterial?.refractionHeight ?? 24,
|
|
810
|
-
refractionAmount: tabBarMaterial?.refractionAmount ?? -24,
|
|
811
|
-
saturation: tabBarMaterial?.saturation ?? 1.5,
|
|
812
|
-
chromaticAberration: 0,
|
|
813
|
-
highlightAlpha: 0.5,
|
|
814
|
-
highlightWidth: 0.5,
|
|
815
|
-
};
|
|
816
|
-
const shellStyle = {
|
|
817
|
-
width: barWidth,
|
|
818
|
-
height,
|
|
819
|
-
borderRadius: resolvedShellRadius,
|
|
820
|
-
borderColor: shellBorderColor,
|
|
821
|
-
backgroundColor: 'transparent',
|
|
822
|
-
shadowColor: shellShadowColor,
|
|
823
|
-
shadowOpacity: tabBarMaterial?.shadowOpacity ?? 0,
|
|
824
|
-
shadowRadius: tabBarMaterial?.shadowRadius ?? 0,
|
|
825
|
-
shadowOffset: { width: 0, height: tabBarMaterial?.shadowOffsetY ?? 0 },
|
|
826
|
-
elevation: tabBarMaterial?.elevation ?? 0,
|
|
827
|
-
};
|
|
828
|
-
const barContents = ((0, jsx_runtime_1.jsxs)(react_native_1.View, { ref: inlineHostRef, onLayout: presentation === 'inline' && typeof requestedWidth !== 'number'
|
|
829
|
-
? (event) => {
|
|
830
|
-
setInlineWidth(event.nativeEvent.layout.width);
|
|
831
|
-
inlineHostRef.current?.measureInWindow((left) => setInlineScreenLeft(left));
|
|
832
|
-
}
|
|
833
|
-
: undefined, pointerEvents: "box-none", style: presentation === 'floating'
|
|
834
|
-
? [styles.host, { left: shellScreenLeft, bottom: bottomInset + TAB_BAR_BOTTOM_GAP, width: barWidth, height }]
|
|
835
|
-
: [styles.inlineHost, { width: requestedWidth ?? '100%', height }], children: [nativeLiveAvailable ? ((0, jsx_runtime_1.jsx)(GlassSurface_1.RouteGlassCaptureScope, { scopeId: tabScopeId, children: (0, jsx_runtime_1.jsx)(TabLensScene, { children: (tabSceneProviderId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.RouteGlassCaptureSource, { captureMode: liveBackdropEnabled ? 'livePassThrough' : 'oneShotPassThrough', underlayProviderId: samplingProviderId, sourceRevision: `${dark}:${barWidth}:${height}:${items.map((item) => item.label).join('|')}`, style: react_native_1.StyleSheet.absoluteFill, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { pointerEvents: "none", style: [styles.shell, shellStyle], children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabBarShell", positioning: "inFlow", sampling: presentation === 'inline' ? 'local' : 'backdrop', providerIdOverride: samplingProviderId, inlineBackdrop: true, pointerEvents: "none", materialOverrides: shellMaterial, style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: resolvedShellRadius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [styles.row, { paddingHorizontal: horizontalPadding }], children: renderTabItems(true) })] }) }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { pointerEvents: "none", style: [styles.shell, shellStyle], children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabBarShell", frameOverride: shellFrameOverride, positioning: "inFlow",
|
|
836
|
-
// An inline bar lives inside the page's own route capture
|
|
837
|
-
// source, so sampling that scene makes the capture
|
|
838
|
-
// include the surface being captured. On the User page
|
|
839
|
-
// that cycle drove RenderNode::prepareTreeImpl into a
|
|
840
|
-
// stack overflow. Inline bars sample locally instead.
|
|
841
|
-
sampling: presentation === 'inline' ? 'local' : 'backdrop', samplingSource: "routeScene", providerIdOverride: samplingProviderId, inlineBackdrop: true, pointerEvents: "none", materialOverrides: shellMaterial, style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: resolvedShellRadius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [styles.row, { paddingHorizontal: horizontalPadding }], children: tabItems })] }), (0, jsx_runtime_1.jsx)(NativeGlassSurface, { pointerEvents: "none", providerId: tabSceneProviderId, opticsModel: appearance?.tokens.materials.tabSelectionLens.opticsModel, highlightStyle: appearance?.tokens.materials.tabSelectionLens.referenceHighlightStyle, interactionProfile: "tab", surfaceColor: appearance?.tokens.materials.tabSelectionLens.surfaceColor?.[dark ? 'dark' : 'light'], cornerRadius: appearance?.tokens.materials.tabSelectionLens.radius ?? lensBaseHeight / 2, blurRadius: (appearance?.tokens.materials.tabSelectionLens.blurRadius ?? 0.35) * (appearance?.tokens.materials.tabSelectionLens.opticsModel === 'referenceParity' ? 1 : appearance?.tokens.quality === 'high' ? 1.2 : 1), refractionHeight: lensRefractionHeight ?? appearance?.tokens.materials.tabSelectionLens.refractionHeight ?? 12, refractionAmount: appearance?.tokens.materials.tabSelectionLens.refractionAmount ?? 5.5, bodyRefractionAmount: appearance?.tokens.materials.tabSelectionLens.refractionBodyAmount ?? 1.5, saturation: appearance?.tokens.materials.tabSelectionLens.saturation ?? 1.02, chromaticAberration: appearance?.tokens.materials.tabSelectionLens.chromaticAberration ?? 0.3, highlightAlpha: appearance?.tokens.materials.tabSelectionLens.highlightAlpha ?? 0.62, highlightWidth: appearance?.tokens.materials.tabSelectionLens.highlightWidth ?? 1.3, tintAlpha: appearance?.tokens.materials.tabSelectionLens.tintAlpha ?? 0.08, specularStrength: appearance?.tokens.materials.tabSelectionLens.specularStrength ?? 0.95, fresnelStrength: appearance?.tokens.materials.tabSelectionLens.fresnelStrength ?? 0.72, innerShadowStrength: appearance?.tokens.materials.tabSelectionLens.innerShadowStrength ?? 0.2, shadowOpacity: appearance?.tokens.materials.tabSelectionLens.shadowOpacity ?? 0.05, shadowRadius: appearance?.tokens.materials.tabSelectionLens.shadowRadius ?? 4, shadowOffsetY: appearance?.tokens.materials.tabSelectionLens.shadowOffsetY ?? 4 / 6, tint: appearance?.tokens.tint[dark ? 'dark' : 'light'], continuous: liveBackdropEnabled, animatedProps: liveLensAnimatedProps, style: [styles.nativeLens, liveLensStyle] })] })) }) })) : ((0, jsx_runtime_1.jsxs)(react_native_1.View, { pointerEvents: "none", style: [styles.shell, shellStyle], children: [(0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabBarShell", frameOverride: shellFrameOverride, positioning: "inFlow", sampling: "backdrop", samplingSource: "routeScene", inlineBackdrop: true, pointerEvents: "none", materialOverrides: shellMaterial, style: [react_native_1.StyleSheet.absoluteFill, { borderRadius: resolvedShellRadius }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [styles.row, { paddingHorizontal: horizontalPadding }], children: tabItems }), (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassSurface, { variant: "tabSelectionLens", positioning: "inFlow", sampling: "backdrop", samplingSource: "routeScene", inlineBackdrop: true, pointerEvents: "none", style: {
|
|
842
|
-
position: 'absolute',
|
|
843
|
-
left: selectedLeft,
|
|
844
|
-
top: verticalInset,
|
|
845
|
-
width: lensWidth,
|
|
846
|
-
height: lensBaseHeight,
|
|
847
|
-
borderRadius: lensBaseHeight / 2,
|
|
848
|
-
zIndex: 2,
|
|
849
|
-
}, animatedStyle: localLensStyle })] })), GESTURE_DEBUG_ENABLED && ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.gestureDebugOverlay, { width: Math.max(barWidth, TAB_BAR_MIN_WIDTH) }], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.gestureDebugText, children: `view DOWN ${gestureDebug.touchCount} · gesture DOWN ${gestureDebug.gestureCount}\nphase ${gestureDebug.phase} · hold candidate ${gestureDebug.holdCandidate ? 'ON' : 'off'} · hold ${gestureDebug.holdActivated ? 'ON' : 'off'} · drag ${gestureDebug.dragging ? 'ON' : 'off'} · snap ${gestureDebug.snapStarted ? 'ON' : 'off'}\norigin ${gestureDebug.origin} · hovered ${gestureDebug.hovered} · pending ${gestureDebug.pending}` }) })), (0, jsx_runtime_1.jsx)(react_native_gesture_handler_1.GestureDetector, { gesture: tabBarGesture, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "auto", onTouchStart: GESTURE_DEBUG_ENABLED ? noteTabViewTouch : undefined, collapsable: false, style: [styles.interactionLayer, { width: barWidth, height }], children: accessibilityTargets }) })] }));
|
|
850
|
-
return presentation === 'floating'
|
|
851
|
-
? (0, jsx_runtime_1.jsx)(GlassSurface_1.GlassOverlay, { zIndex: TAB_BAR_PORTAL_Z_INDEX + 1, children: barContents })
|
|
852
|
-
: barContents;
|
|
853
|
-
}
|
|
854
|
-
// Floating overlays mount in the host's context, outside the calling page's
|
|
855
|
-
// capture scope. Resolve the id here so source and lens share that actual scope.
|
|
856
|
-
function TabLensScene({ children }) {
|
|
857
|
-
const providerId = (0, GlassSurface_1.useGlassSamplingProviderId)('routeScene');
|
|
858
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children(providerId ?? '') });
|
|
859
|
-
}
|
|
860
|
-
function GlassTabItem({ item, index, selected, itemWidth, horizontalPadding, barHeight, renderVisual, customContent, sampled = false, lensLeft, lensRight, }) {
|
|
861
|
-
const itemFocusStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
862
|
-
const center = (lensLeft.value + lensRight.value) / 2;
|
|
863
|
-
const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
|
|
864
|
-
const strength = Math.max(0, Math.min(1, 1 - Math.abs(center - tabCenter) / Math.max(itemWidth * 0.92, 1)));
|
|
865
|
-
return {
|
|
866
|
-
transform: [{ scale: 1 + strength * 0.025 }],
|
|
867
|
-
};
|
|
868
|
-
}, [horizontalPadding, index, itemWidth]);
|
|
869
|
-
const activeIconStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
870
|
-
const center = (lensLeft.value + lensRight.value) / 2;
|
|
871
|
-
const tabCenter = horizontalPadding + itemWidth * (index + 0.5);
|
|
872
|
-
const strength = Math.max(0, Math.min(1, 1 - Math.abs(center - tabCenter) / Math.max(itemWidth * 0.92, 1)));
|
|
873
|
-
return { opacity: strength };
|
|
874
|
-
}, [horizontalPadding, index, itemWidth]);
|
|
875
|
-
const baseVisual = renderVisual(item, index, sampled);
|
|
876
|
-
const activeVisual = sampled ? null : renderVisual(item, index, true);
|
|
877
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.item, { height: barHeight }], children: (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { style: [customContent ? styles.itemContentInline : styles.itemContent, itemFocusStyle], children: customContent ? ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.customContent, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.baseIcon, children: baseVisual }), (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.customActive, activeIconStyle], children: activeVisual })] })) : ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.icon, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.baseIcon, children: baseVisual }), (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: [styles.activeIcon, activeIconStyle], children: activeVisual })] })) }) }));
|
|
28
|
+
const width = Math.min(typeof requestedWidth === 'number' ? requestedWidth : 320, Math.max(0, windowWidth - tabConstants_4.TAB_BAR_SIDE_MARGIN * 2));
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(GlassSurface_1.GlassOverlay, { zIndex: tabConstants_5.TAB_BAR_PORTAL_Z_INDEX + 1, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: {
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
left: (windowWidth - width) / 2,
|
|
32
|
+
bottom: bottomInset + tabConstants_2.TAB_BAR_BOTTOM_GAP,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
}, children: (0, jsx_runtime_1.jsx)(ReferenceTabBar_1.ReferenceTabBar, { items: items, selected: selected, onSelect: onSelect, onReselect: onSelect, onSelectFromDrag: onSelectFromDrag, height: height, renderIcon: renderIcon ? (index, active) => renderIcon(items[index], index, active) : undefined, renderItem: renderItem ? (index, active) => renderItem(items[index], index, active) : undefined, accessibilityLabel: "\u5E95\u90E8\u5BFC\u822A", accessibilityHint: accessibilityHint, samplingProviderIdOverride: samplingProviderId }) }) }));
|
|
878
36
|
}
|
|
879
|
-
const styles = react_native_1.StyleSheet.create({
|
|
880
|
-
host: {
|
|
881
|
-
position: 'absolute',
|
|
882
|
-
zIndex: 1,
|
|
883
|
-
},
|
|
884
|
-
inlineHost: {
|
|
885
|
-
position: 'relative',
|
|
886
|
-
alignSelf: 'stretch',
|
|
887
|
-
zIndex: 1,
|
|
888
|
-
},
|
|
889
|
-
interactionLayer: {
|
|
890
|
-
...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill),
|
|
891
|
-
flexDirection: 'row',
|
|
892
|
-
zIndex: 100,
|
|
893
|
-
elevation: 100,
|
|
894
|
-
backgroundColor: 'transparent',
|
|
895
|
-
},
|
|
896
|
-
interactionTarget: {
|
|
897
|
-
flex: 1,
|
|
898
|
-
minWidth: 44,
|
|
899
|
-
minHeight: 44,
|
|
900
|
-
backgroundColor: 'transparent',
|
|
901
|
-
},
|
|
902
|
-
nativeLens: {
|
|
903
|
-
position: 'absolute',
|
|
904
|
-
zIndex: 2,
|
|
905
|
-
elevation: 8,
|
|
906
|
-
backgroundColor: 'transparent',
|
|
907
|
-
overflow: 'hidden',
|
|
908
|
-
},
|
|
909
|
-
gestureDebugOverlay: {
|
|
910
|
-
position: 'absolute',
|
|
911
|
-
left: 0,
|
|
912
|
-
top: -46,
|
|
913
|
-
zIndex: 99,
|
|
914
|
-
elevation: 99,
|
|
915
|
-
alignSelf: 'flex-start',
|
|
916
|
-
paddingHorizontal: 8,
|
|
917
|
-
paddingVertical: 5,
|
|
918
|
-
borderRadius: 6,
|
|
919
|
-
backgroundColor: 'rgba(12, 18, 28, 0.86)',
|
|
920
|
-
},
|
|
921
|
-
gestureDebugText: {
|
|
922
|
-
color: '#FFFFFF',
|
|
923
|
-
fontSize: 10,
|
|
924
|
-
lineHeight: 13,
|
|
925
|
-
fontVariant: ['tabular-nums'],
|
|
926
|
-
},
|
|
927
|
-
shell: {
|
|
928
|
-
overflow: 'hidden',
|
|
929
|
-
borderWidth: react_native_1.StyleSheet.hairlineWidth,
|
|
930
|
-
},
|
|
931
|
-
row: {
|
|
932
|
-
...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill),
|
|
933
|
-
flexDirection: 'row',
|
|
934
|
-
alignItems: 'center',
|
|
935
|
-
paddingHorizontal: TAB_BAR_HORIZONTAL_PADDING,
|
|
936
|
-
position: 'relative',
|
|
937
|
-
zIndex: 1,
|
|
938
|
-
elevation: 1,
|
|
939
|
-
},
|
|
940
|
-
item: {
|
|
941
|
-
flex: 1,
|
|
942
|
-
minWidth: 44,
|
|
943
|
-
minHeight: 44,
|
|
944
|
-
alignItems: 'center',
|
|
945
|
-
justifyContent: 'center',
|
|
946
|
-
},
|
|
947
|
-
itemContent: {
|
|
948
|
-
alignItems: 'center',
|
|
949
|
-
justifyContent: 'center',
|
|
950
|
-
gap: 3,
|
|
951
|
-
},
|
|
952
|
-
icon: {
|
|
953
|
-
height: 25,
|
|
954
|
-
minWidth: 26,
|
|
955
|
-
alignItems: 'center',
|
|
956
|
-
justifyContent: 'center',
|
|
957
|
-
},
|
|
958
|
-
baseIcon: { alignItems: 'center', justifyContent: 'center' },
|
|
959
|
-
activeIcon: { ...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill), alignItems: 'center', justifyContent: 'center' },
|
|
960
|
-
itemContentInline: {
|
|
961
|
-
flex: 1,
|
|
962
|
-
width: '100%',
|
|
963
|
-
alignItems: 'center',
|
|
964
|
-
justifyContent: 'center',
|
|
965
|
-
},
|
|
966
|
-
customContent: {
|
|
967
|
-
alignItems: 'center',
|
|
968
|
-
justifyContent: 'center',
|
|
969
|
-
},
|
|
970
|
-
customActive: {
|
|
971
|
-
...react_native_1.StyleSheet.flatten(react_native_1.StyleSheet.absoluteFill),
|
|
972
|
-
alignItems: 'center',
|
|
973
|
-
justifyContent: 'center',
|
|
974
|
-
},
|
|
975
|
-
});
|
|
976
37
|
//# sourceMappingURL=GlassTabBar.js.map
|