Invariant Violation: `new NativeEventEmitter()` requires a non-null argument
Asked Answered
M

0

7

When i work on react native reanimated i faced this error.

ERROR Error: Requiring module "node_modules/@react-navigation/drawer/src/index.tsx", which threw an exception: Invariant Violation: new NativeEventEmitter() requires a non-null argument., js engine: hermes

1

And i cant use drawer navigator.

import * as React from 'react';
import { createAppContainer } from "react-navigation";
import { createStackNavigator } from "react-navigation-stack";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"
import { NavigationContainer } from "@react-navigation/native";
import { View } from "native-base";
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { createDrawerNavigator } from '@react-navigation/drawer';



const Stack = createNativeStackNavigator();
function HomeScreen({ navigation }) {
    return (
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
            <Button
                onPress={() => navigation.navigate('Notifications')}
                title="Go to notifications"
            />
        </View>
    );
}

function NotificationsScreen({ navigation }) {
    return (
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
            <Button onPress={() => navigation.goBack()} title="Go back home" />
        </View>
    );
}

const Drawer = createDrawerNavigator();
const StackNavigator = () => {
    return (
        <NavigationContainer>


            <Drawer.Navigator initialRouteName="Home">
                <Drawer.Screen name="Home" component={HomeScreen} />
                <Drawer.Screen name="Notifications" component={NotificationsScreen} />
            </Drawer.Navigator>
        </NavigationContainer>
    );
}

export default StackNavigator;

I install react native reanimated package and i run pod install. But i faced this error.

Mezuzah answered 20/12, 2022 at 9:40 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.