Поставьте зависимости:
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/spinner-arc/:
Проверьте алиас путей. Импорты в коде выше записаны так, как их пишет 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 { SpinnerArc } from "@/shared/components/molecules/spinner-arc";
import { Showcase, useCustomize } from "~/showcase";
const CUSTOMIZE = [
{ key: "colorStart", label: "Цвет начала", type: "color", default: "#8b5cf6" },
{ key: "colorEnd", label: "Цвет конца", type: "color", default: "#6366f1" },
{ key: "size", label: "Размер", type: "slider", min: 24, max: 200, step: 1, unit: "px", default: 84 },
{ key: "strokeWidth", label: "Толщина", type: "slider", min: 1, max: 16, step: 0.5, unit: "px", default: 3 },
{ key: "arcLength", label: "Длина дуги", type: "slider", min: 20, max: 350, step: 5, unit: "°", default: 270 },
{ key: "speed", label: "Оборот", type: "slider", min: 150, max: 3000, step: 50, unit: "ms", default: 500 },
{ key: "track", label: "Показать трек", type: "toggle", default: false },
{ key: "trackColor", label: "Цвет трека", type: "color", default: "#262626" },
] as const;
export default function App() {
const custom = useCustomize(CUSTOMIZE);
return (
<Showcase>
<GestureHandlerRootView style={styles.container}>
<StatusBar style="light" />
<View style={styles.content}>
<SpinnerArc
arcLength={(custom.arcLength / 360) * 2 * Math.PI * (custom.size / 2 - custom.strokeWidth)}
colorEnd={custom.colorEnd}
colorStart={custom.colorStart}
backgroundColor={custom.track ? custom.trackColor : "transparent"}
size={custom.size}
speed={custom.speed}
strokeWidth={custom.strokeWidth}
/>
</View>
</GestureHandlerRootView>
</Showcase>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#0a0a0a",
justifyContent: "center",
alignItems: "center",
},
content: {},
});size?Тип number
colorStart?Тип string
colorEnd?Тип string
strokeWidth?Тип number
speed?Тип number
backgroundColor?Тип string
arcLength?Тип number