Поставьте зависимости:
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/orbiting-dots/:
Проверьте алиас путей. Импорты в коде выше записаны так, как их пишет 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 { OrbitDotLoader } from "@/shared/components/molecules/orbiting-dots";
import { Showcase, useCustomize } from "~/showcase";
const DOT_COLOR_HEX = "#ffffff";
const DOT_COLOR = "#fff";
const CUSTOMIZE = [
{ key: "color", label: "Цвет точек", type: "color", default: DOT_COLOR_HEX },
{ key: "numDots", label: "Количество", type: "slider", min: 1, max: 8, step: 1, default: 3 },
{ key: "size", label: "Размер", type: "slider", min: 24, max: 120, step: 2, unit: "px", default: 72 },
{ key: "dotRadius", label: "Радиус точек", type: "slider", min: 1, max: 12, step: 0.5, unit: "px", default: 6 },
{ key: "centerRadius", label: "Радиус центра", type: "slider", min: 0, max: 16, step: 0.5, unit: "px", default: 8 },
{ key: "duration", label: "Оборот", type: "slider", min: 300, max: 3000, step: 50, unit: "ms", default: 900 },
] as const;
export default function App() {
const custom = useCustomize(CUSTOMIZE);
return (
<Showcase>
<GestureHandlerRootView style={styles.container}>
<StatusBar style="light" />
<View style={styles.content}>
<OrbitDotLoader
numDots={custom.numDots}
size={custom.size}
dotColor={custom.color === DOT_COLOR_HEX ? DOT_COLOR : custom.color}
dotRadius={custom.dotRadius}
centerRadius={custom.centerRadius}
duration={custom.duration}
/>
</View>
</GestureHandlerRootView>
</Showcase>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#0a0a0a",
justifyContent: "center",
alignItems: "center",
},
content: {},
});dotColor?Тип string
dotRadius?Тип number
centerRadius?Тип number
size?Тип number
duration?Тип number
numDots?Тип number
style?Тип StyleProp<ViewStyle>