Skip to content

Commit

Permalink
Add style prop to override the default styles (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdnichollsc authored and heineiuo committed Jan 25, 2019
1 parent 43f6d50 commit eab5a3b
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class AnimatedGradient extends Component {
render () {

const {color0, color1} = this.state;
const {customColors, children, points} = this.props;
const {customColors, children, points, style} = this.props;
const preferColors = [];
// while (preferColors.length < customColors.length) {
while (preferColors.length < 2) {
Expand All @@ -104,17 +104,16 @@ class AnimatedGradient extends Component {
.concat(customColors.slice(0, preferColors.length+1))
)
}
const interpolatedColors = [color0, color1]
.map((animatedColor, index) => {
return animatedColor.interpolate({
inputRange: Array.from({length: customColors.length+1}, (v, k) => k),
outputRange: preferColors[index]
})
});
const interpolatedColors = [color0, color1].map((animatedColor, index) => {
return animatedColor.interpolate({
inputRange: Array.from({length: customColors.length+1}, (v, k) => k),
outputRange: preferColors[index]
})
});

return (
<Animated.LinearGradient
style={[styles.linearGradient]}
style={[styles.linearGradient, style]}
points={points}
color0={interpolatedColors[0]}
color1={interpolatedColors[1]}>
Expand Down

0 comments on commit eab5a3b

Please sign in to comment.