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

What is ViewStyle and why we have array in ViewStyle in TypeScript

$
0
0

I'm learning TypeScript but today i see a few lines of code like this :

  const ROOT: ViewStyle = {  alignItems: 'center',  backgroundColor: color.primary,  borderRadius: 8,  flex: 1,  justifyContent: 'center',  marginHorizontal: spacing[2],  marginTop: spacing[2],  paddingHorizontal: spacing[4],  height: "100%",}

First of all, What is ViewStyle??

I searched google for this but feel like it not have documentation for this, the offical document for this only have stye for View component, so what is ViewStyle, and TextStyle also?

And i don't understand why they don't use marginHorizontal: 2 instead of marginHorizontal: spacing[2], spacing[2] to create space?? But why use that when we can directly choose number for marginHorizontal and why we have array in here??

Please help, thank you a lots


Viewing all articles
Browse latest Browse all 6287

Trending Articles



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