0
0
React Nativemobile~10 mins

Why React Native enables cross-platform mobile apps - Test Your Understanding

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

Complete the code to import the core React Native component for displaying text.

React Native
import { [1] } from 'react-native';
Drag options to blanks, or click blank then click option'
AText
BTextInput
CView
DButton
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a container component like View instead of Text.
2fill in blank
medium

Complete the code to create a simple React Native component that returns a View with a Text inside.

React Native
export default function App() {
  return (
    <[1]>
      <Text>Hello!</Text>
    </[1]>
  );
}
Drag options to blanks, or click blank then click option'
ASafeAreaView
BText
CScrollView
DView
Attempts:
3 left
💡 Hint
Common Mistakes
Using Text as a container, which is not correct.
3fill in blank
hard

Fix the error in the code by completing the import statement to enable cross-platform components.

React Native
import React from 'react';
import { [1] } from 'react-native';
Drag options to blanks, or click blank then click option'
AStyleSheet
BComponent
CPlatform
DAppRegistry
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing StyleSheet which is for styling, not platform detection.
4fill in blank
hard

Fill both blanks to create a style object with a background color and padding.

React Native
const styles = StyleSheet.create({
  container: {
    backgroundColor: '[1]',
    [2]: 10
  }
});
Drag options to blanks, or click blank then click option'
Ablue
Bmargin
Cpadding
Dcolor
Attempts:
3 left
💡 Hint
Common Mistakes
Using margin instead of padding for inside spacing.
5fill in blank
hard

Fill all three blanks to create a cross-platform button with a press handler.

React Native
import { Button, Alert } from 'react-native';

export default function App() {
  const onPressHandler = () => {
    Alert.alert('[1]');
  };

  return (
    <Button
      title=[2]
      onPress=[3]
    />
  );
}
Drag options to blanks, or click blank then click option'
AButton pressed!
B"Click me"
ConPressHandler
DhandlePress
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined function names or wrong quotes for strings.