Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

React Native Array Notation with Typescript

$
0
0

I have an object that I am trying to pass a style to. With regular JS I can pass

<ObjectName         containerStyle={[    {marginTop: 10, marginBottom: 30},    {borderBottomWidth: 3},     keyboardOpen ? null : {marginHorizontal: 30},  ]} />

However when I try to do the same thing in Typescript I get the error that the given objects have no properties in common with FlexStyle, Object is delcared as follows

export const ObjectName = (props: {containerStyle?: FlexStyle}) => {...}

How would I combine those styles with array notation in TS, or if I can't what would be the best method to use?


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>