Complete the code to set the width of the View to 100.
import React from 'react'; import { View } from 'react-native'; export default function Box() { return <View style={{ width: [1] }} />; }
The width property expects a number for fixed width in pixels. So 100 sets width to 100 pixels.
Complete the code to make the View fill all available vertical space using flex.
import React from 'react'; import { View } from 'react-native'; export default function FullHeightBox() { return <View style={{ [1]: 1 }} />; }
Setting flex: 1 makes the View expand to fill available space in its container.
Fix the error in the style to set height to 200 pixels.
import React from 'react'; import { View } from 'react-native'; export default function TallBox() { return <View style={{ height: [1] }} />; }
In React Native, height is a number without units. So 200 sets height to 200 pixels.
Fill both blanks to create a View with width 150 and height 100.
import React from 'react'; import { View } from 'react-native'; export default function SizedBox() { return <View style={{ width: [1], height: [2] }} />; }
Width and height should be numbers without quotes to set fixed sizes in pixels.
Fill all three blanks to create a View that fills space with flex, has width 200, and height 300.
import React from 'react'; import { View } from 'react-native'; export default function FlexibleBox() { return <View style={{ [1]: 1, width: [2], height: [3] }} />; }
Use flex: 1 to fill space, and numbers for width and height in pixels.