Skip to content

Commit 1c08be1

Browse files
committed
Fix animation on iOS with RN 0.76+
1 parent 0a0fa3f commit 1c08be1

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

lib/BaseLinearGradient.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
// SOFTWARE.
2222

2323
import React, {ComponentType, PureComponent} from 'react';
24-
import {Animated, StyleProp, ViewStyle} from 'react-native';
24+
import {Animated, StyleSheet, View, ViewStyle} from 'react-native';
2525

2626
import {LinearGradientPropsType} from './types';
2727

2828
export type BaseLinearGradientPropsType = {
2929
LinearGradient: ComponentType<LinearGradientPropsType>;
30-
style: Animated.AnimatedProps<StyleProp<ViewStyle>> | StyleProp<ViewStyle>;
30+
style: ViewStyle;
3131
backgroundColor: string;
3232
highlightColor: string;
3333
};
@@ -47,17 +47,19 @@ class BaseLinearGradient extends PureComponent<BaseLinearGradientPropsType> {
4747
const {style, LinearGradient, backgroundColor, highlightColor} = this.props;
4848

4949
return (
50-
<LinearGradient
51-
colors={[
52-
backgroundColor,
53-
highlightColor,
54-
highlightColor,
55-
backgroundColor,
56-
]}
57-
start={this.start}
58-
end={this.end}
59-
style={style}
60-
/>
50+
<View style={style}>
51+
<LinearGradient
52+
colors={[
53+
backgroundColor,
54+
highlightColor,
55+
highlightColor,
56+
backgroundColor,
57+
]}
58+
start={this.start}
59+
end={this.end}
60+
style={StyleSheet.absoluteFill}
61+
/>
62+
</View>
6163
);
6264
}
6365
}

0 commit comments

Comments
 (0)