Поставьте зависимости:
npm install react-native-reanimated react-native-svgpnpm add react-native-reanimated react-native-svgyarn add react-native-reanimated react-native-svgbun add react-native-reanimated react-native-svgСкопируйте эти файлы в src/shared/components/molecules/rotating-square/:
Проверьте алиас путей. Импорты в коде выше записаны так, как их пишет astra-rn add: @/shared/components, @/shared/utils и @/shared/hooks. Нужен алиас "@/*": ["./src/*"] в tsconfig.json — или поправьте импорты под свои пути.
import { View, StyleSheet } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { StatusBar } from "expo-status-bar";
import { useFonts } from "expo-font";
import { RotatingSquaresSpinner } from "@/shared/components/molecules/rotating-square";
import { Showcase, useCustomize } from "~/showcase";
const CUSTOMIZE = [
{ key: "color", label: "Цвет", type: "color", default: "#ffffff" },
{ key: "squareSize", label: "Размер квадрата", type: "slider", min: 4, max: 30, step: 1, unit: "px", default: 10 },
{ key: "spacing", label: "Интервал", type: "slider", min: 0, max: 40, step: 1, unit: "px", default: 10 },
{ key: "size", label: "Размер", type: "slider", min: 30, max: 160, step: 2, unit: "px", default: 60 },
{ key: "duration", label: "Длительность", type: "slider", min: 200, max: 4000, step: 50, unit: "ms", default: 1000 },
{ key: "background", label: "Фон", type: "color", default: "#0a0a0a" },
] as const;
export default function App() {
const custom = useCustomize(CUSTOMIZE);
return (
<Showcase>
<GestureHandlerRootView style={[styles.container, { backgroundColor: custom.background }]}>
<StatusBar style="light" />
<View style={styles.content}>
<RotatingSquaresSpinner
color={custom.color}
squareSize={custom.squareSize}
spacing={custom.spacing}
size={custom.size}
duration={custom.duration}
/>
</View>
</GestureHandlerRootView>
</Showcase>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#0a0a0a",
justifyContent: "center",
alignItems: "center",
},
content: {},
title: {
fontSize: 28,
fontWeight: "700",
color: "#fff",
},
subtitle: {
fontSize: 15,
color: "#555",
},
card: {
backgroundColor: "#141414",
borderRadius: 16,
overflow: "hidden",
marginTop: 20,
},
triggerContent: {
padding: 16,
},
triggerLeft: {
flexDirection: "row",
alignItems: "center",
gap: 12,
},
triggerText: {
fontSize: 16,
fontWeight: "500",
color: "#fff",
},
item: {
flexDirection: "row",
alignItems: "center",
gap: 12,
padding: 14,
backgroundColor: "#1a1a1a",
borderRadius: 12,
marginBottom: 6,
},
itemText: {
fontSize: 15,
color: "#fff",
},
destructiveText: {
color: "#ff453a",
},
});color?Тип string
squareSize?Тип number
spacing?Тип number
size?Тип number
duration?Тип number
repeatCount?Тип number
style?Тип StyleProp<ViewStyle>