React-native-swiper: Allow a prop to change the color of the active dot.

Created on 12 May 2015  路  6Comments  路  Source: leecade/react-native-swiper

Most helpful comment

This is what I ended up doing. I had to dig into the code to pull out the default dot styles and change just the color. I can see this being the most changed attribute, so why not make it easy.

<Swiper dotColor="#000" activeDotColor="red" />

All 6 comments

hi @cgarvis

The prop dot / activeDot maybe is what's your need.

<Swiper 
dot={<View style={{backgroundColor:'rgba(0,0,0,.2)', width: 5, height: 5,borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />}
          activeDot={<View style={{backgroundColor: '#000', width: 8, height: 8, borderRadius: 4, marginLeft: 3, marginRight: 3, marginTop: 3, marginBottom: 3,}} />}
>

See how to use in example: https://github.com/leecade/react-native-swiper/blob/master/examples/examples/swiper.js#L64

This is what I ended up doing. I had to dig into the code to pull out the default dot styles and change just the color. I can see this being the most changed attribute, so why not make it easy.

<Swiper dotColor="#000" activeDotColor="red" />

I see, I consider that someone need to change the size postion or something else.
As you said, maybe a shortcut prop to do this is a better way
And would u like send a PR for this feature, or I will do it later

I completely agree with @cgarvis. I guess this ist the most changed attribute by far.
Would you mind me making a pull request?
Best,
D

@denizs PR is welcome

Pr is in! #298

Was this page helpful?
0 / 5 - 0 ratings

Related issues

commit-master picture commit-master  路  3Comments

nicolabortignon picture nicolabortignon  路  3Comments

ruben-kasaz picture ruben-kasaz  路  3Comments

tokict picture tokict  路  3Comments

nomoreboredom picture nomoreboredom  路  3Comments