Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
View and Text Components | Basic Concepts
Foundations of React Native

View and Text ComponentsView and Text Components

View Component

  • The View component is a fundamental building block in React Native, similar to a div in web development;
  • It's used to structure and style the layout of your mobile app;
  • Properties like flex, justifyContent, and alignItems control its layout.
All the React Native components we are considering should be imported from the react-native package.

Example

Code Description
  • Line 2: Imports the View component from the react-native library.
  • Line 4: Declares a functional component named App.
  • Lines 5-9: The component returns JSX. In this case, it returns a View component, which acts as a container for other UI components.
  • Text Component

    • The Text component is used to display text in your app;
    • It's similar to the HTML <span> or <p> tags;
    • You can style text using various properties such as fontSize, color, and fontWeight.

    Example

    Code Description
  • Line 2: Imports the Text component from the react-native library.
  • Line 4: Declares a functional component named App.
  • Lines 5-9: The component returns a View component containing a Text component. The Text component displays the text "The first line of text in the app."
  • In Practice

    Все було зрозуміло?

    Секція 2. Розділ 3
    course content

    Зміст курсу

    Foundations of React Native

    View and Text ComponentsView and Text Components

    View Component

    • The View component is a fundamental building block in React Native, similar to a div in web development;
    • It's used to structure and style the layout of your mobile app;
    • Properties like flex, justifyContent, and alignItems control its layout.
    All the React Native components we are considering should be imported from the react-native package.

    Example

    Code Description
  • Line 2: Imports the View component from the react-native library.
  • Line 4: Declares a functional component named App.
  • Lines 5-9: The component returns JSX. In this case, it returns a View component, which acts as a container for other UI components.
  • Text Component

    • The Text component is used to display text in your app;
    • It's similar to the HTML <span> or <p> tags;
    • You can style text using various properties such as fontSize, color, and fontWeight.

    Example

    Code Description
  • Line 2: Imports the Text component from the react-native library.
  • Line 4: Declares a functional component named App.
  • Lines 5-9: The component returns a View component containing a Text component. The Text component displays the text "The first line of text in the app."
  • In Practice

    Все було зрозуміло?

    Секція 2. Розділ 3
    some-alt