3

I have been trying to learn react native router flux but the tutorial I have been following has outdated code and error does not help me. In this file of code here

import React, { Component } from 'react';
    import { Router, Scene, TabBar } from 'react-native-router-flux';
    import {Text,} from 'react-native';

    import Home from './screens/home/index';
    import Email from './screens/email/Email';
    import Unread from "./screens/email/Unread";

    const TabIcon = ({ selected, title }) => {
        return (
            <Text style={{color: selected ? 'red' :'black'}}>{title}</Text>
        );
    }

    const App = () => {
        return (
            <Router>
                <Scene key="root">
                    <Scene
                        key="tabbar"
                        component={TabBar}
                        tabs={true}
                        tabBarStyle={{ backgroundColor: '#FFFFFF' }}
                    >
                        <Scene key = "Tab1" title="tab1" icon={TabIcon}>
                            <Scene key="Home"
                               component={Home}
                               title="Home"
                               initial
                            />
                            <Scene
                            key="email"
                            component={Email}
                            title="email"
                            />
                            </Scene>
                        </Scene>

                    </Scene>

            </Router>
        );
    };

    export default App;

The error is of follow: createNavigationContainer() has been removed. Use createAppContainer() instead. You can also import createAppContainer directly from @react-navigation/native.

There is no createNavigationContainer() used in my class, how come the console still report that error?

The error only occur when I tried to incorporate tab into my app. If it just the onpress() function, the app would work fin

Anh Minh Tran
  • 341
  • 1
  • 3
  • 11

0 Answers0