Hello,
I'm running into a Flow issue with the following component:
// @flow
import React from 'react';
import { TouchableWithoutFeedback } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import styles from './styles';
const defaultGradientColours = ['#33000000', '#00B2D6'];
const gradientColours = defaultGradientColours;
const Background = () => (
<TouchableWithoutFeedback onPress={this.onPress}>
<LinearGradient colors={gradientColours} style={styles.backgroundGradient} />
</TouchableWithoutFeedback>
);
export default Background;
The error message is:
Cannot create LinearGradient element because property style is missing in object type [1] but exists in props [2].
src/Background.js
13โ
14โ const Background = () => (
15โ <TouchableWithoutFeedback onPress={() => dependencies.Analytics.headerPressed()}>
[2] 16โ <LinearGradient colors={gradientColours} style={styles.backgroundGradient} />
17โ </TouchableWithoutFeedback>
18โ );
19โ
node_modules/react-native-linear-gradient/common.js
[1] 8โ export type Props = $Exact<{
9โ start?: Point;
10โ end?: Point;
11โ colors: string[];
12โ locations?: number[];
13โ useAngle?: boolean;
14โ angleCenter?: Point;
15โ angle?: number;
16โ }> & typeof(View);
It seems that Flow isn't able to derive the type declaration of View in the union of Props and typeof(View).
I'm not sure if I'm missing anything out of the ordinary.
Here are the dependencies:
react-native-linear-gradient: ^2.5.3flow-bin: ^0.78.0I'm happy to look into this issue and contribute if needed be.
I'm happy to look into this issue and contribute if needed be
@RCiesielczuk Please do! I'll be happy to review and merge a PR :)
This issue is still valid in the last version 2.5.6
Most helpful comment
This issue is still valid in the last version
2.5.6