'In React Native, I am getting this error "Could not find root view for a given ancestor with tag <no.>"

I was implementing the bottom-tab navigation feature and I am getting this error

Could not find root view for a given ancestor with tag number

Attaching error message with piece of code which causing this error.

error message

import React from 'react';

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

import {
    Home,
    Profile,
    Explore,
} from '../Screens';
import navigationStrings from '../constants/navigationStrings';

const Stack = createStackNavigator();

function Routes() {
    return (
        <NavigationContainer>
            <Stack.Navigator initialRouteName={navigationStrings.HOME} screenOptions={{ headerShown: false }}>
                <Stack.Screen options={{ title: 'Book Your Book' }} name={navigationStrings.HOME} component={Home} />
                <Stack.Screen name={navigationStrings.PROFILE} component={Profile} />
                <Stack.Screen name={navigationStrings.EXPLORE} component={Explore} />
            </Stack.Navigator>
        </NavigationContainer >
    )
}

export default Routes;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source