Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Color of the Component #35

Closed
joaobibiano opened this issue Dec 5, 2019 · 6 comments
Closed

Change Color of the Component #35

joaobibiano opened this issue Dec 5, 2019 · 6 comments

Comments

@joaobibiano
Copy link

joaobibiano commented Dec 5, 2019

Hi,

My app has a nice blue color (like a dark theme)

I want to change the color from white to another darker.

But, I'm trying to use the properties in style props, but it doesn't work.

Can you help me?

Code example

<View style={{ height: 500, justifyContent: 'space-between', alignItems: 'center' }}>
  {[...new Array(10)].map((item, key) => {
    return (
      <View key={key} style={{ margin: 10 }}>
        <ShimmerPlaceHolder style={{ margin: 5 }} autoRun width={40} height={10} />
        {/* just for example */}
        <ShimmerPlaceHolder style={{ backgroundColor: 'red', overflow: 'hidden', margin: 5, borderRadius: 17 }} autoRun width={380} height={40} />
        <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
          <ShimmerPlaceHolder style={{ margin: 5 }} autoRun width={40} height={10} />
          <ShimmerPlaceHolder style={{ margin: 5 }} autoRun width={40} height={10} />
        </View>
      </View>
    );
  })}
</View>
@tomzaku
Copy link
Owner

tomzaku commented Dec 5, 2019

Hi @joaovbibiano, thank for using my package

Have you tried to add colorShimmer props in your app
For example:

<ShimmerPlaceHolder autoRun colorShimmer=["red","white","red"]/>

@dkwl93
Copy link

dkwl93 commented Dec 6, 2019

@joaovbibiano I can confirm that @tomzaku solution works. backgroundColor is unfortunately not supported in the <ShimmerPlaceHolder />. The only way to change the colour of the view is to change the colorShimmer prop.

That being said, @tomzaku can you please update the documentation to reflect this? It currently says that colorShimmer is a string when in fact its an array of strings. passing in a string crashes the app

@tomzaku
Copy link
Owner

tomzaku commented Dec 6, 2019

@dkwl93 Great. My mistake. Could you make me a PR for this suggest? I'm really appriciate

@tomzaku
Copy link
Owner

tomzaku commented Dec 6, 2019

It's better to rename it, could be "shimerColors"

@joaobibiano
Copy link
Author

joaobibiano commented Dec 6, 2019

Thank you guys. It worked!

My configuration: colorShimmer={['#242069', '#28236fd6', '#242069']}

@tomzaku tomzaku closed this as completed Dec 15, 2019
@jforaker
Copy link

jforaker commented Apr 2, 2021

For future googlers landing here, it has been updated:

shimmerColors={['green', 'white', 'red']}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants