@mediacubeco/expo-template-fsd 2.3.1 → 2.4.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/.claude/commands/git-commit.md +164 -0
- package/.claude/rules/architecture.md +38 -0
- package/.claude/rules/{prettier-eslint-typescript.mdc → prettier-eslint-typescript.md} +5 -10
- package/.claude/settings.json +2 -2
- package/.claude/skills/api/SKILL.md +362 -0
- package/.claude/skills/api/references/client/overview.md +106 -0
- package/.claude/skills/api/references/hooks/index.ts +3 -0
- package/.claude/skills/api/references/hooks/use-api-health.ts +25 -0
- package/.claude/skills/api/references/hooks/use-api-post.ts +46 -0
- package/.claude/skills/api/references/hooks/use-api-posts.ts +24 -0
- package/.claude/skills/api/references/mock/post.mock.ts +29 -0
- package/.claude/skills/{generate-api-model/references → api/references/model}/entities/common.ts +5 -2
- package/.claude/skills/api/references/model/resources/common.ts +9 -0
- package/.claude/skills/api/references/queries/health.ts +14 -0
- package/.claude/skills/api/references/queries/index.ts +2 -0
- package/.claude/skills/api/references/queries/post.ts +23 -0
- package/.claude/skills/api/references/repository/health/health.ts +11 -0
- package/.claude/skills/api/references/repository/health/health.types.ts +25 -0
- package/.claude/skills/api/references/repository/health/index.ts +2 -0
- package/.claude/skills/api/references/repository/post/index.ts +9 -0
- package/.claude/skills/api/references/repository/post/post.ts +34 -0
- package/.claude/skills/api/references/repository/post/post.types.ts +61 -0
- package/.claude/skills/code-style/SKILL.md +1025 -1
- package/.claude/skills/code-style/references/components/payout-speed-option/index.ts +2 -0
- package/.claude/skills/code-style/references/components/payout-speed-option/payout-speed-option.styles.ts +76 -0
- package/.claude/skills/code-style/references/components/payout-speed-option/payout-speed-option.tsx +58 -0
- package/.claude/skills/code-style/references/components/payout-speed-option/payout-speed-option.types.ts +22 -0
- package/.claude/skills/code-style/references/components/post/index.ts +2 -0
- package/.claude/skills/code-style/references/components/post/post.styles.ts +19 -0
- package/.claude/skills/code-style/references/components/post/post.tsx +21 -0
- package/.claude/skills/code-style/references/components/post/post.types.ts +9 -0
- package/.claude/skills/code-style/references/components/wrap/index.ts +2 -0
- package/.claude/skills/code-style/references/components/wrap/wrap.styles.ts +15 -0
- package/.claude/skills/code-style/references/components/wrap/wrap.tsx +31 -0
- package/.claude/skills/code-style/references/components/wrap/wrap.types.ts +10 -0
- package/.claude/skills/code-style/references/hooks/use-posts.ts +37 -0
- package/.claude/skills/code-style/references/pages/post/index.ts +4 -0
- package/.claude/skills/code-style/references/pages/post/post-details/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-details/post-details.tsx +13 -0
- package/.claude/skills/code-style/references/pages/post/post-guide/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-guide/post-guide.tsx +17 -0
- package/.claude/skills/code-style/references/pages/post/post-list/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-list/post-list.styles.ts +17 -0
- package/.claude/skills/code-style/references/pages/post/post-list/post-list.tsx +25 -0
- package/.claude/skills/code-style/references/pages/post/post-share/index.ts +1 -0
- package/.claude/skills/code-style/references/pages/post/post-share/post-share.tsx +13 -0
- package/.claude/skills/code-style/references/routes/(stack)/_layout.tsx +18 -0
- package/.claude/skills/code-style/references/routes/(stack)/details.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(stack)/guide.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(stack)/index.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(stack)/share.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(tabs)/(post-details)/index.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(tabs)/(post-list)/index.tsx +8 -0
- package/.claude/skills/code-style/references/routes/(tabs)/_layout.tsx +50 -0
- package/.claude/skills/code-style/references/routes/_app.tsx +20 -0
- package/.claude/skills/code-style/references/routes/guide.tsx +8 -0
- package/.claude/skills/code-style/references/routes/share.tsx +8 -0
- package/.claude/skills/code-style/references/store/use-post-draft-store.ts +62 -0
- package/.claude/skills/design-style/SKILL.md +320 -0
- package/.env +3 -1
- package/.env.example +3 -1
- package/CLAUDE.md +5 -11
- package/app.json +6 -3
- package/axios.d.ts +5 -0
- package/env.d.ts +3 -1
- package/package.json +33 -40
- package/patches/react-native-screens+4.25.2.patch +118 -0
- package/react-query.d.ts +13 -0
- package/src/app/(root)/(home)/_layout.tsx +2 -2
- package/src/app/(root)/(home)/index.tsx +2 -2
- package/src/app/(root)/(settings)/_layout.tsx +2 -2
- package/src/app/(root)/(settings)/index.tsx +2 -2
- package/src/app/(root)/_layout.tsx +35 -32
- package/src/pages/home/home-main.tsx +3 -7
- package/src/pages/settings/settings-main.tsx +3 -7
- package/src/shared/assets/fonts/index.ts +3 -3
- package/src/shared/assets/fonts/sf-pro-text-bold.ttf +0 -0
- package/src/shared/assets/fonts/sf-pro-text-regular.ttf +0 -0
- package/src/shared/assets/fonts/sf-pro-text-semibold.ttf +0 -0
- package/src/shared/assets/icons/back.tsx +21 -0
- package/src/shared/assets/icons/close.tsx +21 -0
- package/src/shared/assets/icons/common.ts +8 -0
- package/src/shared/assets/icons/default.tsx +44 -0
- package/src/shared/assets/icons/index.ts +13 -1
- package/src/shared/assets/icons/refresh.tsx +23 -0
- package/src/shared/assets/icons/share.tsx +38 -0
- package/src/shared/assets/icons/type.ts +7 -0
- package/src/shared/assets/translations/index.ts +4 -4
- package/src/shared/constants/config.ts +13 -0
- package/src/shared/constants/environment.ts +16 -4
- package/src/shared/constants/index.ts +1 -0
- package/src/shared/hooks/index.ts +1 -4
- package/src/shared/hooks/use-compose.ts +23 -0
- package/src/shared/lib/api/api.client.ts +157 -0
- package/src/shared/lib/api/api.provider.tsx +14 -36
- package/src/shared/lib/api/api.ts +1 -5
- package/src/shared/lib/api/api.types.ts +6 -3
- package/src/shared/lib/api/hooks/index.ts +1 -0
- package/src/shared/lib/api/index.ts +2 -3
- package/src/shared/lib/api/models/api-instance/api-instance.client.ts +50 -0
- package/src/shared/lib/api/models/api-instance/api-instance.ts +30 -82
- package/src/shared/lib/api/models/api-instance/api-instance.types.ts +16 -18
- package/src/shared/lib/api/models/api-instance/api-instance.utils.ts +13 -20
- package/src/shared/lib/api/models/api-instance/index.ts +3 -0
- package/src/shared/lib/api/queries/index.ts +1 -0
- package/src/shared/lib/api/repositories/index.ts +1 -1
- package/src/shared/lib/localization/constants/index.ts +16 -5
- package/src/shared/lib/localization/index.ts +5 -1
- package/src/shared/lib/navigation/hooks/index.ts +8 -3
- package/src/shared/{hooks/use-breakpoints.ts → lib/navigation/hooks/use-navigation-breakpoints.ts} +2 -5
- package/src/shared/lib/navigation/hooks/use-navigation-dimensions.ts +12 -0
- package/src/shared/lib/navigation/hooks/use-navigation-options.tsx +175 -0
- package/src/shared/lib/navigation/hooks/{use-navigation.ts → use-navigation-route.ts} +2 -2
- package/src/shared/lib/navigation/hooks/use-navigation-safe-area.ts +61 -0
- package/src/shared/lib/navigation/hooks/use-navigation-tabs-native.ts +10 -0
- package/src/shared/lib/navigation/hooks/use-navigation-tabs.tsx +10 -0
- package/src/shared/lib/navigation/hooks/use-navigation-transition.ts +27 -0
- package/src/shared/lib/navigation/index.ts +11 -4
- package/src/shared/lib/navigation/navigation-tabs-native.context.tsx +5 -0
- package/src/shared/lib/navigation/navigation-tabs-native.provider.tsx +17 -0
- package/src/shared/lib/navigation/navigation-tabs.context.tsx +10 -0
- package/src/shared/lib/navigation/navigation-tabs.provider.tsx +22 -0
- package/src/shared/lib/navigation/navigation.provider.tsx +6 -1
- package/src/shared/lib/storage/index.ts +1 -1
- package/src/shared/lib/storage/storage.provider.tsx +4 -0
- package/src/shared/lib/storage/storage.ts +29 -25
- package/src/shared/lib/theme/constants/animations.ts +26 -0
- package/src/shared/lib/theme/constants/colors.ts +336 -43
- package/src/shared/lib/theme/constants/delays.ts +1 -1
- package/src/shared/lib/theme/constants/durations.ts +1 -1
- package/src/shared/lib/theme/constants/fonts.ts +2 -1
- package/src/shared/lib/theme/constants/index.ts +42 -20
- package/src/shared/lib/theme/constants/shadows.ts +7 -25
- package/src/shared/lib/theme/constants/sizes.ts +11 -2
- package/src/shared/lib/theme/constants/transparencies.ts +1 -1
- package/src/shared/lib/theme/hooks/use-theme-setup.ts +3 -1
- package/src/shared/lib/theme/index.ts +10 -1
- package/src/shared/lib/theme/theme.provider.tsx +45 -19
- package/src/shared/lib/theme/theme.scope.tsx +43 -0
- package/src/shared/lib/theme/theme.types.ts +15 -3
- package/src/shared/lib/theme/utils/color.ts +81 -0
- package/src/shared/lib/theme/utils/index.ts +2 -0
- package/src/shared/lib/theme/utils/snapshot.ts +17 -0
- package/src/shared/lib/theme/utils/storage.ts +5 -2
- package/src/shared/services/browser/browser.ts +66 -0
- package/src/shared/services/browser/index.ts +1 -0
- package/src/shared/services/cookies/cookies.ts +73 -0
- package/src/shared/services/cookies/index.ts +1 -0
- package/src/shared/services/index.ts +5 -0
- package/src/shared/services/linking/index.ts +1 -0
- package/src/shared/services/linking/linking.ts +22 -0
- package/src/shared/services/share/index.ts +1 -0
- package/src/shared/services/share/share.ts +28 -0
- package/src/shared/services/universal-links/index.ts +104 -0
- package/src/shared/services/universal-links/universal-links.ts +25 -0
- package/src/shared/services/universal-links/universal-links.types.ts +5 -0
- package/src/shared/ui/atoms/blur/blur.tsx +9 -4
- package/src/shared/ui/atoms/blur/blur.types.ts +1 -1
- package/src/shared/ui/atoms/blur-progress/blur-progress.styles.ts +16 -0
- package/src/shared/ui/atoms/blur-progress/blur-progress.tsx +30 -0
- package/src/shared/ui/atoms/blur-progress/blur-progress.types.tsx +5 -0
- package/src/shared/ui/atoms/blur-progress/index.ts +1 -0
- package/src/shared/ui/atoms/glass/glass.tsx +13 -5
- package/src/shared/ui/atoms/glass/glass.types.ts +1 -1
- package/src/shared/ui/atoms/icon/icon.styles.ts +82 -0
- package/src/shared/ui/atoms/icon/icon.tsx +21 -0
- package/src/shared/ui/atoms/icon/icon.types.ts +23 -0
- package/src/shared/ui/atoms/icon/index.ts +2 -0
- package/src/shared/ui/atoms/index.ts +7 -0
- package/src/shared/ui/atoms/skeleton/index.ts +2 -0
- package/src/shared/ui/atoms/skeleton/skeleton.styles.ts +69 -0
- package/src/shared/ui/atoms/skeleton/skeleton.tsx +26 -0
- package/src/shared/ui/atoms/skeleton/skeleton.types.ts +9 -0
- package/src/shared/ui/atoms/spinner/index.ts +2 -0
- package/src/shared/ui/atoms/spinner/spinner.styles.ts +102 -0
- package/src/shared/ui/atoms/spinner/spinner.tsx +48 -0
- package/src/shared/ui/atoms/spinner/spinner.types.ts +25 -0
- package/src/shared/ui/atoms/text/index.ts +2 -0
- package/src/shared/ui/atoms/text/text.styles.ts +186 -0
- package/src/shared/ui/atoms/text/text.tsx +37 -0
- package/src/shared/ui/atoms/text/text.types.ts +35 -0
- package/src/shared/ui/atoms/touch/components/haptics/haptics.styles.ts +21 -0
- package/src/shared/ui/atoms/touch/components/haptics/haptics.tsx +28 -0
- package/src/shared/ui/atoms/touch/components/haptics/haptics.types.ts +17 -0
- package/src/shared/ui/atoms/touch/components/haptics/index.ts +2 -0
- package/src/shared/ui/atoms/touch/components/index.ts +3 -0
- package/src/shared/ui/atoms/touch/components/ripple/index.ts +2 -0
- package/src/shared/ui/atoms/touch/components/ripple/ripple.styles.ts +78 -0
- package/src/shared/ui/atoms/touch/components/ripple/ripple.tsx +29 -0
- package/src/shared/ui/atoms/touch/components/ripple/ripple.types.ts +17 -0
- package/src/shared/ui/atoms/touch/components/spring/index.ts +2 -0
- package/src/shared/ui/atoms/touch/components/spring/spring.styles.ts +31 -0
- package/src/shared/ui/atoms/touch/components/spring/spring.tsx +28 -0
- package/src/shared/ui/atoms/touch/components/spring/spring.types.ts +17 -0
- package/src/shared/ui/atoms/touch/index.ts +2 -0
- package/src/shared/ui/atoms/touch/touch.styles.ts +14 -0
- package/src/shared/ui/atoms/touch/touch.tsx +137 -0
- package/src/shared/ui/atoms/touch/touch.types.ts +27 -0
- package/src/shared/ui/atoms/visibility/index.ts +2 -0
- package/src/shared/ui/atoms/visibility/visibility.styles.ts +85 -0
- package/src/shared/ui/atoms/visibility/visibility.tsx +61 -0
- package/src/shared/ui/atoms/visibility/visibility.types.ts +34 -0
- package/src/shared/ui/molecules/keyboard-area/keyboard-area.styles.ts +11 -9
- package/src/shared/ui/molecules/keyboard-area/keyboard-area.tsx +3 -6
- package/src/shared/ui/molecules/refresh-control/refresh-control.tsx +3 -5
- package/src/shared/ui/molecules/refresh-control/refresh-control.types.ts +1 -1
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/dot.styles.ts +41 -0
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/dot.tsx +12 -0
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/dot.types.ts +13 -0
- package/src/shared/ui/molecules/slider/components/indicator/components/dot/index.ts +2 -0
- package/src/shared/ui/molecules/slider/components/indicator/index.ts +2 -0
- package/src/shared/ui/molecules/slider/components/indicator/indicator.styles.ts +20 -0
- package/src/shared/ui/molecules/slider/components/indicator/indicator.tsx +22 -0
- package/src/shared/ui/molecules/slider/components/indicator/indicator.types.ts +10 -0
- package/src/shared/ui/molecules/slider/index.ts +3 -0
- package/src/shared/ui/molecules/slider/slider.styles.ts +68 -0
- package/src/shared/ui/molecules/slider/slider.tsx +64 -0
- package/src/shared/ui/molecules/slider/slider.types.ts +28 -0
- package/src/shared/ui/organisms/bar/bar.styles.ts +100 -0
- package/src/shared/ui/organisms/bar/bar.tsx +89 -0
- package/src/shared/ui/organisms/bar/bar.types.ts +49 -0
- package/src/shared/ui/organisms/bar/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab/bar-tab.tsx +9 -0
- package/src/shared/ui/organisms/bar-tab/bar-tab.types.ts +5 -0
- package/src/shared/ui/organisms/bar-tab/components/index.ts +1 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/tab.styles.ts +21 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/tab.tsx +18 -0
- package/src/shared/ui/organisms/bar-tab/components/tab/tab.types.ts +5 -0
- package/src/shared/ui/organisms/bar-tab/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab-navigation/bar-tab-navigation.styles.ts +22 -0
- package/src/shared/ui/organisms/bar-tab-navigation/bar-tab-navigation.tsx +66 -0
- package/src/shared/ui/organisms/bar-tab-navigation/bar-tab-navigation.types.ts +5 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/index.ts +1 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/index.ts +2 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/tab-navigation.styles.ts +56 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/tab-navigation.tsx +30 -0
- package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/tab-navigation.types.ts +7 -0
- package/src/shared/ui/organisms/bar-tab-navigation/index.ts +2 -0
- package/src/shared/ui/organisms/index.ts +4 -1
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/dot.styles.ts +41 -0
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/dot.tsx +12 -0
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/dot.types.ts +13 -0
- package/src/shared/ui/organisms/slider/components/indicator/components/dot/index.ts +2 -0
- package/src/shared/ui/organisms/slider/components/indicator/index.ts +2 -0
- package/src/shared/ui/organisms/slider/components/indicator/indicator.styles.ts +20 -0
- package/src/shared/ui/organisms/slider/components/indicator/indicator.tsx +22 -0
- package/src/shared/ui/organisms/slider/components/indicator/indicator.types.ts +10 -0
- package/src/shared/ui/organisms/slider/index.ts +3 -0
- package/src/shared/ui/organisms/slider/slider.styles.ts +68 -0
- package/src/shared/ui/organisms/slider/slider.tsx +64 -0
- package/src/shared/ui/organisms/slider/slider.types.ts +28 -0
- package/src/shared/ui/templates/index.ts +3 -0
- package/src/shared/ui/templates/modal-container/index.ts +13 -0
- package/src/shared/ui/templates/modal-container/modal-container-list.tsx +45 -0
- package/src/shared/ui/templates/modal-container/modal-container-scroll.tsx +66 -0
- package/src/shared/ui/templates/modal-container/modal-container-section-list.tsx +46 -0
- package/src/shared/ui/templates/modal-container/modal-container.hooks.tsx +172 -0
- package/src/shared/ui/templates/modal-container/modal-container.styles.ts +121 -0
- package/src/shared/ui/templates/modal-container/modal-container.types.ts +69 -0
- package/src/shared/ui/templates/screen-container/index.ts +1 -1
- package/src/shared/ui/templates/screen-container/screen-container-list.tsx +28 -10
- package/src/shared/ui/templates/screen-container/screen-container-scroll.tsx +28 -10
- package/src/shared/ui/templates/screen-container/screen-container-section-list.tsx +29 -11
- package/src/shared/ui/templates/screen-container/screen-container.hooks.tsx +79 -8
- package/src/shared/ui/templates/screen-container/screen-container.styles.ts +105 -15
- package/src/shared/ui/templates/screen-container/screen-container.types.tsx +34 -7
- package/src/shared/ui/templates/screen-header/components/index.ts +6 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-description/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-description/screen-header-description.tsx +15 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-description/screen-header-description.types.ts +11 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/screen-header-icon.styles.ts +44 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/screen-header-icon.tsx +65 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon/screen-header-icon.types.ts +14 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-back/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-back/screen-header-icon-back.tsx +17 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-back/screen-header-icon-back.types.ts +6 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-close/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-close/screen-header-icon-close.tsx +27 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-icon-close/screen-header-icon-close.types.ts +10 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-info/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-info/screen-header-info.tsx +15 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-info/screen-header-info.types.ts +10 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-title/index.ts +2 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-title/screen-header-title.tsx +19 -0
- package/src/shared/ui/templates/screen-header/components/screen-header-title/screen-header-title.types.ts +13 -0
- package/src/shared/ui/templates/screen-header/index.ts +3 -0
- package/src/shared/ui/templates/screen-header/screen-header.styles.ts +49 -0
- package/src/shared/ui/templates/screen-header/screen-header.tsx +26 -0
- package/src/shared/ui/templates/screen-header/screen-header.types.ts +15 -0
- package/src/shared/ui/templates/web-container/index.ts +2 -0
- package/src/shared/ui/templates/web-container/web-container.styles.ts +34 -0
- package/src/shared/ui/templates/web-container/web-container.tsx +172 -0
- package/src/shared/ui/templates/web-container/web-container.types.ts +21 -0
- package/.claude/rules/app-routing.mdc +0 -47
- package/.claude/rules/exports-at-end.mdc +0 -55
- package/.claude/rules/kebab-case-naming.mdc +0 -29
- package/.claude/rules/mediacubeco-packages.mdc +0 -56
- package/.claude/skills/generate-api-model/SKILL.md +0 -230
- package/.claude/skills/generate-api-model/references/resources/common.ts +0 -8
- package/.claude/skills/generate-api-model-mock/SKILL.md +0 -56
- package/.claude/skills/git-commit/SKILL.md +0 -139
- package/.gitignore +0 -34
- package/src/shared/assets/icons/like.tsx +0 -17
- package/src/shared/hooks/use-animated.ts +0 -200
- package/src/shared/hooks/use-mixins.ts +0 -36
- package/src/shared/hooks/use-safe-area.ts +0 -75
- package/src/shared/lib/api/repositories/auth/auth.ts +0 -23
- package/src/shared/lib/api/repositories/auth/auth.types.ts +0 -22
- package/src/shared/lib/api/repositories/auth/index.ts +0 -1
- package/src/shared/lib/navigation/hooks/use-navigation-native-tabs.ts +0 -10
- package/src/shared/lib/navigation/hooks/use-navigation-options.ts +0 -123
- package/src/shared/lib/navigation/navigation-native-tabs.context.tsx +0 -5
- package/src/shared/lib/navigation/navigation-native-tabs.provider.tsx +0 -12
- package/src/shared/lib/theme/constants/borders.ts +0 -8
- package/src/shared/lib/theme/constants/weights.ts +0 -13
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/post/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/post/post-comment.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/post/post.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/user-settings.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/user-verification.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/entities/user/user.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/post/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/post/post-comment.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/post/post.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/index.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/user-settings.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/user-verification.ts +0 -0
- /package/.claude/skills/{generate-api-model/references → api/references/model}/resources/user/user.ts +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { runCallback } from '@mediacubeco/base/utils'
|
|
2
|
+
import { useCallback } from 'react'
|
|
3
|
+
import { type ListRenderItem, View } from 'react-native'
|
|
4
|
+
import Animated from 'react-native-reanimated'
|
|
5
|
+
import { useSliderStyles } from './slider.styles'
|
|
6
|
+
import { type SliderProps } from './slider.types'
|
|
7
|
+
|
|
8
|
+
const Slider = <Item,>({
|
|
9
|
+
ref,
|
|
10
|
+
style,
|
|
11
|
+
data = [],
|
|
12
|
+
itemWidth,
|
|
13
|
+
itemGap,
|
|
14
|
+
sliderItemWidth,
|
|
15
|
+
sliderItemGap,
|
|
16
|
+
onScroll,
|
|
17
|
+
onScrollBeginDrag,
|
|
18
|
+
onMomentumScrollEnd,
|
|
19
|
+
renderItem: inputRenderItem,
|
|
20
|
+
}: SliderProps<Item>) => {
|
|
21
|
+
const itemCount = data.length
|
|
22
|
+
|
|
23
|
+
const { styles, snapToOffsets, getItemLayout, handleWrapperLayout } = useSliderStyles({
|
|
24
|
+
itemCount,
|
|
25
|
+
itemWidth,
|
|
26
|
+
itemGap,
|
|
27
|
+
sliderItemWidth,
|
|
28
|
+
sliderItemGap,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const renderItem: ListRenderItem<Item> = useCallback(
|
|
32
|
+
({ item, index, separators }) => {
|
|
33
|
+
return (
|
|
34
|
+
<View style={styles.item}>{runCallback(inputRenderItem, { item, index, separators })}</View>
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
[styles.item, inputRenderItem]
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<View style={[styles.wrapper, style]} onLayout={handleWrapperLayout}>
|
|
42
|
+
<Animated.FlatList
|
|
43
|
+
ref={ref}
|
|
44
|
+
data={data}
|
|
45
|
+
style={styles.content}
|
|
46
|
+
contentContainerStyle={styles.container}
|
|
47
|
+
scrollEventThrottle={16}
|
|
48
|
+
decelerationRate={'fast'}
|
|
49
|
+
snapToAlignment={'center'}
|
|
50
|
+
snapToOffsets={snapToOffsets}
|
|
51
|
+
horizontal={true}
|
|
52
|
+
showsVerticalScrollIndicator={false}
|
|
53
|
+
showsHorizontalScrollIndicator={false}
|
|
54
|
+
onScroll={onScroll}
|
|
55
|
+
onScrollBeginDrag={onScrollBeginDrag}
|
|
56
|
+
onMomentumScrollEnd={onMomentumScrollEnd}
|
|
57
|
+
getItemLayout={getItemLayout}
|
|
58
|
+
renderItem={renderItem}
|
|
59
|
+
/>
|
|
60
|
+
</View>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default Slider
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type FlatListProps, type ListRenderItem, type ViewProps } from 'react-native'
|
|
2
|
+
import type Animated from 'react-native-reanimated'
|
|
3
|
+
import { type AnimatedProps, type AnimatedRef, type SharedValue } from 'react-native-reanimated'
|
|
4
|
+
|
|
5
|
+
type SliderRef = Animated.FlatList
|
|
6
|
+
|
|
7
|
+
type SliderProps<Item = unknown> = {
|
|
8
|
+
ref?: AnimatedRef<SliderRef>
|
|
9
|
+
style?: ViewProps['style']
|
|
10
|
+
data: Item[]
|
|
11
|
+
itemWidth?: number
|
|
12
|
+
itemGap?: number
|
|
13
|
+
sliderItemWidth?: SharedValue<number>
|
|
14
|
+
sliderItemGap?: SharedValue<number>
|
|
15
|
+
onScroll?: AnimatedProps<FlatListProps<Item>>['onScroll']
|
|
16
|
+
onScrollBeginDrag?: FlatListProps<Item>['onScrollBeginDrag']
|
|
17
|
+
onMomentumScrollEnd?: FlatListProps<Item>['onMomentumScrollEnd']
|
|
18
|
+
renderItem: ListRenderItem<Item>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type SliderStylesContext = Pick<
|
|
22
|
+
SliderProps,
|
|
23
|
+
'itemWidth' | 'itemGap' | 'sliderItemWidth' | 'sliderItemGap'
|
|
24
|
+
> & {
|
|
25
|
+
itemCount: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type { SliderRef, SliderProps, SliderStylesContext }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { DEFAULT_LAYOUT, useLayout } from '@mediacubeco/base-react-native/hooks'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import {
|
|
5
|
+
clamp,
|
|
6
|
+
interpolate,
|
|
7
|
+
interpolateColor,
|
|
8
|
+
useAnimatedStyle,
|
|
9
|
+
useSharedValue,
|
|
10
|
+
} from 'react-native-reanimated'
|
|
11
|
+
import { useThemeMode } from '../../../lib'
|
|
12
|
+
import { type BarStylesContext } from './bar.types'
|
|
13
|
+
|
|
14
|
+
const useBarStyles = ({ index, initIndex = 0, itemCount }: BarStylesContext) => {
|
|
15
|
+
const [wrapperLayout, setLayout] = useState(DEFAULT_LAYOUT)
|
|
16
|
+
const { SIZES, COLORS, SHADOWS } = useThemeMode()
|
|
17
|
+
const position = useSharedValue(0)
|
|
18
|
+
const focus = useSharedValue(0)
|
|
19
|
+
const defaultIndex = useSharedValue(initIndex)
|
|
20
|
+
const handleWrapperLayout = useLayout({ setLayout })
|
|
21
|
+
|
|
22
|
+
const activeIndex = index ?? defaultIndex
|
|
23
|
+
|
|
24
|
+
const BAR_PADDING = SIZES['M']
|
|
25
|
+
const BAR_GAP = SIZES['M']
|
|
26
|
+
const BAR_AREA = BAR_PADDING * 2 + BAR_GAP * (itemCount - 1)
|
|
27
|
+
const BAR_ITEM_WIDTH = (wrapperLayout.width - BAR_AREA) / itemCount
|
|
28
|
+
|
|
29
|
+
const styles = StyleSheet.create({
|
|
30
|
+
wrapper: {
|
|
31
|
+
overflow: 'visible',
|
|
32
|
+
padding: BAR_PADDING,
|
|
33
|
+
borderRadius: SIZES['INFINITY'],
|
|
34
|
+
backgroundColor: COLORS.BAR.BASE,
|
|
35
|
+
...SHADOWS.BASE,
|
|
36
|
+
},
|
|
37
|
+
data: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
gap: BAR_GAP,
|
|
40
|
+
},
|
|
41
|
+
item: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
},
|
|
44
|
+
indicator: {
|
|
45
|
+
zIndex: -1,
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
top: SIZES['MIN'],
|
|
49
|
+
left: SIZES['MIN'],
|
|
50
|
+
width: BAR_ITEM_WIDTH,
|
|
51
|
+
height: SIZES['MAX'],
|
|
52
|
+
borderWidth: SIZES['2XS'],
|
|
53
|
+
borderRadius: SIZES['INFINITY'],
|
|
54
|
+
backgroundColor: COLORS.BAR.SECONDARY,
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const animatedStyles = {
|
|
59
|
+
wrapper: useAnimatedStyle(() => {
|
|
60
|
+
return {
|
|
61
|
+
transform: [
|
|
62
|
+
{
|
|
63
|
+
scale: interpolate(focus.value, [0, 1], [1, 1.05]),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
indicator: useAnimatedStyle(() => {
|
|
69
|
+
return {
|
|
70
|
+
transform: [
|
|
71
|
+
{ translateX: clamp(activeIndex.value, 0, itemCount - 1) * (BAR_ITEM_WIDTH + BAR_GAP) },
|
|
72
|
+
{ scaleX: interpolate(focus.value, [0, 1], [1, 1.2]) },
|
|
73
|
+
{ scaleY: interpolate(focus.value, [0, 1], [1, 1.5]) },
|
|
74
|
+
],
|
|
75
|
+
borderColor: interpolateColor(
|
|
76
|
+
focus.value,
|
|
77
|
+
[0, 1],
|
|
78
|
+
[COLORS.FILL.TRANSPARENT, COLORS.BAR.BASE]
|
|
79
|
+
),
|
|
80
|
+
backgroundColor: interpolateColor(
|
|
81
|
+
focus.value,
|
|
82
|
+
[0, 1],
|
|
83
|
+
[COLORS.BAR.SECONDARY, COLORS.BAR.DISABLED]
|
|
84
|
+
),
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
BAR_ITEM_WIDTH,
|
|
91
|
+
activeIndex,
|
|
92
|
+
position,
|
|
93
|
+
focus,
|
|
94
|
+
styles,
|
|
95
|
+
animatedStyles,
|
|
96
|
+
handleWrapperLayout,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { useBarStyles }
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { runCallback } from '@mediacubeco/base/utils'
|
|
2
|
+
import { useCallback, useMemo } from 'react'
|
|
3
|
+
import { View } from 'react-native'
|
|
4
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler'
|
|
5
|
+
import Animated, { withDelay, withTiming } from 'react-native-reanimated'
|
|
6
|
+
import { runOnJS } from 'react-native-worklets'
|
|
7
|
+
// import { Blur } from '../../atoms'
|
|
8
|
+
import { useBarStyles } from './bar.styles'
|
|
9
|
+
import { type BarProps } from './bar.types'
|
|
10
|
+
|
|
11
|
+
// const AnimatedBlur = Animated.createAnimatedComponent(Blur)
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Горизонтальный бар с перетаскиваемым индикатором активного элемента.
|
|
15
|
+
* Элементы рендерятся через компонент renderItem — каждый на собственном
|
|
16
|
+
* fiber, чтобы их хуки не регистрировались на fiber самого бара.
|
|
17
|
+
*/
|
|
18
|
+
const Bar = <Item,>({
|
|
19
|
+
ref,
|
|
20
|
+
style,
|
|
21
|
+
data,
|
|
22
|
+
index,
|
|
23
|
+
initIndex = 0,
|
|
24
|
+
onChange,
|
|
25
|
+
renderItem: RenderItem,
|
|
26
|
+
}: BarProps<Item>) => {
|
|
27
|
+
const itemCount = data.length
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
BAR_ITEM_WIDTH,
|
|
31
|
+
activeIndex,
|
|
32
|
+
position,
|
|
33
|
+
focus,
|
|
34
|
+
styles,
|
|
35
|
+
animatedStyles,
|
|
36
|
+
handleWrapperLayout,
|
|
37
|
+
} = useBarStyles({ index, initIndex, itemCount })
|
|
38
|
+
|
|
39
|
+
const handleChange = useCallback(
|
|
40
|
+
(index: number) => {
|
|
41
|
+
runCallback(onChange, index)
|
|
42
|
+
},
|
|
43
|
+
[onChange]
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const panGesture = useMemo(() => {
|
|
47
|
+
return Gesture.Pan()
|
|
48
|
+
.onBegin((event) => {
|
|
49
|
+
position.set(event.x - BAR_ITEM_WIDTH / 2)
|
|
50
|
+
focus.set(withDelay(50, withTiming(1)))
|
|
51
|
+
activeIndex.set(withTiming((event.x - BAR_ITEM_WIDTH / 2) / BAR_ITEM_WIDTH))
|
|
52
|
+
})
|
|
53
|
+
.onUpdate((event) => {
|
|
54
|
+
activeIndex.set((event.translationX + position.value) / BAR_ITEM_WIDTH)
|
|
55
|
+
})
|
|
56
|
+
.onFinalize((event) => {
|
|
57
|
+
const currentIndex = Math.round((event.translationX + position.value) / BAR_ITEM_WIDTH)
|
|
58
|
+
const index = Math.max(0, Math.min(currentIndex, itemCount - 1))
|
|
59
|
+
|
|
60
|
+
runOnJS(handleChange)(index)
|
|
61
|
+
|
|
62
|
+
focus.set(withDelay(50, withTiming(0)))
|
|
63
|
+
activeIndex.set(withTiming(index))
|
|
64
|
+
})
|
|
65
|
+
}, [BAR_ITEM_WIDTH, itemCount, activeIndex, position, focus, handleChange])
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<GestureDetector gesture={panGesture}>
|
|
69
|
+
<Animated.View
|
|
70
|
+
ref={ref}
|
|
71
|
+
style={[styles.wrapper, animatedStyles.wrapper, style]}
|
|
72
|
+
onLayout={handleWrapperLayout}
|
|
73
|
+
>
|
|
74
|
+
<View style={styles.data}>
|
|
75
|
+
{data.map((item, index) => (
|
|
76
|
+
<View key={index} style={styles.item}>
|
|
77
|
+
{RenderItem && (
|
|
78
|
+
<RenderItem index={index} item={item} data={data} activeIndex={activeIndex} />
|
|
79
|
+
)}
|
|
80
|
+
</View>
|
|
81
|
+
))}
|
|
82
|
+
<Animated.View style={[styles.indicator, animatedStyles.indicator]} />
|
|
83
|
+
</View>
|
|
84
|
+
</Animated.View>
|
|
85
|
+
</GestureDetector>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default Bar
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ComponentType, type Ref } from 'react'
|
|
2
|
+
import { type View, type ViewProps } from 'react-native'
|
|
3
|
+
import { type SharedValue } from 'react-native-reanimated'
|
|
4
|
+
|
|
5
|
+
/** Пропсы элемента бара, передаваемые компоненту renderItem. */
|
|
6
|
+
type BarRenderItemInfo<Item = unknown> = {
|
|
7
|
+
index: number
|
|
8
|
+
item: Item
|
|
9
|
+
data: Item[]
|
|
10
|
+
activeIndex: SharedValue<number>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Компонент элемента бара. Рендерится как JSX-элемент (не вызывается как функция),
|
|
15
|
+
* поэтому обязан быть стабильной ссылкой на компонент — иначе элементы будут
|
|
16
|
+
* перемонтироваться на каждом рендере.
|
|
17
|
+
*/
|
|
18
|
+
type BarRenderItem<Item = unknown> = ComponentType<BarRenderItemInfo<Item>>
|
|
19
|
+
|
|
20
|
+
type BarOnChange = (index: number) => void
|
|
21
|
+
|
|
22
|
+
type BarProps<Item = unknown> = {
|
|
23
|
+
ref?: Ref<View>
|
|
24
|
+
style?: ViewProps['style']
|
|
25
|
+
data: Item[]
|
|
26
|
+
index?: SharedValue<number>
|
|
27
|
+
initIndex?: number
|
|
28
|
+
onChange?: BarOnChange
|
|
29
|
+
renderItem?: BarRenderItem<Item>
|
|
30
|
+
}
|
|
31
|
+
// & (
|
|
32
|
+
// | {
|
|
33
|
+
// index?: never
|
|
34
|
+
// initIndex?: number
|
|
35
|
+
// onChange?: (index: number) => void
|
|
36
|
+
// }
|
|
37
|
+
// | {
|
|
38
|
+
// index?: SharedValue<number>
|
|
39
|
+
// initIndex?: never
|
|
40
|
+
// onChange?: never
|
|
41
|
+
// }
|
|
42
|
+
// )
|
|
43
|
+
|
|
44
|
+
type BarStylesContext = Required<Pick<BarProps, 'initIndex'>> &
|
|
45
|
+
Pick<BarProps, 'index'> & {
|
|
46
|
+
itemCount: number
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type { BarProps, BarRenderItem, BarRenderItemInfo, BarOnChange, BarStylesContext }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tab'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { useThemeMode } from '../../../../../lib'
|
|
3
|
+
|
|
4
|
+
const useTabStyles = () => {
|
|
5
|
+
const { SIZES } = useThemeMode()
|
|
6
|
+
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
tab: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
paddingVertical: SIZES['L'],
|
|
13
|
+
paddingHorizontal: SIZES['2XL'],
|
|
14
|
+
borderRadius: SIZES['INFINITY'],
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
return { styles }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useTabStyles }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { View } from 'react-native'
|
|
2
|
+
import { Text } from '../../../../atoms'
|
|
3
|
+
import { useTabStyles } from './tab.styles'
|
|
4
|
+
import { type TabProps } from './tab.types'
|
|
5
|
+
|
|
6
|
+
const Tab = ({ item }: TabProps) => {
|
|
7
|
+
const { styles } = useTabStyles()
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<View style={styles.tab}>
|
|
11
|
+
<Text type={'outlineSB'} lineCount={1}>
|
|
12
|
+
{item}
|
|
13
|
+
</Text>
|
|
14
|
+
</View>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default Tab
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { useNavigationSafeArea, useNavigationTabs, useThemeMode } from '../../../lib'
|
|
3
|
+
|
|
4
|
+
const useBarTabNavigationStyles = () => {
|
|
5
|
+
const { SIZES } = useThemeMode()
|
|
6
|
+
const { BOTTOM } = useNavigationSafeArea()
|
|
7
|
+
const { handleLayout } = useNavigationTabs()
|
|
8
|
+
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
wrapper: {
|
|
11
|
+
...StyleSheet.absoluteFill,
|
|
12
|
+
top: 'auto',
|
|
13
|
+
paddingTop: SIZES['L'],
|
|
14
|
+
paddingBottom: BOTTOM,
|
|
15
|
+
paddingHorizontal: SIZES['2XL'],
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
return { styles, handleWrapperLayout: handleLayout }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default useBarTabNavigationStyles
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
import { useSharedValue, withTiming } from 'react-native-reanimated'
|
|
4
|
+
import { Bar, type BarOnChange } from '../bar'
|
|
5
|
+
import { TabNavigation } from './components'
|
|
6
|
+
import useBarTabNavigationStyles from './bar-tab-navigation.styles'
|
|
7
|
+
import { type BarTabNavigationProps } from './bar-tab-navigation.types'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Таб-бар навигации поверх компонента Bar. Индикатор анимируется баром при тапе;
|
|
11
|
+
* эффект ресинка догоняет индекс только при внешней навигации (deep link, back),
|
|
12
|
+
* сравнивая state.index с последним целевым индексом, а не с текущим анимируемым
|
|
13
|
+
* значением — иначе каждый собственный тап перезапускал бы анимацию доезда.
|
|
14
|
+
*/
|
|
15
|
+
const BarTabNavigation = ({ state, navigation }: BarTabNavigationProps) => {
|
|
16
|
+
const index = useSharedValue(state.index)
|
|
17
|
+
const targetIndexRef = useRef(state.index)
|
|
18
|
+
const { styles, handleWrapperLayout } = useBarTabNavigationStyles()
|
|
19
|
+
|
|
20
|
+
const handleChange: BarOnChange = useCallback(
|
|
21
|
+
(nextIndex) => {
|
|
22
|
+
const route = state.routes[nextIndex]
|
|
23
|
+
|
|
24
|
+
if (!route) {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const event = navigation.emit({
|
|
29
|
+
type: 'tabPress',
|
|
30
|
+
target: route.key,
|
|
31
|
+
canPreventDefault: true,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
if (event.defaultPrevented) {
|
|
35
|
+
index.set(withTiming(targetIndexRef.current))
|
|
36
|
+
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
targetIndexRef.current = nextIndex
|
|
41
|
+
navigation.navigate(route.name, route.params)
|
|
42
|
+
},
|
|
43
|
+
[index, navigation, state.routes]
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (targetIndexRef.current !== state.index) {
|
|
48
|
+
targetIndexRef.current = state.index
|
|
49
|
+
|
|
50
|
+
index.set(withTiming(state.index))
|
|
51
|
+
}
|
|
52
|
+
}, [index, state.index])
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View style={styles.wrapper} onLayout={handleWrapperLayout}>
|
|
56
|
+
<Bar
|
|
57
|
+
data={state.routes.map((route) => route.name)}
|
|
58
|
+
index={index}
|
|
59
|
+
onChange={handleChange}
|
|
60
|
+
renderItem={TabNavigation}
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default BarTabNavigation
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tab-navigation'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { interpolate, interpolateColor, useAnimatedStyle } from 'react-native-reanimated'
|
|
3
|
+
import { useThemeMode } from '../../../../../lib'
|
|
4
|
+
import { type TabNavigationStylesContext } from './tab-navigation.types'
|
|
5
|
+
|
|
6
|
+
/** Стили элемента таб-бара: кроссфейд контурной/залитой иконки и цвет подписи по активному индексу. */
|
|
7
|
+
const useTabNavigationStyles = ({ data, index, activeIndex }: TabNavigationStylesContext) => {
|
|
8
|
+
const { SIZES, COLORS, TRANSPARENCIES } = useThemeMode()
|
|
9
|
+
|
|
10
|
+
const inputRange = data.map((_, i) => i)
|
|
11
|
+
const colorOutputRange = data.map((_, i) =>
|
|
12
|
+
i === index ? COLORS.TYPOGRAPHY.PRIMARY : COLORS.TYPOGRAPHY.BASE
|
|
13
|
+
)
|
|
14
|
+
const solidOpacityOutputRange = data.map((_, i) =>
|
|
15
|
+
i === index ? TRANSPARENCIES.VISIBLE : TRANSPARENCIES.INVISIBLE
|
|
16
|
+
)
|
|
17
|
+
const baseOpacityOutputRange = data.map((_, i) =>
|
|
18
|
+
i === index ? TRANSPARENCIES.INVISIBLE : TRANSPARENCIES.VISIBLE
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
tab: {
|
|
23
|
+
flexGrow: 1,
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
paddingVertical: SIZES['L'],
|
|
27
|
+
paddingHorizontal: SIZES['2XL'],
|
|
28
|
+
borderRadius: SIZES['INFINITY'],
|
|
29
|
+
},
|
|
30
|
+
iconSolid: {
|
|
31
|
+
...StyleSheet.absoluteFill,
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const animatedStyles = {
|
|
36
|
+
iconBase: useAnimatedStyle(() => {
|
|
37
|
+
return {
|
|
38
|
+
opacity: interpolate(activeIndex.value, inputRange, baseOpacityOutputRange),
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
iconSolid: useAnimatedStyle(() => {
|
|
42
|
+
return {
|
|
43
|
+
opacity: interpolate(activeIndex.value, inputRange, solidOpacityOutputRange),
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
text: useAnimatedStyle(() => {
|
|
47
|
+
return {
|
|
48
|
+
color: interpolateColor(activeIndex.value, inputRange, colorOutputRange),
|
|
49
|
+
}
|
|
50
|
+
}),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return { styles, animatedStyles }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { useTabNavigationStyles }
|
package/src/shared/ui/organisms/bar-tab-navigation/components/tab-navigation/tab-navigation.tsx
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { View } from 'react-native'
|
|
2
|
+
import Animated from 'react-native-reanimated'
|
|
3
|
+
import { Icon, Text } from '../../../../atoms'
|
|
4
|
+
import { useTabNavigationStyles } from './tab-navigation.styles'
|
|
5
|
+
import { type TabNavigationProps } from './tab-navigation.types'
|
|
6
|
+
|
|
7
|
+
const AnimatedText = Animated.createAnimatedComponent(Text)
|
|
8
|
+
|
|
9
|
+
/** Элемент таб-бара: контурная иконка неактивного таба кроссфейдом сменяется залитой на активном. */
|
|
10
|
+
const TabNavigation = ({ item, data, index, activeIndex }: TabNavigationProps) => {
|
|
11
|
+
const { styles, animatedStyles } = useTabNavigationStyles({ data, index, activeIndex })
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.tab}>
|
|
15
|
+
<View>
|
|
16
|
+
<Animated.View style={animatedStyles.iconBase}>
|
|
17
|
+
<Icon name={'default'} variant={'base'} />
|
|
18
|
+
</Animated.View>
|
|
19
|
+
<Animated.View style={[styles.iconSolid, animatedStyles.iconSolid]}>
|
|
20
|
+
<Icon name={'default'} variant={'primary'} />
|
|
21
|
+
</Animated.View>
|
|
22
|
+
</View>
|
|
23
|
+
<AnimatedText style={animatedStyles.text} type={'smallSB'} lineCount={1}>
|
|
24
|
+
{item}
|
|
25
|
+
</AnimatedText>
|
|
26
|
+
</View>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default TabNavigation
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { clamp, interpolate, interpolateColor, useAnimatedStyle } from 'react-native-reanimated'
|
|
3
|
+
import { useThemeMode } from '../../../../../../../lib'
|
|
4
|
+
import { type DotStylesContext } from './dot.types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Визуальная модель точки индикатора: статичная геометрия «пилюли» плюс ширина и цвет,
|
|
8
|
+
* плавно завязанные на прогресс скролла слайдера. Активность точки — близость её слайда
|
|
9
|
+
* к текущему смещению: активная растягивается и подсвечивается, соседние сжимаются и гаснут.
|
|
10
|
+
*/
|
|
11
|
+
const useDotStyles = ({ index, scrollX, itemWidth }: DotStylesContext) => {
|
|
12
|
+
const { SIZES, COLORS } = useThemeMode()
|
|
13
|
+
|
|
14
|
+
const DOT_SIZE = SIZES['L']
|
|
15
|
+
const DOT_ACTIVE_WIDTH = SIZES['4XL']
|
|
16
|
+
|
|
17
|
+
const styles = StyleSheet.create({
|
|
18
|
+
dot: {
|
|
19
|
+
height: DOT_SIZE,
|
|
20
|
+
borderRadius: SIZES['M'],
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
25
|
+
const progress = itemWidth.value > 0 ? scrollX.value / itemWidth.value : 0
|
|
26
|
+
const activeness = clamp(1 - Math.abs(progress - index), 0, 1)
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
width: interpolate(activeness, [0, 1], [DOT_SIZE, DOT_ACTIVE_WIDTH]),
|
|
30
|
+
backgroundColor: interpolateColor(
|
|
31
|
+
activeness,
|
|
32
|
+
[0, 1],
|
|
33
|
+
[COLORS.FILL.CONTRAST_HALF, COLORS.FILL.CONTRAST]
|
|
34
|
+
),
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return { styles, animatedStyle }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { useDotStyles }
|