Поставьте зависимости:
npm install @shopify/react-native-skia react-native-reanimatedpnpm add @shopify/react-native-skia react-native-reanimatedyarn add @shopify/react-native-skia react-native-reanimatedbun add @shopify/react-native-skia react-native-reanimatedСкопируйте эти файлы в src/shared/components/organisms/theme-switch/:
Код доступен по подпискеPro
Исходник «Смена темы» открывается с подпиской Pro. Уже оформили? Войдите в аккаунт.
Проверьте алиас путей. Импорты в коде выше записаны так, как их пишет astra-rn add: @/shared/components, @/shared/utils и @/shared/hooks. Нужен алиас "@/*": ["./src/*"] в tsconfig.json — или поправьте импорты под свои пути.
Код доступен по подпискеPro
Исходник «Смена темы» открывается с подпиской Pro. Уже оформили? Войдите в аккаунт.
modeТип ThemeMode
colorsТип ThemeColors
animationTypeТип AnimationType
animationDurationТип number
easingТип EasingType
CircularТип "circular"
WipeТип "wipe"
CircularInvertedТип "circularInverted"
WipeRightТип "wipeRight"
WipeDownТип "wipeDown"
WipeUpТип "wipeUp"
CircularBlurCircular, with the reveal edge softened by a blur on the mask.
Тип "circularBlur"
BlindsVertical slats that widen inside their own column, like a shutter.
Тип "blinds"
BlindsHorizontalHorizontal slats that deepen inside their own row.
Тип "blindsHorizontal"
CurtainA band opening outward from the vertical centre line.
Тип "curtain"
IrisA rhombus expanding from the touch point.
Тип "iris"
FadeStraight cross-fade between the two themes.
Тип "fade"
ClockWipeA radial sweep around the touch point, like a clock hand.
Тип "clockWipe"
themeТип ThemeMode
onThemeChangeТип (newTheme: ThemeMode) => void
childrenТип Required<ReactNode>
animationDuration?Тип number
animationType?Тип AnimationType
style?Тип StyleProp<ViewStyle>
onAnimationStart?Тип () => void
onAnimationComplete?Тип () => void
switchDelay?Тип number
easing?Тип EasingType
childrenТип Required<ReactNode>
defaultTheme?Тип ThemeMode
onThemeChange?Тип (theme: ThemeMode) => void
onAnimationStart?Тип () => void
onAnimationComplete?Тип () => void
customLightColors?Тип Partial<ThemeColors>
customDarkColors?Тип Partial<ThemeColors>