0
0
React Nativemobile~10 mins

SafeAreaView in React Native - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import SafeAreaView from React Native.

React Native
import { [1] } from 'react-native';
Drag options to blanks, or click blank then click option'
AScrollView
BView
CText
DSafeAreaView
Attempts:
3 left
💡 Hint
Common Mistakes
Importing View instead of SafeAreaView
Forgetting to import SafeAreaView
2fill in blank
medium

Complete the code to wrap content inside SafeAreaView.

React Native
export default function App() {
  return (
    <[1]>
      <Text>Hello!</Text>
    </[1]>
  );
}
Drag options to blanks, or click blank then click option'
AView
BSafeAreaView
CScrollView
DText
Attempts:
3 left
💡 Hint
Common Mistakes
Using View instead of SafeAreaView
Not wrapping content inside any container
3fill in blank
hard

Fix the error in the SafeAreaView usage by completing the code.

React Native
import { SafeAreaView, Text } from 'react-native';

export default function App() {
  return (
    <SafeAreaView [1]>
      <Text>Welcome!</Text>
    </SafeAreaView>
  );
}
Drag options to blanks, or click blank then click option'
Astyle=flex:1
Bflex=1
Cstyle={{flex: 1}}
Dstyle={{flex=1}}
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect syntax for style prop
Passing flex=1 without style object
4fill in blank
hard

Fill both blanks to create a SafeAreaView with a blue background and centered text.

React Native
import { SafeAreaView, Text, StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  container: {
    [1]: 1,
    backgroundColor: '[2]',
    justifyContent: 'center',
    alignItems: 'center'
  }
});
Drag options to blanks, or click blank then click option'
Aflex
BflexGrow
Cred
Dblue
Attempts:
3 left
💡 Hint
Common Mistakes
Using flexGrow instead of flex
Using wrong color name or missing quotes
5fill in blank
hard

Fill all three blanks to create a SafeAreaView with padding, white background, and a Text component with large font size.

React Native
import { SafeAreaView, Text, StyleSheet } from 'react-native';

const styles = StyleSheet.create({
  container: {
    [1]: 20,
    backgroundColor: '[2]'
  },
  text: {
    fontSize: [3]
  }
});
Drag options to blanks, or click blank then click option'
Amargin
Bpadding
Cwhite
D24
Attempts:
3 left
💡 Hint
Common Mistakes
Using margin instead of padding
Using wrong color name
Using fontSize as a string instead of number