How to use the react-native-share.shareSingle function in react-native-share

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 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 pillarwallet / pillarwallet / src / components / ShareSocial / ShareSocial.js View on Github external
shareOnSocialMedia = (platform: string, sharerUrl: string) => () => {
    Share.shareSingle({
      message: 'pillarproject.io/wallet',
      url: 'https://pillarproject.io/wallet',
      social: Share.Social[platform.toUpperCase()],
    })
      .catch(() => {
        Linking.openURL(sharerUrl);
      });
  };
github syun0216 / goforeat / app / components / CommonComment.js View on Github external
setTimeout(() => {
      Share.shareSingle(Object.assign(shareOptions, {
        "social": "whatsapp"
      }))
      .then(info => {
        this.setState({
          modalVisible: false
        });
      })
      .catch((err) => { 
        alert(`WhatsApp:${err && err.error && err.error.message}`)
        this.setState({
          modalVisible: false
        });
        return;
      });
    },300);
  }
github syun0216 / goforeat / app / views / ContentView.js View on Github external
setTimeout(() => {
        Share.shareSingle(
          Object.assign(shareOptions, {
            social: type
          })
        ).catch(err => {
          return;
        });
      }, 300);
    }

react-native-share

Social share, sending simple data to other apps.

MIT
Latest version published 2 days ago

Package Health Score

92 / 100
Full package analysis