Expo Branch 5.0.3: TypeError: null is not an object (evaluating 'RNBranch.STANDARD_EVENT_ADD_TO_CART')

Please provide the following:

  1. SDK Version: 43
  2. Platforms(Android/iOS/web/all): Android/iOS
  3. expo-branch

Hi everyone! Once I got updated to Expo 43 and expo-branch 5.0.3, I started getting this error on startup in the Expo Go app. I have already tried to remove the node_modules directory, package-lock, and called npm install again, but the issue does not go away.

This is how I import Branch:
import Branch from "expo-branch";

This is what I do with it (just trying to catch bundle params and log in the Amplitude):

Branch.subscribe(bundle => {
                if (bundle && bundle.params && !bundle.error) {
                            params: bundle.params,
                            error: bundle.error,

This is expo-branch in the package.json:

"expo-branch": "~5.0.3"

Hey @unit37akasrd, to clarify is this occurring on both Android and iOS for you? Also, can you share a public github repo with a minimal implementation of this that reproduces the error? Two code snippets while helpful do not give us the full context and leaves a lot to assumption.



I have the same issue with “expo-branch”: “~5.0.3” and “expo”: “^43.0.0”
I followed the guide here Branch - Expo Documentation and did those steps since I only need it to work on Android

  • Add the Branch Key to your app.json in the section android.config.branch.apiKey and ios.config.branch.apiKey . You can find your key on this page of the Branch Dashboard.
  • Add a linking scheme to your app.json in the scheme section if you don’t already have one.
  • For Android, add a new intent filter that registers the Branch link-domain , under android.intentFilters in app.json .
    The minimal example is very simple: with just the two prerequisites above, all I need to do is in any component in the Android app

The minimal example would be something like this

import Branch from "expo-branch";

Is there any additional setup required from expo before adding those imports?

I think if I’m not mistaken the issue is that Branch is only supported on builds, so I had to do something like this (Platform specific imports - #3 by raphaelrk) to prevent the issue

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.