Linking.makeUrl is not a function

Please provide the following:

  1. SDK Version: 35
  2. Platforms(Android/iOS/web/all): ios android

Hi, I copied and pasted your example code

let redirectUrl = Linking.makeUrl('path/into/app', { hello: 'world', goodbye: 'now' });

However this immediately triggered a Sentry.io TypeError
TypeError: _reactNative.Linking.makeUrl is not a function
File “/Users/virtual/development/questapps/app/App.js”, line 193, in App.componentDidMount$

1 Like

Hey @virtuallast,

Can you share how you are importing the Linking module?

Cheers,
Adam

I’m having the same issue.
SDK version:35
Platform iOS

per: https://docs.expo.io/versions/latest/workflow/linking/
This does not work:

import { Linking } from 'react-native';
const prefix = Linking.makeUrl('/');
console.log({prefix});

generates this error in Sentry:

_reactNative.Linking.makeUrl is not a function. (In ‘_reactNative.Linking.makeUrl(’/’)’, ‘_reactNative.Linking.makeUrl’ is undefined)

This does work:

import { AppLoading, Linking, Notifications } from 'expo';
const prefix = Linking.makeUrl('/');
console.log({prefix});

it logs this to console:

Object {
  "prefix": "exp://127.0.0.1:19000/--/",
}

Verified I’m on sdk 35. From package.json:
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",

2 Likes

I agree, the workflow document on Linking looks wrong. The API reference has the correct info.

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