How to set up Branch subscription

I tried following the instructions at https://docs.expo.io/versions/latest/sdk/branch.html, but I’m not able to find the Branch module in DangerZone.

Here’s what my code looks like:

import { DangerZone } from 'expo'

componentDidMount() {
    const { Branch } = DangerZone

   Branch.subscribe(bundle => {
      if (bundle && bundle.params && !bundle.error) {
        // `bundle.params` contains all the info about the link.
      }
    })
  }

I get an error that says:
[ts] Property 'Branch' does not exist on type 'typeof DangerZone'.

Any my dependency looks like:
"expo": "25.0.0",

What am I doing wrong?

That looks right. Exactly what I have in mine. The subscribe function doesn’t work on Android anyway though. (react-native-branch implementaiton issue, not expo)

Yeah I don’t see anything obviously wrong with that code @jabdulius. Can you repro that error in a snack? I know branch won’t actually work in a snack but it would be useful if we could see the error.

Thanks Christian, Jesse. I cannot repro in a snack. We are using Typescript in our project, but I’m a bit of a newb. Might that have something to do with it, and is it possible to test Typescript in a snack?

Snack:

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