kfiroo / react-native-cached-image

CachedImage component for react-native
MIT License
938 stars 470 forks source link

Support image specific style properties (ex. tintColor) #78

Open torbjorn-kvist opened 6 years ago

torbjorn-kvist commented 6 years ago

Tested on 1.3.5 and 1.4.0-rc React Native: 0.47

"Warning: Failed prop type: Invalid props.style key tintColor supplied to ActivityIndicator."

Suggested solutions:

kfiroo commented 6 years ago

@Dvidan Sounds good! If you can create a quick PR for this it would be amazing.

Not sure what's the best way yo go about it tho.. Should we have a whitelist/blacklist for props? Or maybe simply have a higher level props for handling the different components, i.e. containerViewStyles, imageStyles (which could just be style), loadingIndicatorStyles?

Would love to hear some thoughts about it

torbjorn-kvist commented 6 years ago

@kfiroo Not sure either I have gotten it to work by doing _.omit(flattenStyle(style), ['resizeMode', 'tintColor']) for example. Problem with that is if there is going to be a more Image specific style properties, then there is a need to update the omit each time there is something new.

Using higher level props could also work.

One other alternativ is to import http://facebook.github.io/react-native/docs/imagestyleproptypes.html https://facebook.github.io/react-native/docs/viewstyleproptypes.html

And use lodash 'difference' and then omit the image specific values.