React native wheel of fortune view component
npm install react-native-gogo-spin



!license
| Example |
| :-------------------------------------- |
| !Example |
```
yarn add react-native-gogo-spin
or
``
npm install react-native-gogo-spin --save
worked in react native web and ios android ,you can custom each pie base on array you passed in,like Flatlist;check the example to seek the usage;
`jsx`
export const App = () => {
const prize=[1,2,3,4,5,6]
const spinRef = useRef
const doSpin = () => {
const getIdx = ~~(Math.random() * prize.length);
spinRef.current.doSpinAnimate(getIdx);
};
const onEndSpin = (endSuccess: boolean) => {
console.log('endSuccess', endSuccess);
};
return (
notShowDividLine={true}
spinDuration={2000}
spinReverse={true}
spinTime={3}
ref={spinRef}
width={SIZE}
height={SIZE}
radius={SIZE / 2}
data={prize}
offsetEnable={true}
source={require('./images/wheel.png')}
renderItem={(data, i) => {
return (
);
}}
/>
);
};
| Prop | Default | Type | Description |
| :-------------------------- | :-----------------------------------------------: | :-------------------------------------: | :------------------------------------------------------------------------------------ |
| doSpinAnimate | - | (idx: number) => void | spin to the given index in data prop |
| Prop | Default | Type | Description |
| :-------------------------- | :-----------------------------------------------: | :-------------------------------------: | :------------------------------------------------------------------------------------ |
| data(required) | - | array | Like data in flatlist |(data,index)=>React.ReactElement
| renderItem(required) | - | | Like renderItem in flatlist |number
| width/height/radius(required) | - | | Size of the wheel |ImageSourcePropType
| source | - | | this props shows a background image if it exist |(finish: boolean) => void
| onEndSpinCallBack | - | | call after spin end |boolean
| notShowDividLine | false | | if show the dividing line between each pie |boolean
| offsetEnable | false | | false will point to the center of the pie ,true will randomly point to the section of the pie |number 1-0.1
| offsetPercent | 0.9 | | time to offset random angle only works if offsetEnable is true |boolean
| spinReverse | false | | spin reverse |StyleProp
| wheelStyle | 8000 | | the style of the outside wheelnumber
| spinTime | 8 | | the number of the wheel make turns after it point to the prize |number
| spinDuration | 8000 | | The time(ms) whole spin animation last |number` | item in pie default size |
| innerHeight/innerWidth | 50 |
282931