Member-only story

Design Like a Pro: React Native Style Properties You Canโ€™t Ignore ๐Ÿš€

Jayant Kumar๐Ÿ‡ฎ๐Ÿ‡ณ
4 min read1 day ago

--

Photo by Alexander Andrews on Unsplash

In this article we will learn about the important styles property that you must know in React Native.

1๏ธโƒฃ The Shape Shifter โ€” flex

๐Ÿ“Œ What it does?
Defines how a component should grow or shrink to fill available space.

๐Ÿ“Œ Usage:

  • flex: 1 โ†’ Expands to take up all available space.
  • flex: 0.5 โ†’ Takes up half the space.

๐Ÿ“Œ Example:

<View style={{ flex: 1, backgroundColor: 'blue' }} />

2๏ธโƒฃ Align It Right โ€” alignItems

๐Ÿ“Œ What it does?
Aligns child elements along the cross-axis.

๐Ÿ“Œ Values:

  • flex-start โ†’ Aligns children to the start.
  • center โ†’ Aligns children in the middle.
  • flex-end โ†’ Aligns children at the end.
  • stretch โ†’ Stretches children to fill.

๐Ÿ“Œ Example:

<View style={{ alignItems: 'center' }}>
<Text>Hello!</Text>
</View>

3๏ธโƒฃ Spread Out โ€” justifyContent

--

--

Jayant Kumar๐Ÿ‡ฎ๐Ÿ‡ณ
Jayant Kumar๐Ÿ‡ฎ๐Ÿ‡ณ

Written by Jayant Kumar๐Ÿ‡ฎ๐Ÿ‡ณ

Hello My name is Jayant Kumar, I am a software Engineer , specialist in Mobile Development (Android , IOS , Flutter , React Native and Ionic) from India ๐Ÿ‡ฎ๐Ÿ‡ณ

No responses yet