@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,137 @@
|
|
|
1
|
+
import { runCallback } from '@mediacubeco/base/utils'
|
|
2
|
+
import { useCallback, useRef } from 'react'
|
|
3
|
+
import { type GestureResponderEvent, Pressable } from 'react-native'
|
|
4
|
+
import Animated from 'react-native-reanimated'
|
|
5
|
+
import {
|
|
6
|
+
Haptics,
|
|
7
|
+
type HapticsRef,
|
|
8
|
+
Ripple,
|
|
9
|
+
type RippleRef,
|
|
10
|
+
Spring,
|
|
11
|
+
type SpringRef,
|
|
12
|
+
} from './components'
|
|
13
|
+
import { useTouchStyles } from './touch.styles'
|
|
14
|
+
import { type TouchProps } from './touch.types'
|
|
15
|
+
|
|
16
|
+
const Touch = ({
|
|
17
|
+
ref,
|
|
18
|
+
style,
|
|
19
|
+
children,
|
|
20
|
+
isDisabled = false,
|
|
21
|
+
withHaptics = false,
|
|
22
|
+
withSpring = false,
|
|
23
|
+
withRipple = false,
|
|
24
|
+
onPress,
|
|
25
|
+
onPressIn,
|
|
26
|
+
onPressOut,
|
|
27
|
+
onLongPress,
|
|
28
|
+
}: TouchProps) => {
|
|
29
|
+
const rippleRef = useRef<RippleRef>(null)
|
|
30
|
+
const springRef = useRef<SpringRef>(null)
|
|
31
|
+
const hapticsRef = useRef<HapticsRef>(null)
|
|
32
|
+
const { styles } = useTouchStyles()
|
|
33
|
+
|
|
34
|
+
const handlePress = useCallback(
|
|
35
|
+
(event: GestureResponderEvent) => {
|
|
36
|
+
if (withHaptics) {
|
|
37
|
+
hapticsRef.current?.hapticsIn(event)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
runCallback(onPress, event)
|
|
41
|
+
},
|
|
42
|
+
[withHaptics, onPress]
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const handlePressIn = useCallback(
|
|
46
|
+
(event: GestureResponderEvent) => {
|
|
47
|
+
if (withSpring) {
|
|
48
|
+
springRef.current?.springIn(event)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (withRipple) {
|
|
52
|
+
rippleRef.current?.rippleIn(event)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
runCallback(onPressIn, event)
|
|
56
|
+
},
|
|
57
|
+
[withSpring, withRipple, onPressIn]
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
const handlePressOut = useCallback(
|
|
61
|
+
(event: GestureResponderEvent) => {
|
|
62
|
+
if (withSpring) {
|
|
63
|
+
springRef.current?.springOut(event)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (withRipple) {
|
|
67
|
+
rippleRef.current?.rippleOut(event)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
runCallback(onPressOut, event)
|
|
71
|
+
},
|
|
72
|
+
[withSpring, withRipple, onPressOut]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
const handleLongPress = useCallback(
|
|
76
|
+
(event: GestureResponderEvent) => {
|
|
77
|
+
hapticsRef.current?.hapticsIn(event)
|
|
78
|
+
|
|
79
|
+
runCallback(onLongPress, event)
|
|
80
|
+
},
|
|
81
|
+
[onLongPress]
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
const renderWrapper = useCallback(
|
|
85
|
+
(children: TouchProps['children'], wrapperStyle?: TouchProps['style']) => {
|
|
86
|
+
return <Animated.View style={[styles.touch, style, wrapperStyle]}>{children}</Animated.View>
|
|
87
|
+
},
|
|
88
|
+
[styles.touch, style]
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
const renderPress = useCallback(() => {
|
|
92
|
+
return (
|
|
93
|
+
<Pressable
|
|
94
|
+
ref={ref}
|
|
95
|
+
style={styles.press}
|
|
96
|
+
disabled={isDisabled}
|
|
97
|
+
onPress={handlePress}
|
|
98
|
+
onPressIn={handlePressIn}
|
|
99
|
+
onPressOut={handlePressOut}
|
|
100
|
+
onLongPress={handleLongPress}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}, [styles.press, ref, isDisabled, handlePress, handlePressIn, handlePressOut, handleLongPress])
|
|
104
|
+
|
|
105
|
+
if (withHaptics) {
|
|
106
|
+
return (
|
|
107
|
+
<Haptics ref={hapticsRef} renderWrapper={renderWrapper} renderPress={renderPress}>
|
|
108
|
+
{children}
|
|
109
|
+
</Haptics>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (withSpring) {
|
|
114
|
+
return (
|
|
115
|
+
<Spring ref={springRef} renderWrapper={renderWrapper} renderPress={renderPress}>
|
|
116
|
+
{children}
|
|
117
|
+
</Spring>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (withRipple) {
|
|
122
|
+
return (
|
|
123
|
+
<Ripple ref={rippleRef} renderWrapper={renderWrapper} renderPress={renderPress}>
|
|
124
|
+
{children}
|
|
125
|
+
</Ripple>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return renderWrapper(
|
|
130
|
+
<>
|
|
131
|
+
{children}
|
|
132
|
+
{renderPress()}
|
|
133
|
+
</>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export default Touch
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Ref } from 'react'
|
|
2
|
+
import { type PressableProps, type View, type ViewProps } from 'react-native'
|
|
3
|
+
|
|
4
|
+
type TouchProps = Pick<PressableProps, 'onPress' | 'onPressIn' | 'onPressOut' | 'onLongPress'> & {
|
|
5
|
+
ref?: Ref<View>
|
|
6
|
+
style?: ViewProps['style'] // StyleProp<AnimatedStyle<ViewStyle>>
|
|
7
|
+
children?: ViewProps['children']
|
|
8
|
+
isDisabled?: boolean
|
|
9
|
+
} & (
|
|
10
|
+
| {
|
|
11
|
+
withHaptics?: boolean
|
|
12
|
+
withSpring?: never
|
|
13
|
+
withRipple?: never
|
|
14
|
+
}
|
|
15
|
+
| {
|
|
16
|
+
withHaptics?: never
|
|
17
|
+
withSpring?: boolean
|
|
18
|
+
withRipple?: never
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
withHaptics?: never
|
|
22
|
+
withSpring?: never
|
|
23
|
+
withRipple?: boolean
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
export type { TouchProps }
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { DEFAULT_LAYOUT, useLayout } from '@mediacubeco/base-react-native/hooks'
|
|
2
|
+
import { useCallback } from 'react'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import { interpolate, useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated'
|
|
5
|
+
import { useComposeSharedValue } from '../../../hooks'
|
|
6
|
+
import { useThemeMode } from '../../../lib'
|
|
7
|
+
import { type VisibilityStylesContext } from './visibility.types'
|
|
8
|
+
|
|
9
|
+
const useVisibilityStyles = ({
|
|
10
|
+
visibility: initVisibility,
|
|
11
|
+
isVisible,
|
|
12
|
+
}: VisibilityStylesContext) => {
|
|
13
|
+
const { ANIMATIONS } = useThemeMode()
|
|
14
|
+
const visibility = useComposeSharedValue(initVisibility, isVisible ? 1 : 0)
|
|
15
|
+
const wrapperLayout = useSharedValue(DEFAULT_LAYOUT)
|
|
16
|
+
const handleWrapperShadowLayout = useLayout({ setLayout: wrapperLayout.set })
|
|
17
|
+
|
|
18
|
+
const handleShow = useCallback(() => {
|
|
19
|
+
visibility.set(withSpring(1, ANIMATIONS.SPRING.BASE))
|
|
20
|
+
}, [visibility, ANIMATIONS.SPRING.BASE])
|
|
21
|
+
|
|
22
|
+
const handleHide = useCallback(() => {
|
|
23
|
+
visibility.set(withSpring(0, ANIMATIONS.SPRING.BASE))
|
|
24
|
+
}, [visibility, ANIMATIONS.SPRING.BASE])
|
|
25
|
+
|
|
26
|
+
const handleToggle = useCallback(() => {
|
|
27
|
+
if (visibility.value) {
|
|
28
|
+
handleHide()
|
|
29
|
+
} else {
|
|
30
|
+
handleShow()
|
|
31
|
+
}
|
|
32
|
+
}, [visibility, handleHide, handleShow])
|
|
33
|
+
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
wrapper: {
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
},
|
|
38
|
+
wrapperShadow: {
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
pointerEvents: 'none',
|
|
41
|
+
opacity: 0,
|
|
42
|
+
},
|
|
43
|
+
content: {
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
left: 0,
|
|
46
|
+
right: 0,
|
|
47
|
+
top: 0,
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const animatedStyles = {
|
|
52
|
+
wrapper: {},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const animatedStylesByVariant = {
|
|
56
|
+
base: useAnimatedStyle(() => {
|
|
57
|
+
return {
|
|
58
|
+
height: interpolate(visibility.value, [0, 1], [0, wrapperLayout.value.height]),
|
|
59
|
+
opacity: interpolate(
|
|
60
|
+
visibility.value,
|
|
61
|
+
[0, 0.2, 0.4, 0.6, 0.8, 1],
|
|
62
|
+
[0, 0, 0.5, 0.5, 0.5, 1, 1]
|
|
63
|
+
),
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
simple: useAnimatedStyle(() => {
|
|
67
|
+
return {
|
|
68
|
+
height: wrapperLayout.value.height,
|
|
69
|
+
opacity: interpolate(visibility.value, [0, 1], [0, 1]),
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
styles,
|
|
76
|
+
animatedStyles,
|
|
77
|
+
animatedStylesByVariant,
|
|
78
|
+
handleWrapperShadowLayout,
|
|
79
|
+
handleShow,
|
|
80
|
+
handleHide,
|
|
81
|
+
handleToggle,
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { useVisibilityStyles }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useEffect, useImperativeHandle } from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
import Animated from 'react-native-reanimated'
|
|
4
|
+
import { useVisibilityStyles } from './visibility.styles'
|
|
5
|
+
import { type VisibilityProps } from './visibility.types'
|
|
6
|
+
|
|
7
|
+
/** Обёртка, плавно показывающая и скрывающая children через scale + opacity. */
|
|
8
|
+
const Visibility = ({
|
|
9
|
+
ref,
|
|
10
|
+
shadowRef,
|
|
11
|
+
style,
|
|
12
|
+
children,
|
|
13
|
+
visibility,
|
|
14
|
+
variant = 'base',
|
|
15
|
+
isVisible = false,
|
|
16
|
+
}: VisibilityProps) => {
|
|
17
|
+
const {
|
|
18
|
+
styles,
|
|
19
|
+
animatedStyles,
|
|
20
|
+
animatedStylesByVariant,
|
|
21
|
+
handleWrapperShadowLayout,
|
|
22
|
+
handleShow,
|
|
23
|
+
handleHide,
|
|
24
|
+
handleToggle,
|
|
25
|
+
} = useVisibilityStyles({ visibility, isVisible })
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (isVisible) {
|
|
29
|
+
handleShow()
|
|
30
|
+
} else {
|
|
31
|
+
handleHide()
|
|
32
|
+
}
|
|
33
|
+
}, [isVisible, handleShow, handleHide])
|
|
34
|
+
|
|
35
|
+
useImperativeHandle(ref, () => {
|
|
36
|
+
return {
|
|
37
|
+
show: handleShow,
|
|
38
|
+
hide: handleHide,
|
|
39
|
+
toggle: handleToggle,
|
|
40
|
+
}
|
|
41
|
+
}, [handleShow, handleHide, handleToggle])
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<Animated.View
|
|
46
|
+
style={[styles.wrapper, animatedStyles.wrapper, animatedStylesByVariant[variant], style]}
|
|
47
|
+
>
|
|
48
|
+
<View style={styles.content}>{children}</View>
|
|
49
|
+
</Animated.View>
|
|
50
|
+
<View
|
|
51
|
+
ref={shadowRef}
|
|
52
|
+
style={[styles.wrapperShadow, style]}
|
|
53
|
+
onLayout={handleWrapperShadowLayout}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</View>
|
|
57
|
+
</>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default Visibility
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Noop } from '@mediacubeco/base/types'
|
|
2
|
+
import { type ReactNode, type Ref } from 'react'
|
|
3
|
+
import { type View, type ViewProps } from 'react-native'
|
|
4
|
+
import { type SharedValue } from 'react-native-reanimated'
|
|
5
|
+
|
|
6
|
+
type VisibilityRef = {
|
|
7
|
+
show: Noop
|
|
8
|
+
hide: Noop
|
|
9
|
+
toggle: Noop
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Пропсы Visibility: управляют показом и скрытием обёрнутого содержимого. */
|
|
13
|
+
type VisibilityProps = {
|
|
14
|
+
ref?: Ref<VisibilityRef>
|
|
15
|
+
shadowRef?: Ref<View>
|
|
16
|
+
style?: ViewProps['style']
|
|
17
|
+
children?: ReactNode
|
|
18
|
+
variant?: 'base' | 'simple'
|
|
19
|
+
} & (
|
|
20
|
+
| {
|
|
21
|
+
visibility?: SharedValue<number>
|
|
22
|
+
isVisible?: never
|
|
23
|
+
}
|
|
24
|
+
| {
|
|
25
|
+
visibility?: never
|
|
26
|
+
isVisible?: boolean
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
/** Контекст стилей Visibility, выводится из управляющего флага видимости. */
|
|
31
|
+
type VisibilityStylesContext = Required<Pick<VisibilityProps, 'isVisible'>> &
|
|
32
|
+
Pick<VisibilityProps, 'visibility'> & {}
|
|
33
|
+
|
|
34
|
+
export type { VisibilityRef, VisibilityProps, VisibilityStylesContext }
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { useAnimatedKeyboard } from 'react-native-keyboard-controller'
|
|
2
|
-
import {
|
|
2
|
+
import { useAnimatedStyle } from 'react-native-reanimated'
|
|
3
|
+
import { useNavigationSafeArea } from '../../../lib'
|
|
3
4
|
|
|
4
5
|
const useKeyboardAreaStyles = () => {
|
|
5
|
-
const { FOOTER } = useSafeArea()
|
|
6
6
|
const { height } = useAnimatedKeyboard()
|
|
7
|
-
const
|
|
7
|
+
const { BOTTOM } = useNavigationSafeArea()
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const animatedStyles = {
|
|
10
|
+
keyboard: useAnimatedStyle(() => {
|
|
11
|
+
return {
|
|
12
|
+
height: height.value - BOTTOM,
|
|
13
|
+
}
|
|
14
|
+
}, [BOTTOM]),
|
|
15
|
+
}
|
|
14
16
|
|
|
15
17
|
return {
|
|
16
|
-
|
|
18
|
+
animatedStyles,
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { animate } from '../../../hooks'
|
|
1
|
+
import Animated from 'react-native-reanimated'
|
|
3
2
|
import { useKeyboardAreaStyles } from './keyboard-area.styles'
|
|
4
3
|
import { type KeyboardAreaProps } from './keyboard-area.types'
|
|
5
4
|
|
|
6
|
-
const KeyboardAnimatedArea = animate(View)
|
|
7
|
-
|
|
8
5
|
const KeyboardArea = ({}: KeyboardAreaProps) => {
|
|
9
|
-
const {
|
|
6
|
+
const { animatedStyles } = useKeyboardAreaStyles()
|
|
10
7
|
|
|
11
|
-
return <
|
|
8
|
+
return <Animated.View style={animatedStyles.keyboard} />
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
export default KeyboardArea
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { runCallback } from '@mediacubeco/base/utils'
|
|
2
2
|
import { useCallback, useState } from 'react'
|
|
3
3
|
import { RefreshControl as NativeRefreshControl } from 'react-native'
|
|
4
|
-
import { useSafeArea } from '../../../hooks'
|
|
5
4
|
import { useThemeMode } from '../../../lib'
|
|
6
5
|
import { type RefreshControlProps } from './refresh-control.types'
|
|
7
6
|
|
|
8
|
-
const RefreshControl = ({
|
|
7
|
+
const RefreshControl = ({ offset, onRefresh, ...props }: RefreshControlProps) => {
|
|
9
8
|
const [isRefreshing, setIsRefreshing] = useState(false)
|
|
10
|
-
const { TOP } = useSafeArea()
|
|
11
9
|
const { COLORS } = useThemeMode()
|
|
12
10
|
|
|
13
11
|
const handleRefresh = useCallback(async () => {
|
|
@@ -20,10 +18,10 @@ const RefreshControl = ({ withOffset = true, onRefresh, ...props }: RefreshContr
|
|
|
20
18
|
|
|
21
19
|
return (
|
|
22
20
|
<NativeRefreshControl
|
|
21
|
+
tintColor={COLORS.TYPOGRAPHY.PRIMARY}
|
|
22
|
+
progressViewOffset={offset}
|
|
23
23
|
refreshing={isRefreshing}
|
|
24
24
|
onRefresh={handleRefresh}
|
|
25
|
-
progressViewOffset={withOffset ? TOP : 0}
|
|
26
|
-
tintColor={COLORS.TYPOGRAPHY.PRIMARY}
|
|
27
25
|
{...props}
|
|
28
26
|
/>
|
|
29
27
|
)
|
|
@@ -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 }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Animated from 'react-native-reanimated'
|
|
2
|
+
import { useDotStyles } from './dot.styles'
|
|
3
|
+
import { type DotProps } from './dot.types'
|
|
4
|
+
|
|
5
|
+
/** Одна точка индикатора-«пилюли»: расширяется и подсвечивается по мере приближения своего слайда. */
|
|
6
|
+
const Dot = ({ index, scrollX, itemWidth }: DotProps) => {
|
|
7
|
+
const { styles, animatedStyle } = useDotStyles({ index, scrollX, itemWidth })
|
|
8
|
+
|
|
9
|
+
return <Animated.View style={[styles.dot, animatedStyle]} />
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default Dot
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SharedValue } from 'react-native-reanimated'
|
|
2
|
+
|
|
3
|
+
/** Пропсы одной точки индикатора: её позиция в ряду и общий прогресс скролла слайдера. */
|
|
4
|
+
type DotProps = {
|
|
5
|
+
index: number
|
|
6
|
+
scrollX: SharedValue<number>
|
|
7
|
+
itemWidth: SharedValue<number>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Контекст стиль-хука точки — совпадает с её пропсами. */
|
|
11
|
+
type DotStylesContext = DotProps
|
|
12
|
+
|
|
13
|
+
export type { DotProps, DotStylesContext }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { useThemeMode } from '../../../../../lib'
|
|
3
|
+
|
|
4
|
+
/** Визуальная модель индикатора: горизонтальный ряд точек по центру с равными промежутками. */
|
|
5
|
+
const useIndicatorStyles = () => {
|
|
6
|
+
const { SIZES } = useThemeMode()
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
wrapper: {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
gap: SIZES['M'],
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
return { styles }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { useIndicatorStyles }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
import { Dot } from './components/dot'
|
|
4
|
+
import { useIndicatorStyles } from './indicator.styles'
|
|
5
|
+
import { type IndicatorProps } from './indicator.types'
|
|
6
|
+
|
|
7
|
+
/** Индикатор текущего слайда: ряд точек, где активная плавно расширяется в «пилюлю» вслед за скроллом. */
|
|
8
|
+
const Indicator = ({ itemCount, scrollX, itemWidth }: IndicatorProps) => {
|
|
9
|
+
const { styles } = useIndicatorStyles()
|
|
10
|
+
|
|
11
|
+
const dotList = useMemo(() => Array.from({ length: itemCount }, (_, index) => index), [itemCount])
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.wrapper}>
|
|
15
|
+
{dotList.map((index) => (
|
|
16
|
+
<Dot key={index} index={index} scrollX={scrollX} itemWidth={itemWidth} />
|
|
17
|
+
))}
|
|
18
|
+
</View>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Indicator
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SharedValue } from 'react-native-reanimated'
|
|
2
|
+
|
|
3
|
+
/** Пропсы индикатора слайдов: число точек и общий прогресс скролла слайдера с шириной слайда. */
|
|
4
|
+
type IndicatorProps = {
|
|
5
|
+
itemCount: number
|
|
6
|
+
scrollX: SharedValue<number>
|
|
7
|
+
itemWidth: SharedValue<number>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type { IndicatorProps }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DEFAULT_LAYOUT, useLayout } from '@mediacubeco/base-react-native/hooks'
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import { useNavigationDimensions } from '../../../lib'
|
|
5
|
+
import { type SliderStylesContext } from './slider.types'
|
|
6
|
+
|
|
7
|
+
const useSliderStyles = ({
|
|
8
|
+
itemCount,
|
|
9
|
+
itemWidth,
|
|
10
|
+
itemGap,
|
|
11
|
+
sliderItemWidth,
|
|
12
|
+
sliderItemGap,
|
|
13
|
+
}: SliderStylesContext) => {
|
|
14
|
+
const [wrapperLayout, setLayout] = useState(DEFAULT_LAYOUT)
|
|
15
|
+
const { WIDTH } = useNavigationDimensions()
|
|
16
|
+
const handleWrapperLayout = useLayout({ setLayout })
|
|
17
|
+
|
|
18
|
+
const SLIDER_ITEM_WIDTH = itemWidth ?? wrapperLayout.width
|
|
19
|
+
const SLIDER_ITEM_GAP = itemGap ?? (WIDTH - SLIDER_ITEM_WIDTH) / 2
|
|
20
|
+
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
wrapper: {},
|
|
23
|
+
content: {
|
|
24
|
+
overflow: 'visible',
|
|
25
|
+
},
|
|
26
|
+
container: {
|
|
27
|
+
gap: SLIDER_ITEM_GAP,
|
|
28
|
+
},
|
|
29
|
+
item: {
|
|
30
|
+
width: SLIDER_ITEM_WIDTH,
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const snapToOffsets = useMemo(() => {
|
|
35
|
+
return Array.from(
|
|
36
|
+
{ length: itemCount },
|
|
37
|
+
(_, index) => index * (SLIDER_ITEM_WIDTH + SLIDER_ITEM_GAP)
|
|
38
|
+
)
|
|
39
|
+
}, [itemCount, SLIDER_ITEM_WIDTH, SLIDER_ITEM_GAP])
|
|
40
|
+
|
|
41
|
+
const getItemLayout = useCallback(
|
|
42
|
+
(_: unknown, index: number) => ({
|
|
43
|
+
length: SLIDER_ITEM_WIDTH,
|
|
44
|
+
offset: (SLIDER_ITEM_WIDTH + SLIDER_ITEM_GAP) * index,
|
|
45
|
+
index,
|
|
46
|
+
}),
|
|
47
|
+
[SLIDER_ITEM_WIDTH, SLIDER_ITEM_GAP]
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (sliderItemWidth) {
|
|
52
|
+
sliderItemWidth.set(SLIDER_ITEM_WIDTH)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (sliderItemGap) {
|
|
56
|
+
sliderItemGap.set(SLIDER_ITEM_GAP)
|
|
57
|
+
}
|
|
58
|
+
}, [sliderItemWidth, sliderItemGap, SLIDER_ITEM_WIDTH, SLIDER_ITEM_GAP])
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
styles,
|
|
62
|
+
snapToOffsets,
|
|
63
|
+
getItemLayout,
|
|
64
|
+
handleWrapperLayout,
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { useSliderStyles }
|