Recall & Review
beginner
What does the
flex property do in React Native layout?The
flex property tells a component how much space it should take relative to its siblings inside a container. A higher flex value means the component grows more to fill available space.Click to reveal answer
beginner
How do you set a fixed width and height for a component in React Native?
You set fixed width and height by adding
width and height properties in the style, for example: { width: 100, height: 50 } sets the component to 100 units wide and 50 units tall.Click to reveal answer
beginner
What happens if you set
flex: 1 on a component inside a container?The component will expand to fill all available space in the container, sharing space equally if siblings also have
flex: 1.Click to reveal answer
intermediate
Can you use both fixed
width/height and flex on the same component? What happens?Yes, but fixed
width and height take priority. The flex property will only affect the component if width or height is not fixed or set to auto.Click to reveal answer
beginner
Why is using
flex often better than fixed sizes for mobile layouts?Because mobile screens vary in size, using
flex helps components adjust and fill space proportionally, making the app look good on different devices without hardcoded sizes.Click to reveal answer
In React Native, what does
flex: 2 mean compared to flex: 1 on sibling components?✗ Incorrect
flex defines proportional space. flex: 2 means twice the space compared to flex: 1.
If you want a component to be exactly 150 units wide and 100 units tall, which style should you use?
✗ Incorrect
Setting width and height directly fixes the size.
What is the default value of
flex in React Native if not specified?✗ Incorrect
The default flex is 0, meaning the component does not grow to fill space.
Which property controls how a component grows to fill available space in React Native?
✗ Incorrect
flex controls growth inside a flex container.
If a container has two children with styles
{ flex: 1 } and { flex: 3 }, how is space divided?✗ Incorrect
Space is divided in ratio 1:3, so first child gets 1/4 and second child 3/4.
Explain how
flex, width, and height work together to control layout in React Native.Think about how space is shared inside a container.
You got /4 concepts.
Describe why using
flex is important for mobile app layouts compared to fixed sizes.Imagine your app on small and large phones.
You got /4 concepts.