Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking.openUrl with a telephone number throws an error #26554

Closed
andrewsouthard opened this issue Sep 24, 2019 · 7 comments
Closed

Linking.openUrl with a telephone number throws an error #26554

andrewsouthard opened this issue Sep 24, 2019 · 7 comments
Labels
API: Linking Bug Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Resolution: Locked This issue was locked by the bot.

Comments

@andrewsouthard
Copy link

andrewsouthard commented Sep 24, 2019

React Native version:
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Memory: 37.91 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.4.0 - ~/.nvm/versions/node/v12.4.0/bin/node
Yarn: 1.12.1 - ~/.yarn/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v12.4.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 27, 28
Build Tools: 27.0.3, 28.0.0, 28.0.2, 28.0.3
System Images: android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.0 => 0.61.0

Steps To Reproduce

  1. react-native init phonetest
  2. Change App.js to the following:
import {Button, Linking, SafeAreaView} from 'react-native';

const App = () => {
  return (
    <SafeAreaView>
      <Button
        onPress={() => {
          Linking.openURL('tel:555-867-5309').catch(err =>
            console.error('An error occurred', err),
          );
        }}
        title="Call"
      />
    </SafeAreaView>
  );
};

export default App;
  1. react-native run-ios

Describe what you expected to happen:
Dialog box asking whether to call the number or cancel

Instead, received the following error:
Simulator Screen Shot - iPhone X - 2019-09-24 at 16 04 12

@react-native-bot
Copy link
Collaborator

It looks like you are using an older version of React Native. Please update to the latest release, v0.61 and verify if the issue still exists.

The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running `react-native info` on a project using the latest release.

@lucasbento
Copy link
Contributor

This is expected, you can not make phone calls on simulator, if you test this on a real device you will see that it works.

@andrewsouthard
Copy link
Author

@lucasbento That makes sense. Thanks! Would it be possible to throw an error message indicating that to prevent any confusion?

@kelset
Copy link
Contributor

kelset commented Sep 26, 2019

Would it be possible to throw an error message indicating that to prevent any confusion?

Maybe instead of an error it could be a warning?
That said, I think that it's a good idea anyway - could you open a PR for it? 🤗

(since Hacktoberfest is close and I think that it's not too complicated - but I may be wrong - I'll also add the good first issue label)

@kelset kelset added the Good first issue Interested in collaborating? Take a stab at fixing one of these issues. label Sep 26, 2019
@lucasbento
Copy link
Contributor

Yeah, this definitely would benefit from a better error message!

Yasser-G added a commit to Yasser-G/react-native that referenced this issue Sep 26, 2019
facebook-github-bot pushed a commit that referenced this issue Sep 30, 2019
Summary:
This PR, tries to fix the problem at #26554

## Changelog
iOS Fixed - Now it will show a warning when trying to use it inside a simulator, instead of throwing a red screen error.

## Notes
Docs PR opened as well at: facebook/react-native-website#1295
<img width="418" alt="image" src="https://user-images.githubusercontent.com/12865914/65734976-532ebc00-e0cd-11e9-8e8c-2b4a5a7b8aea.png">
Pull Request resolved: #26607

Differential Revision: D17661091

Pulled By: cpojer

fbshipit-source-id: 3d660f25546374adfa3436e2954c9c27750039b7
@espipj
Copy link
Contributor

espipj commented Oct 1, 2019

@kelset I think this can be closed now 😺

@kelset
Copy link
Contributor

kelset commented Oct 3, 2019

awesome, thanks!

@kelset kelset closed this as completed Oct 3, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Oct 3, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Linking Bug Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants