HomeiOS DevelopmentReact native error on iOS platform: :Invariant Violation: 'new NativeEventEmitter()' requires a...

React native error on iOS platform: [runtime not ready]:Invariant Violation: ‘new NativeEventEmitter()’ requires a non-null argument


I am utilizing React Native write app for android and iOS, the identical code for android app can use, however iOS app get error:

[runtime not ready]:Invariant Violation: 'new NativeEventEmitter()' requires a non-null argument.

React native error on iOS platform: [runtime not ready]:Invariant Violation: ‘new NativeEventEmitter()’ requires a non-null argument

The associated code is:

import React, { useEffect, useRef, useState } from 'react';
import {
  View,
  Textual content,
  TextInput,
  Button,
  FlatList,
  StyleSheet,
  TouchableOpacity,
  KeyboardAvoidingView,
  Platform,
  Alert,
  Keyboard,
  useColorScheme,
  NativeEventEmitter,
  NativeModules,
} from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { Calendar, LocaleConfig } from 'react-native-calendars';

const eventEmitter = new NativeEventEmitter(NativeModules.ToastExample);

NativeEventEmitter error

The hyperlink https://reactnative.dev/docs/native-modules-ios in above image cannot entry.

iOS error

Above textual content in associated hyperlink https://github.com/fb/react-native/blob/bae0016dc900b5465d0e714c8d467c1422db9eae/packages/react-native/Libraries/EventEmitter/NativeEventEmitter.d.ts#L40-L41

How can I resolve the issue?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments