React-native-linear-gradient: component display but it doesn't change its color when i test it as the example

Created on 22 Jan 2018  ·  4Comments  ·  Source: react-native-linear-gradient/react-native-linear-gradient

it display like this
_41219a50-f4b8-4576-b8dc-5a659ddb832b

my code is here
<LinearGradient colors={['#4c669f', '#3b5998', '#192f6a']} style={styles.linearGradient}> <Text style={styles.buttonText}> Sign in with Facebook </Text> </LinearGradient>

component tree in debugger.
_7fb67b30-15e3-486d-8a6c-7bf3f27902cc

has some one encouter this strange behavior ?

version:
"react-native": "^0.51.0",

Most helpful comment

Umm....

In my case, If I set width and height, then LinearGradient shows correctly.

e.g.

 <LinearGradient
          colors = { ['rgb(255, 0, 0)' , 'rgb(0, 0, 0)'] }
          start = {{ x:0, y:1 }}
          end   = {{ x:1, y:1 }}
          style={{ width: 200, height: 200 }}
/>

This was worked for me.

Therefore, Perhaps, The sample code at README.md has a problem, I think.

<LinearGradient 
   colors={['#4c669f', '#3b5998', '#192f6a']} 
   style={styles.linearGradient}> 
   <Text style={styles.buttonText}> Sign in with Facebook </Text>
</LinearGradient>

This isn't worked.

All 4 comments

I got the exact same problem with the same code.... OMG
Yeah, react-native link seemed to be done correctly, and XCode could build them correctly, Then LinearGradient Component was instanciated...But could not be gradient.

Also, I tried to rebuild, aimed to cache cleaning around project, however nothing changes.

I had no idea about it.

Umm....

In my case, If I set width and height, then LinearGradient shows correctly.

e.g.

 <LinearGradient
          colors = { ['rgb(255, 0, 0)' , 'rgb(0, 0, 0)'] }
          start = {{ x:0, y:1 }}
          end   = {{ x:1, y:1 }}
          style={{ width: 200, height: 200 }}
/>

This was worked for me.

Therefore, Perhaps, The sample code at README.md has a problem, I think.

<LinearGradient 
   colors={['#4c669f', '#3b5998', '#192f6a']} 
   style={styles.linearGradient}> 
   <Text style={styles.buttonText}> Sign in with Facebook </Text>
</LinearGradient>

This isn't worked.

OMGGGGGGGGGG!!??
Somehow, suddenly, the sample code shows gradient properly....

some cache around your emulator or metro, may affect this problem.... or I forgot to do something, I don't have an idea. (´;ω;`)

Hey! I'm closing this since it looks like a solved issue.

Was this page helpful?
0 / 5 - 0 ratings