How to use react-native-share - 10 common examples

To help you get started, we’ve selected a few react-native-share 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 DefinitelyTyped / DefinitelyTyped / types / react-native-share / react-native-share-tests.ts View on Github external
message: '',
    title: '',
    subject: '',
    excludedActivityTypes: '',
    showAppsToView: true,
});

// $ExpectType Promise
Share.shareSingle({
    url: '',
    message: '',
    social: 'facebook',
});

// $ExpectType Promise
Share.shareSingle({
    url: '',
    type: '',
    message: '',
    title: '',
    subject: '',
    social: 'facebook',
});

// $ExpectType Promise
Share.shareSingle({
    url: '',
    type: '',
    message: '',
    title: '',
    subject: '',
    filename: 'test',
github syun0216 / goforeat / app / views / ContentView.js View on Github external
this.timer = setTimeout(() => {
            Share.shareSingle(
              Object.assign(shareOptions, {
                social: "whatsapp"
              })
            )
              .then(info => {
                // console.log(info);
                this.setState({
                  modalVisible: false
                });
              })
              .catch(err => {
                alert(`WhatsApp:${err && err.error && err.error.message}`);
                // console.log(err);
                return;
              });
          }, 300);
github syun0216 / goforeat / app / views / FoodDetailsView.js View on Github external
this.timer = setTimeout(() => {
            Share.shareSingle(
              Object.assign(shareOptions, {
                social: "whatsapp"
              })
            )
              .then(info => {
                // console.log(info);
                this.setState({
                  modalVisible: false
                });
              })
              .catch(err => {
                alert(`WhatsApp:${err && err.error && err.error.message}`);
                // console.log(err);
                return;
              });
          }, 300);
github XadillaX / eggirl / src / pages / gallery.js View on Github external
setTimeout(function() {
                Share.open({
                    url: `data:${mime};base64,${base64}`,
                    message: `Eggirl - ${media.caption}`,
                    type: "image/jpeg"
                }).catch(err => err && console.log(err));
            }, 0);
        }).catch(err => {
github arjunkomath / Feline-for-Product-Hunt / App / SinglePost.js View on Github external
share: function () {
        Mixpanel.trackWithProperties('Share Post', {
            share_text: this.state.post.name,
            share_URL: this.state.post.redirect_url
        });
        Share.open({
            share_text: this.state.post.name,
            share_URL: this.state.post.redirect_url,
            title: "Sharing is Caring"
        }, function (e) {
            console.log(e);
        });
    },
github BlueWallet / BlueWallet / screen / lnd / lndViewInvoice.js View on Github external
this.qrCodeSVG.toDataURL(data => {
                      let shareImageBase64 = {
                        message: `lightning:${invoice.payment_request}`,
                        url: `data:image/png;base64,${data}`,
                      };
                      Share.open(shareImageBase64).catch(error => console.log(error));
                    });
                  });
github PierreBresson / Thinkerview / app / components / shareSocial.js View on Github external
.then(supported => {
                  if (!supported) {
                    Share.shareSingle({
                      ...shareOptions,
                      social: "whatsapp"
                    });
                  } else {
                    return ReactNative.Linking.openURL(
                      "whatsapp://send?text=" +
                        config.strings.share.message +
                        " " +
                        config.strings.share.url_article +
                        id
                    );
                  }
                })
                .catch(err => console.error("An error occurred", err));
github egm0121 / splitcloud-app / components / shareAppScreen.js View on Github external
openShareApp(platformName){
    const { shareOptions } = this.props;
    if(platformName == 'line') {
      const bodyURI = encodeURIComponent(`${shareOptions.message} ${shareOptions.url}`);
      Linking.openURL(`line://msg/text/?${bodyURI}`)
      .then(() => this.props.onSocialShareCompleted(platformName))
      .catch(() => this.props.onSocialShareAborted())
    }
    if(platformName == 'clipboard') {
      Clipboard.setString(shareOptions.url);
      this.props.onPushNotification('Link Copied');
      this.props.onSocialShareCompleted(platformName);
      this.closeScreen();
      return true;
    }
    return Share.shareSingle({...shareOptions, social: platformName})
    .then(data => {
      console.log('social share completed');
      this.props.onSocialShareCompleted(platformName);
      this.closeScreen();
    }).catch(err => {
      console.log('social share failed',err);
      this.props.onSocialShareAborted(platformName);
    });
  }
  componentDidUpdate(){
github react-native-community / react-native-share / example / App.js View on Github external
const shareEmailImage = async () => {
    const shareOptions = {
      title: 'Share file',
      email: 'email@example.com',
      social: Share.Social.EMAIL,
      failOnCancel: false,
      urls: [images.image1, images.image2],
    };

    try {
      const ShareResponse = await Share.open(shareOptions);
      setResult(JSON.stringify(ShareResponse, null, 2));
    } catch (error) {
      console.log('Error =>', error);
      setResult('error: '.concat(getErrorString(error)));
    }
  };
github PierreBresson / Thinkerview / app / components / shareSocial.js View on Github external
setTimeout(() => {
              Share.open(config.strings.share);
            }, 300);
          }}

react-native-share

Social share, sending simple data to other apps.

MIT
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis