bartgryszko / react-native-circular-slider

React Native component for creating circular slider :radio_button:
MIT License
876 stars 190 forks source link

Cant use other icon images? #5

Closed KinanKazmi closed 7 years ago

KinanKazmi commented 7 years ago

Hi, I tried using stopIcon = require('../Images/img1.png') startIcon = require('../Images/img1.png') but that gives an error. Probably because they are non-SVG images. Any fix for that? To use normal images there?

Also, your component is too exposed. I cant just use the main tags and start using it. I have to import those math functions along. It would be better if you subdivide it in such a way that a user can just use your component tags and give it his wanted values and start using it. All the angle calculation should be behind the doors as well and the onUpdate function should just be a callback to change something else in the app and not run the basic working of the component itself.

Awesome component btw, really need to use it in my next project. I would be really glad and thankful if you could improve these functionalities.

bartgryszko commented 7 years ago

For stop / start icon you can use any react-native-svg compatible element (https://github.com/bgryszko/react-native-circular-slider/blob/master/src/CircularSlider.js#L227).

onUpdate recieves { startAngle, angleLength } because you can imagine different ways of using those – and Bedtime is just an example (it's easy to convert it to percentage fill for example) – and for that you don't need much of math functions (or I misunderstood what you've meant by "import those math functions along"). In fact, there is only one function exposed – component CircularSlider – nothing else.

This component was built to help you build your custom one on the top of it, and not to cover every case you can imagine.