@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,186 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { useThemeMode } from '../../../lib'
|
|
3
|
+
|
|
4
|
+
/** Стили атома Text: цвет по variant, типографика (семейство/размер) по type, выравнивание по align. */
|
|
5
|
+
const useTextStyles = () => {
|
|
6
|
+
const { SIZES, FONTS, COLORS } = useThemeMode()
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
text: {},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const stylesByVariant = StyleSheet.create({
|
|
13
|
+
base: {
|
|
14
|
+
color: COLORS.TYPOGRAPHY.BASE,
|
|
15
|
+
},
|
|
16
|
+
secondary: {
|
|
17
|
+
color: COLORS.TYPOGRAPHY.SECONDARY,
|
|
18
|
+
},
|
|
19
|
+
disabled: {
|
|
20
|
+
color: COLORS.TYPOGRAPHY.DISABLED,
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
transparent: {
|
|
24
|
+
color: COLORS.TYPOGRAPHY.TRANSPARENT,
|
|
25
|
+
},
|
|
26
|
+
matter: {
|
|
27
|
+
color: COLORS.TYPOGRAPHY.MATTER,
|
|
28
|
+
},
|
|
29
|
+
contrast: {
|
|
30
|
+
color: COLORS.TYPOGRAPHY.CONTRAST,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
primary: {
|
|
34
|
+
color: COLORS.TYPOGRAPHY.PRIMARY,
|
|
35
|
+
},
|
|
36
|
+
info: {
|
|
37
|
+
color: COLORS.TYPOGRAPHY.INFO,
|
|
38
|
+
},
|
|
39
|
+
success: {
|
|
40
|
+
color: COLORS.TYPOGRAPHY.SUCCESS,
|
|
41
|
+
},
|
|
42
|
+
warning: {
|
|
43
|
+
color: COLORS.TYPOGRAPHY.WARNING,
|
|
44
|
+
},
|
|
45
|
+
danger: {
|
|
46
|
+
color: COLORS.TYPOGRAPHY.DANGER,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
neutral: {
|
|
50
|
+
color: COLORS.TYPOGRAPHY.NEUTRAL,
|
|
51
|
+
},
|
|
52
|
+
outline: {
|
|
53
|
+
color: COLORS.TYPOGRAPHY.OUTLINE,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const stylesByType = StyleSheet.create({
|
|
58
|
+
bigTitle: {
|
|
59
|
+
fontFamily: FONTS.BASE_BOLD,
|
|
60
|
+
fontSize: SIZES['14XL'],
|
|
61
|
+
lineHeight: SIZES['14XL'] * 1.2,
|
|
62
|
+
letterSpacing: -SIZES['XS'],
|
|
63
|
+
},
|
|
64
|
+
/* big-header */
|
|
65
|
+
bigHeader: {
|
|
66
|
+
fontFamily: FONTS.BASE_BOLD,
|
|
67
|
+
fontSize: SIZES['7XL'],
|
|
68
|
+
lineHeight: SIZES['7XL'] * 1.2,
|
|
69
|
+
letterSpacing: -SIZES['2XS'],
|
|
70
|
+
},
|
|
71
|
+
/* h1 */
|
|
72
|
+
h1: {
|
|
73
|
+
fontFamily: FONTS.BASE_BOLD,
|
|
74
|
+
fontSize: SIZES['5XL'],
|
|
75
|
+
lineHeight: SIZES['5XL'] * 1.2,
|
|
76
|
+
letterSpacing: -SIZES['2XS'],
|
|
77
|
+
},
|
|
78
|
+
/* h2 */
|
|
79
|
+
h2: {
|
|
80
|
+
fontFamily: FONTS.BASE_BOLD,
|
|
81
|
+
fontSize: SIZES['3XL'],
|
|
82
|
+
lineHeight: SIZES['3XL'] * 1.2,
|
|
83
|
+
letterSpacing: -SIZES['3XS'],
|
|
84
|
+
},
|
|
85
|
+
/* h3 */
|
|
86
|
+
h3: {
|
|
87
|
+
fontFamily: FONTS.BASE_BOLD,
|
|
88
|
+
fontSize: SIZES['2XL'],
|
|
89
|
+
lineHeight: SIZES['2XL'] * 1.2,
|
|
90
|
+
letterSpacing: -SIZES['3XS'],
|
|
91
|
+
},
|
|
92
|
+
/* subtitle */
|
|
93
|
+
subtitle: {
|
|
94
|
+
fontFamily: FONTS.BASE_BOLD,
|
|
95
|
+
fontSize: SIZES['2XL'],
|
|
96
|
+
lineHeight: SIZES['2XL'] * 1.2,
|
|
97
|
+
letterSpacing: -SIZES['3XS'],
|
|
98
|
+
},
|
|
99
|
+
/* button */
|
|
100
|
+
button: {
|
|
101
|
+
fontFamily: FONTS.BASE_SEMIBOLD,
|
|
102
|
+
fontSize: SIZES['2XL'],
|
|
103
|
+
lineHeight: SIZES['2XL'] * 1.2,
|
|
104
|
+
letterSpacing: -SIZES['3XS'],
|
|
105
|
+
},
|
|
106
|
+
/* button-small */
|
|
107
|
+
buttonSmall: {
|
|
108
|
+
fontFamily: FONTS.BASE_SEMIBOLD,
|
|
109
|
+
fontSize: SIZES['XL-2XL'],
|
|
110
|
+
lineHeight: SIZES['XL-2XL'] * 1.2,
|
|
111
|
+
letterSpacing: -SIZES['3XS'],
|
|
112
|
+
},
|
|
113
|
+
/* body */
|
|
114
|
+
body: {
|
|
115
|
+
fontFamily: FONTS.BASE_REGULAR,
|
|
116
|
+
fontSize: SIZES['2XL'],
|
|
117
|
+
lineHeight: SIZES['2XL'] * 1.2,
|
|
118
|
+
letterSpacing: -SIZES['3XS'],
|
|
119
|
+
},
|
|
120
|
+
/* outline */
|
|
121
|
+
outline: {
|
|
122
|
+
fontFamily: FONTS.BASE_REGULAR,
|
|
123
|
+
fontSize: SIZES['XL-2XL'],
|
|
124
|
+
lineHeight: SIZES['XL-2XL'] * 1.2,
|
|
125
|
+
letterSpacing: -SIZES['3XS'],
|
|
126
|
+
},
|
|
127
|
+
/* description */
|
|
128
|
+
description: {
|
|
129
|
+
fontFamily: FONTS.BASE_REGULAR,
|
|
130
|
+
fontSize: SIZES['XL'],
|
|
131
|
+
lineHeight: SIZES['XL'] * 1.2,
|
|
132
|
+
letterSpacing: -SIZES['3XS'],
|
|
133
|
+
},
|
|
134
|
+
/* small */
|
|
135
|
+
small: {
|
|
136
|
+
fontFamily: FONTS.BASE_REGULAR,
|
|
137
|
+
fontSize: SIZES['L-XL'],
|
|
138
|
+
lineHeight: SIZES['L-XL'] * 1.2,
|
|
139
|
+
letterSpacing: -SIZES['4XS'],
|
|
140
|
+
},
|
|
141
|
+
/* body-sb */
|
|
142
|
+
bodySB: {
|
|
143
|
+
fontFamily: FONTS.BASE_SEMIBOLD,
|
|
144
|
+
fontSize: SIZES['2XL'],
|
|
145
|
+
lineHeight: SIZES['2XL'] * 1.2,
|
|
146
|
+
letterSpacing: -SIZES['3XS'],
|
|
147
|
+
},
|
|
148
|
+
/* outline-sb */
|
|
149
|
+
outlineSB: {
|
|
150
|
+
fontFamily: FONTS.BASE_SEMIBOLD,
|
|
151
|
+
fontSize: SIZES['XL-2XL'],
|
|
152
|
+
lineHeight: SIZES['XL-2XL'] * 1.2,
|
|
153
|
+
letterSpacing: -SIZES['3XS'],
|
|
154
|
+
},
|
|
155
|
+
/* description-sb */
|
|
156
|
+
descriptionSB: {
|
|
157
|
+
fontFamily: FONTS.BASE_SEMIBOLD,
|
|
158
|
+
fontSize: SIZES['XL'],
|
|
159
|
+
lineHeight: SIZES['XL'] * 1.2,
|
|
160
|
+
letterSpacing: -SIZES['3XS'],
|
|
161
|
+
},
|
|
162
|
+
/* small-sb */
|
|
163
|
+
smallSB: {
|
|
164
|
+
fontFamily: FONTS.BASE_SEMIBOLD,
|
|
165
|
+
fontSize: SIZES['L-XL'],
|
|
166
|
+
lineHeight: SIZES['L-XL'] * 1.2,
|
|
167
|
+
letterSpacing: -SIZES['4XS'],
|
|
168
|
+
},
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
const stylesByAlign = StyleSheet.create({
|
|
172
|
+
start: {
|
|
173
|
+
textAlign: 'left',
|
|
174
|
+
},
|
|
175
|
+
center: {
|
|
176
|
+
textAlign: 'center',
|
|
177
|
+
},
|
|
178
|
+
end: {
|
|
179
|
+
textAlign: 'right',
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
return { styles, stylesByVariant, stylesByType, stylesByAlign }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export { useTextStyles }
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Text as NativeText } from 'react-native'
|
|
2
|
+
import { useTextStyles } from './text.styles'
|
|
3
|
+
import { type TextProps } from './text.types'
|
|
4
|
+
|
|
5
|
+
const Text = ({
|
|
6
|
+
ref,
|
|
7
|
+
style,
|
|
8
|
+
children,
|
|
9
|
+
type = 'body',
|
|
10
|
+
variant = 'base',
|
|
11
|
+
align = 'start',
|
|
12
|
+
lineCount,
|
|
13
|
+
shouldFit,
|
|
14
|
+
onPress,
|
|
15
|
+
}: TextProps) => {
|
|
16
|
+
const { styles, stylesByVariant, stylesByType, stylesByAlign } = useTextStyles()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<NativeText
|
|
20
|
+
ref={ref}
|
|
21
|
+
style={[
|
|
22
|
+
styles.text,
|
|
23
|
+
stylesByVariant[variant],
|
|
24
|
+
stylesByType[type],
|
|
25
|
+
stylesByAlign[align],
|
|
26
|
+
style,
|
|
27
|
+
]}
|
|
28
|
+
numberOfLines={lineCount}
|
|
29
|
+
adjustsFontSizeToFit={shouldFit}
|
|
30
|
+
onPress={onPress}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</NativeText>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Text
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type KeyOf } from '@mediacubeco/base/types'
|
|
2
|
+
import { type Ref } from 'react'
|
|
3
|
+
import { type Text as NativeText, type TextProps as NativeTextProps } from 'react-native'
|
|
4
|
+
import { type COLOR_BY_VARIANT } from '../../../lib'
|
|
5
|
+
|
|
6
|
+
type TextProps = {
|
|
7
|
+
ref?: Ref<NativeText>
|
|
8
|
+
style?: NativeTextProps['style']
|
|
9
|
+
children?: NativeTextProps['children']
|
|
10
|
+
/* TODO: maybe rename to size: SizeRange */
|
|
11
|
+
type?:
|
|
12
|
+
| 'bigTitle'
|
|
13
|
+
| 'bigHeader'
|
|
14
|
+
| 'h1'
|
|
15
|
+
| 'h2'
|
|
16
|
+
| 'h3'
|
|
17
|
+
| 'subtitle'
|
|
18
|
+
| 'button'
|
|
19
|
+
| 'buttonSmall'
|
|
20
|
+
| 'body'
|
|
21
|
+
| 'outline'
|
|
22
|
+
| 'description'
|
|
23
|
+
| 'small'
|
|
24
|
+
| 'bodySB'
|
|
25
|
+
| 'outlineSB'
|
|
26
|
+
| 'descriptionSB'
|
|
27
|
+
| 'smallSB'
|
|
28
|
+
variant?: KeyOf<typeof COLOR_BY_VARIANT>
|
|
29
|
+
align?: 'start' | 'center' | 'end'
|
|
30
|
+
lineCount?: NativeTextProps['numberOfLines']
|
|
31
|
+
shouldFit?: NativeTextProps['adjustsFontSizeToFit']
|
|
32
|
+
onPress?: NativeTextProps['onPress']
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type { TextProps }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import { StyleSheet } from 'react-native'
|
|
3
|
+
import * as Haptics from 'expo-haptics'
|
|
4
|
+
|
|
5
|
+
const useHapticsStyles = () => {
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
haptics: {},
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const handleHapticsIn = useCallback(() => {
|
|
11
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)
|
|
12
|
+
}, [])
|
|
13
|
+
|
|
14
|
+
const handleHapticsOut = useCallback(() => {
|
|
15
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light)
|
|
16
|
+
}, [])
|
|
17
|
+
|
|
18
|
+
return { styles, handleHapticsIn, handleHapticsOut }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useHapticsStyles }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useImperativeHandle } from 'react'
|
|
2
|
+
import { useHapticsStyles } from './haptics.styles'
|
|
3
|
+
import { type HapticsProps } from './haptics.types'
|
|
4
|
+
|
|
5
|
+
const Haptics = ({ ref, children, renderWrapper, renderPress }: HapticsProps) => {
|
|
6
|
+
const { styles, handleHapticsIn, handleHapticsOut } = useHapticsStyles()
|
|
7
|
+
|
|
8
|
+
useImperativeHandle(ref, () => {
|
|
9
|
+
return {
|
|
10
|
+
hapticsIn: handleHapticsIn,
|
|
11
|
+
hapticsOut: handleHapticsOut,
|
|
12
|
+
}
|
|
13
|
+
}, [handleHapticsIn, handleHapticsOut])
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
{renderWrapper(
|
|
18
|
+
<>
|
|
19
|
+
{children}
|
|
20
|
+
{renderPress()}
|
|
21
|
+
</>,
|
|
22
|
+
styles.haptics
|
|
23
|
+
)}
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Haptics
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Nullable } from '@mediacubeco/base/types'
|
|
2
|
+
import { type ReactNode, type Ref } from 'react'
|
|
3
|
+
import { type GestureResponderEvent, type ViewStyle } from 'react-native'
|
|
4
|
+
|
|
5
|
+
type HapticsRef = {
|
|
6
|
+
hapticsIn: (event: GestureResponderEvent) => void
|
|
7
|
+
hapticsOut: (event: GestureResponderEvent) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type HapticsProps = {
|
|
11
|
+
ref: Ref<Nullable<HapticsRef>>
|
|
12
|
+
children: ReactNode
|
|
13
|
+
renderWrapper: (children: ReactNode, style?: ViewStyle) => ReactNode
|
|
14
|
+
renderPress: () => ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { HapticsRef, HapticsProps }
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { DEFAULT_LAYOUT, useLayout } from '@mediacubeco/base-react-native/hooks'
|
|
2
|
+
import { useCallback } from 'react'
|
|
3
|
+
import { type GestureResponderEvent, StyleSheet } from 'react-native'
|
|
4
|
+
import { interpolate, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated'
|
|
5
|
+
import { useThemeMode, useThemeSetup } from '../../../../../lib'
|
|
6
|
+
|
|
7
|
+
const useRippleStyles = () => {
|
|
8
|
+
const { isThemeModeDark } = useThemeSetup()
|
|
9
|
+
const { COLORS, TRANSPARENCIES, ANIMATIONS } = useThemeMode()
|
|
10
|
+
const rippleX = useSharedValue(0)
|
|
11
|
+
const rippleY = useSharedValue(0)
|
|
12
|
+
const rippleScale = useSharedValue(0)
|
|
13
|
+
const rippleOpacity = useSharedValue(0)
|
|
14
|
+
const wrapperLayout = useSharedValue(DEFAULT_LAYOUT)
|
|
15
|
+
const handleWrapperLayout = useLayout({ setLayout: wrapperLayout.set })
|
|
16
|
+
|
|
17
|
+
const transparency = isThemeModeDark ? TRANSPARENCIES.STRONG : TRANSPARENCIES.LIGHT
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
wrapper: {
|
|
21
|
+
...StyleSheet.absoluteFill,
|
|
22
|
+
pointerEvents: 'none',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
},
|
|
25
|
+
ripple: {
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
backgroundColor: COLORS.FILL.NEUTRAL_SURFACE,
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const animatedStyles = {
|
|
32
|
+
ripple: useAnimatedStyle(() => {
|
|
33
|
+
const radius = Math.hypot(
|
|
34
|
+
Math.max(rippleX.value, wrapperLayout.value.width - rippleX.value),
|
|
35
|
+
Math.max(rippleY.value, wrapperLayout.value.height - rippleY.value)
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
top: rippleY.value - radius,
|
|
40
|
+
left: rippleX.value - radius,
|
|
41
|
+
width: radius * 2,
|
|
42
|
+
height: radius * 2,
|
|
43
|
+
borderRadius: radius,
|
|
44
|
+
opacity: interpolate(rippleOpacity.value, [0, 1], [TRANSPARENCIES.INVISIBLE, transparency]),
|
|
45
|
+
transform: [
|
|
46
|
+
{
|
|
47
|
+
scale: rippleScale.value,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const handleRippleIn = useCallback(
|
|
55
|
+
(event: GestureResponderEvent) => {
|
|
56
|
+
rippleX.set(event.nativeEvent.locationX)
|
|
57
|
+
rippleY.set(event.nativeEvent.locationY)
|
|
58
|
+
rippleScale.set(0)
|
|
59
|
+
rippleOpacity.set(1)
|
|
60
|
+
rippleScale.set(withTiming(1, ANIMATIONS.TIMING.BASE))
|
|
61
|
+
},
|
|
62
|
+
[rippleX, rippleY, rippleScale, rippleOpacity, ANIMATIONS.TIMING.BASE]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
const handleRippleOut = useCallback(() => {
|
|
66
|
+
rippleOpacity.set(withTiming(TRANSPARENCIES.INVISIBLE, ANIMATIONS.TIMING.BASE))
|
|
67
|
+
}, [rippleOpacity, TRANSPARENCIES, ANIMATIONS.TIMING.BASE])
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
styles,
|
|
71
|
+
animatedStyles,
|
|
72
|
+
handleWrapperLayout,
|
|
73
|
+
handleRippleIn,
|
|
74
|
+
handleRippleOut,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { useRippleStyles }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useImperativeHandle } from 'react'
|
|
2
|
+
import { View } from 'react-native'
|
|
3
|
+
import Animated from 'react-native-reanimated'
|
|
4
|
+
import { useRippleStyles } from './ripple.styles'
|
|
5
|
+
import { type RippleProps } from './ripple.types'
|
|
6
|
+
|
|
7
|
+
const Ripple = ({ ref, children, renderWrapper, renderPress }: RippleProps) => {
|
|
8
|
+
const { styles, animatedStyles, handleWrapperLayout, handleRippleIn, handleRippleOut } =
|
|
9
|
+
useRippleStyles()
|
|
10
|
+
|
|
11
|
+
useImperativeHandle(ref, () => {
|
|
12
|
+
return {
|
|
13
|
+
rippleIn: handleRippleIn,
|
|
14
|
+
rippleOut: handleRippleOut,
|
|
15
|
+
}
|
|
16
|
+
}, [handleRippleIn, handleRippleOut])
|
|
17
|
+
|
|
18
|
+
return renderWrapper(
|
|
19
|
+
<>
|
|
20
|
+
<View style={styles.wrapper} onLayout={handleWrapperLayout}>
|
|
21
|
+
<Animated.View style={[styles.ripple, animatedStyles.ripple]} />
|
|
22
|
+
</View>
|
|
23
|
+
{children}
|
|
24
|
+
{renderPress()}
|
|
25
|
+
</>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default Ripple
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Nullable } from '@mediacubeco/base/types'
|
|
2
|
+
import { type ReactNode, type Ref } from 'react'
|
|
3
|
+
import { type GestureResponderEvent, type ViewStyle } from 'react-native'
|
|
4
|
+
|
|
5
|
+
type RippleRef = {
|
|
6
|
+
rippleIn: (event: GestureResponderEvent) => void
|
|
7
|
+
rippleOut: (event: GestureResponderEvent) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type RippleProps = {
|
|
11
|
+
ref: Ref<Nullable<RippleRef>>
|
|
12
|
+
children: ReactNode
|
|
13
|
+
renderWrapper: (children: ReactNode, style?: ViewStyle) => ReactNode
|
|
14
|
+
renderPress: () => ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { RippleRef, RippleProps }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import { StyleSheet } from 'react-native'
|
|
3
|
+
import { interpolate, useAnimatedStyle, useSharedValue, withSpring } from 'react-native-reanimated'
|
|
4
|
+
|
|
5
|
+
const useSpringStyles = () => {
|
|
6
|
+
const spring = useSharedValue(0)
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
spring: {},
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const animatedStyles = {
|
|
13
|
+
spring: useAnimatedStyle(() => {
|
|
14
|
+
return {
|
|
15
|
+
transform: [{ scale: interpolate(spring.value, [0, 1], [1, 0.95]) }],
|
|
16
|
+
}
|
|
17
|
+
}),
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const handleSpringIn = useCallback(() => {
|
|
21
|
+
spring.set(withSpring(1))
|
|
22
|
+
}, [spring])
|
|
23
|
+
|
|
24
|
+
const handleSpringOut = useCallback(() => {
|
|
25
|
+
spring.set(withSpring(0))
|
|
26
|
+
}, [spring])
|
|
27
|
+
|
|
28
|
+
return { styles, animatedStyles, handleSpringIn, handleSpringOut }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { useSpringStyles }
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useImperativeHandle } from 'react'
|
|
2
|
+
import { useSpringStyles } from './spring.styles'
|
|
3
|
+
import { type SpringProps } from './spring.types'
|
|
4
|
+
|
|
5
|
+
const Spring = ({ ref, children, renderWrapper, renderPress }: SpringProps) => {
|
|
6
|
+
const { styles, animatedStyles, handleSpringIn, handleSpringOut } = useSpringStyles()
|
|
7
|
+
|
|
8
|
+
useImperativeHandle(ref, () => {
|
|
9
|
+
return {
|
|
10
|
+
springIn: handleSpringIn,
|
|
11
|
+
springOut: handleSpringOut,
|
|
12
|
+
}
|
|
13
|
+
}, [handleSpringIn, handleSpringOut])
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
{renderWrapper(
|
|
18
|
+
<>
|
|
19
|
+
{children}
|
|
20
|
+
{renderPress()}
|
|
21
|
+
</>,
|
|
22
|
+
[styles.spring, animatedStyles.spring]
|
|
23
|
+
)}
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Spring
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Nullable } from '@mediacubeco/base/types'
|
|
2
|
+
import { type ReactNode, type Ref } from 'react'
|
|
3
|
+
import { type GestureResponderEvent, type ViewProps } from 'react-native'
|
|
4
|
+
|
|
5
|
+
type SpringRef = {
|
|
6
|
+
springIn: (event: GestureResponderEvent) => void
|
|
7
|
+
springOut: (event: GestureResponderEvent) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type SpringProps = {
|
|
11
|
+
ref: Ref<Nullable<SpringRef>>
|
|
12
|
+
children?: ReactNode
|
|
13
|
+
renderWrapper: (children: ViewProps['children'], style: ViewProps['style']) => ReactNode
|
|
14
|
+
renderPress: () => ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { SpringRef, SpringProps }
|