Complete the code to make the View positioned relative to its normal place.
import React from 'react'; import { View, StyleSheet } from 'react-native'; export default function App() { return ( <View style={{ position: '[1]', top: 10, left: 10, width: 100, height: 100, backgroundColor: 'red' }} /> ); }
Using relative positions the View relative to its normal place.
Complete the code to position the View absolutely at the top-left corner.
import React from 'react'; import { View } from 'react-native'; export default function App() { return ( <View style={{ position: '[1]', top: 0, left: 0, width: 50, height: 50, backgroundColor: 'blue' }} /> ); }
Absolute positioning places the View exactly at the specified top and left coordinates.
Fix the error in the style to correctly position the View absolutely 20 pixels from the bottom.
import React from 'react'; import { View } from 'react-native'; export default function App() { return ( <View style={{ position: 'absolute', [1]: 20, left: 0, width: 60, height: 60, backgroundColor: 'green' }} /> ); }
To position from the bottom, use the bottom property, not top.
Fill both blanks to create a View that is positioned absolutely 15 pixels from the right and 25 pixels from the top.
import React from 'react'; import { View } from 'react-native'; export default function App() { return ( <View style={{ position: '[1]', [2]: 25, right: 15, width: 70, height: 70, backgroundColor: 'purple' }} /> ); }
The View must be absolute positioned, and top sets the distance from the top edge.
Fill all three blanks to create a View with relative position, offset 10 pixels down and 5 pixels right.
import React from 'react'; import { View } from 'react-native'; export default function App() { return ( <View style={{ position: '[1]', top: [2], left: [3], width: 80, height: 80, backgroundColor: 'orange' }} /> ); }
Relative positioning moves the View from its normal spot by top: 10 and left: 5 pixels.