How to use the react-native.Linking.openURL function in react-native

To help you get started, we’ve selected a few react-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github celo-org / celo-monorepo / packages / mobile / src / invite / saga.ts View on Github external
try {
        const phoneHash = getPhoneHash(e164Number)
        yield put(transferEscrowedPayment(phoneHash, amount, temporaryAddress))
      } catch (e) {
        Logger.error(TAG, 'Error sending payment to unverified user: ', e)
        yield put(showError(ErrorMessages.TRANSACTION_FAILED))
      }
    }

    switch (inviteMode) {
      case InviteBy.SMS: {
        yield call(sendSms, e164Number, msg)
        break
      }
      case InviteBy.WhatsApp: {
        yield Linking.openURL(`https://wa.me/${e164Number}?text=${encodeURIComponent(msg)}`)
        break
      }
    }

    // Wait a little bit so it has time to switch to Sms/WhatsApp before updating the UI
    yield delay(100)
  } catch (e) {
    Logger.error(TAG, 'Send invite error: ', e)
    throw e
  }
}
github alphasp / pxview / src / containers / Detail_bk.js View on Github external
Linking.canOpenURL(url).then(supported => {
      if (!supported) {
        console.log('Can\'t handle url: ' + url);
      } else {
        return Linking.openURL(url);
      }
    }).catch(err => {
      console.error('Error on link press ', err)
github discourse / DiscourseMobile / src / lib / url_handler.js View on Github external
return new Promise((resolve, reject) => {
      if (authToken) {
        if (openInSafari) {
          Linking.openURL(url)
            .then(() => resolve({ event: "success", url }))
            .catch(() => reject());
        } else {
          Browser.openBrowserAsync(url)
            .then(() => {
              resolve({ event: "closing", url });
            })
            .catch(() => reject());
        }
      } else {
        reject();
      }
    });
  }
github gyxing / react-native-book / app / containers / Read.js View on Github external
Linking.canOpenURL(url).then(supported => {
      if (!supported) {
        Toast.fail("此链接打不开");
      } else {
        return Linking.openURL(url);
      }
    }).catch(err => Toast.fail("An error occurred:" + url));
  };
github Skjutsgruppen / skjutsgruppen-reactnative / app / components / search / publicTransportItem.js View on Github external
          onPress={() => Linking.openURL(publicTransport.url)}
          underlayColor="#f0f0f0"
github futurice / wappuapp-client / app / components / radio / RadioWebsiteLink.ios.js View on Github external
          onPress={() => Linking.openURL(currentStation.get('website'))}
        >
github fullstacknights / FSN-app / app / Information / components / info / index.js View on Github external
handleSlackUrl = () => {
    if (this.props.slackUrl) {
      Linking.openURL(this.props.slackUrl);
    }
  };
  render() {