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

Share.share iOS sms got an extra information not wanted #23746

Closed
antoninleissen opened this issue Mar 4, 2019 · 4 comments
Closed

Share.share iOS sms got an extra information not wanted #23746

antoninleissen opened this issue Mar 4, 2019 · 4 comments
Labels
API: Share Bug Platform: iOS iOS applications. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.

Comments

@antoninleissen
Copy link

antoninleissen commented Mar 4, 2019

🐛 Bug Report

When i share my content ( which is a simple text ) by choosing sms on iOS, i find an object not wanted "xxxxx.app" in my content.

img_0024

To Reproduce

  • Import Share from react-native
  • Use it with this content : { message: 'text',
    title: 'text',
    url: null }
  • Go on iOS and share using sms

Expected Behavior

I thought that content will just contain my text.

Code Example

`import React, { Component } from 'react';
import {Share, View, Button} from 'react-native';

export default class Example extends Component {

constructor(props){
    super(props);

}

async link(code){
    if (code !== undefined){

        try {
            const result = await Share.share({
                message: 'Code d\'accès Seezam : '+code,
                title: 'Partage du code d\'accès Sezaam',
                url: null
            }, {
                // Android only:
                dialogTitle: 'Partager votre code',
                subject: 'Partage d\'accès à la box Sezaam'
            });

            if (result.action === Share.sharedAction) {
                if (result.activityType) {
                    console.log('ACTIVITY TYPE :: ',result.activityType);
                    // shared with activity type of result.activityType
                } else {
                    // shared
                }
            } else if (result.action === Share.dismissedAction) {
                // do nothing
            }
        } catch (error) {
            alert(error.message);
        }


    }
}

render() {
    return (
        <View>
            <Button onPress={()=>{this.link(code)}}/>
        </View>
    );
}

}`

Environment

React Native Environment Info:
react-native : 0.58
System:
OS: Linux 4.15 Linux Mint 18.3 (Sylvia)
CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 6.69 GB / 15.55 GB
Shell: 4.3.48 - /bin/bash
Binaries:
Node: 10.8.0 - /usr/local/bin/node
npm: 6.2.0 - /usr/local/bin/npm
SDKs:
Android SDK:
Build Tools: 23.0.3, 25.0.0, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3
API Levels: 21, 23, 24, 25, 26, 27
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1

@kelset
Copy link
Contributor

kelset commented Mar 4, 2019

Which version of react-native are you using? The Env info doesn't show.

Also, I can see that you are relying on https://github.com/react-community/create-react-native-app, which has been archived. You should use Expo-CLI instead.

LMK if the issue still appears with the latest version of React Native.

@antoninleissen
Copy link
Author

I'm using react-native 0.58.

@kelset kelset removed the Platform: Linux Building on Linux. label Mar 4, 2019
@react-native-bot react-native-bot added the Platform: Linux Building on Linux. label Mar 4, 2019
@antoninleissen
Copy link
Author

antoninleissen commented Mar 5, 2019

And i don't find a way to delete this object into my content.

@kelset
Copy link
Contributor

kelset commented Mar 19, 2019

👋 there.

So, I just tried to use your code and it didn't actually work. To get it to a working state I had to change it to:

import * as React from 'react';
import { Button, View, StyleSheet, Share } from 'react-native';

export default class App extends React.Component {
  async link(code) {
    if (code !== undefined) {
      try {
        const result = await Share.share(
          {
            message: "Code d'accès Seezam : " + code,
            title: "Partage du code d'accès Sezaam",
            url: 'string'
          },
          {
            // Android only:
            dialogTitle: 'Partager votre code',
            subject: "Partage d'accès à la box Sezaam"
          }
        );

        if (result.action === Share.sharedAction) {
          if (result.activityType) {
            console.log('ACTIVITY TYPE :: ', result.activityType);
            // shared with activity type of result.activityType
          } else {
            // shared
          }
        } else if (result.action === Share.dismissedAction) {
          // do nothing
        }
      } catch (error) {
        alert(error.message);
      }
    }
  }

  render() {
    return (
      <View style={styles.container}>
        <Button
          title="test"
          onPress={() => {
            this.link('123123');
          }}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    paddingTop: 40,
    backgroundColor: '#ecf0f1'
  }
});

That said, once I got the code to work I couldn't repro your issue with version RN 0.59. I'm going to close this, please provide a new (which means, a react-native init-ed project with the minimal changes that leads to creating the same issue you are reporting) if this still happens to you in RN 0.59.

@kelset kelset closed this as completed Mar 19, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Share Bug Platform: iOS iOS applications. Platform: Linux Building on Linux. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants