flow / flow-bin

Binary wrapper for Flow - A static type checker for JavaScript
https://flow.org
Other
536 stars 48 forks source link

Passing props to stylesheet returns error #175

Closed jaytxng closed 4 years ago

jaytxng commented 4 years ago

flow-bin: 0.114.0

In my React Native app I'm trying to pass down props to Stylesheet like in this example:

<View style={styles.mainFooterCont(noFooter)}>
  <Text> Testing </Text>
</View>

in StyleSheet.create

mainFooterCont: noFooter => ({
   flexDirection: 'row',
   justifyContent: 'space-between',
   alignItems: 'flex-end',
   paddingBottom: noFooter ? 0 : 20,
   paddingTop: Metrics.ratio(noFooter ? 0 : 5),
}),

However, I'm seeing a Cannot call 'StyleSheet.create' with object literal bound to 'obj' because function [1] is incompatible with '$Shape of ____DangerouslyImpreciseStyle_Internal' [2] in property 'mainFooterCont'.

Building it and having it rendered results in no issues, but curious if there's a reason this was typed to not accept functions.