- We'll start by working on the App component. First, let's import all the required dependencies:
import React, { Component } from 'react';import { Text, TouchableOpacity, StyleSheet, View, SafeAreaView,} from 'react-native';import Notification from './Notification';
- Once we have all the dependencies imported, we can define the App class. In this case, we are going to initialize the state with a notify property equal to false. We are going to use this property to show or hide the notification. By default, the notification will not be shown onscreen. To make things simple, we will define the message property in the state with the text we want to display:
export default class App extends Component { state = { notify: false, ...