question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[expo-branch] null is not an object (evaluating RNBranch.STANDARD_EVENT_ADD_TO_CART

See original GitHub issue

🐛 Bug Report

Environment

This bug happens in Android


  Expo CLI 3.0.9 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.9.2 - ~/.nvm/versions/node/v10.16.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5522156
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      expo: ^34.0.1 => 34.0.4 
      react: 16.8.3 => 16.8.3 
      react-native: https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz => 0.59.8 
    npmGlobalPackages:
      expo-cli: 3.0.9

Steps to Reproduce

import * as whatever from 'expo-branch' OR import whatever from 'expo-branch' OR import { Branch } from 'expo-branch'

  1. npm start
  2. Scan QR code on Expo on Android app
  3. See red screen of death: WhatsApp Image 2019-08-15 at 4 14 01 PM

Expected Behavior

It does not break.

Actual Behavior

It breaks.

Reproducible Demo

https://github.com/AryanJ-NYC/expo-sandbox

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:50 (20 by maintainers)

github_iconTop GitHub Comments

6reactions
matias91commented, Sep 24, 2019

I’m stuck with the same problem.

I’m trying with SDK 35 and still getting that error on IOS and Android. The error happens importing as

import Branch from 'expo-branch'

and

import Branch from 'react-native-branch'

I read about the Android support here, and followed this instructions.

error: null is not an object (evaluating 'RNBranch.STANDARD_EVENT_ADD_TO_CART')

i’m missing something?

5reactions
walidvbcommented, Dec 19, 2019

Also, for those interested, I’ve ended up handling it this way:

// /my-branch.js
import Constants from 'expo-constants';

if (Constants.appOwnership !== 'standalone') {
  module.exports = {
    subscribe: console.log,
    createBranchUniversalObject: async () => ({
      showShareSheet: console.log,
    })
  }
}
else{
  module.exports = require('expo-branch')
}

and then import Branch from 'my-branch'. The above code would obviously need to mock all functions called by your code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo Branch: undefined is not an object (evaluating ...
I am using expo for my react native application. Steps: - run expo start. Hit the error below on android studio emulator. Working...
Read more >
Can anybody help me with branch.io integration in Expo?
When I run the app via expo client, I get this error : null is not an object (evaluating RNBranch.STANDARD_EVENT_ADD_TO_CART.
Read more >
Expo: Uncaught Error: Undefined Is Not An Object (Evaluating ...
Error: null is not an object evaluating RNBranch.STANDARDEVENTADDTOCART import Branch { BranchEvent } from expobranch;. Expected Behavior. It does not break ...
Read more >
A brand new website interface for an even better experience!
null is not an object (evaluating 'RNBranch.STANDARD_EVENT_ADD_TO_CART')
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found