amplitude / amplitude/Amplitude-ReactNative

ERROR: Unhandled promise rejection: TypeError: null is not an object (evaluating 'AmplitudeReactNative.setLibraryName')

Ouverte
#152 3 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
87
Forks
21
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Hi, please help!

I’ve just upgrade from Expo SDK 43 to 46, and seems like I need to use a custom development client instead of Expo Go, because of [expo-analytics-amplitude will be deprecated in SDK 45.](https://forums.expo.dev/t/expo-analytics-amplitude-will-be-deprecated-in-sdk-45/64016) and clearly written in [expo documents that expo-analytics-amplitude will be Deprecated](https://docs.expo.dev/versions/v45.0.0/sdk/amplitude/#amplitudeinitializeasyncapikey). So I need to use the official [@amplitude/react-native](https://github.com/amplitude/Amplitude-ReactNative).

So I migrating from expo-analytics-amplitude to [@amplitude/react-native migration](https://github.com/amplitude/Amplitude-ReactNative/blob/main/MIGRATION_GUIDE.md)

I code in my JavaScript project that I follow the instruction in **Installation and Quick Start**, and point to [React Native SDK (Legacy)](https://www.docs.developers.amplitude.com/data/sdks/react-native/)

This what I code:

`import * as React from 'react`
`import { Amplitude, Identify } from '@amplitude/react-native'`

`const ampInstance = Amplitude.getInstance()`
`ampInstance.init(AMPLITUDE_API_KEY)`

And unfortunately appears this error!!

[Unhandled promise rejection: TypeError: null is not an object (evaluating 'AmplitudeReactNative.setLibraryName')]

at node_modules\@amplitude\react-native\src\index.ts:null in Amplitude#_setLibraryName
at node_modules\@amplitude\react-native\src\index.ts:null in Amplitude#constructor
at node_modules\@amplitude\react-native\src\index.ts:null in Amplitude.getInstance
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in asyncGeneratorStep
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in _next
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in Promise$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in tryCallTwo
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in doResolve
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in Promise
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in asyncGeneratorStep
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in _next
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in Promise$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in tryCallTwo
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in doResolve
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in Promise
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in asyncGeneratorStep
at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in _next
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in _allocateCallback$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in _callReactNativeMicrotasksPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in callReactNativeMicrotasks
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __callReactNativeMicrotasks
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in flushedQueue

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.