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

Sending a URL along with a message does not work on IOS, only on Android. #1497

Open
ArthurSimoess opened this issue Jan 17, 2024 · 5 comments
Labels

Comments

@ArthurSimoess
Copy link

ArthurSimoess commented Jan 17, 2024

Hello, I want to share a url along with a message on WhatsApp, but only the message is sent. It works on Android and on IOS it doesn't. Does anyone know how I can get around this?

My code:

  import { useRef } from 'react';
  
  import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
  
  import { captureRef } from 'react-native-view-shot';
  
  import Share from 'react-native-share';
  
  export default function TestShare() {
    const imageRef = useRef(null);
  
    const onSaveImageAsync = async () => {
      try {
        const localUri = await captureRef(imageRef, {
          height: 440,
          quality: 1,
        });
  
        await Share.open({
          url: localUri,
          message: 'Test message',
        });
      } catch (e) {
        console.log(e);
      }
    };
  
    return (
      <>
        <View ref={imageRef} style={{ alignItems: 'center', marginTop: 40 }} collapsable={false}>
          <View style={styles.circle}>
            <Text>TESTE IMAGEM</Text>
          </View>
        </View>
        <TouchableOpacity style={styles.button} onPress={onSaveImageAsync}>
          <Text style={{ color: '#FFFFFF' }}>Share image</Text>
        </TouchableOpacity>
      </>
    );
  }
  
  const styles = StyleSheet.create({
    circle: {
      width: 150,
      height: 150,
      borderRadius: 100,
      padding: 10,
      backgroundColor: 'red',
      marginTop: 30,
      alignItems: 'center',
      justifyContent: 'center',
    },
    button: {
      backgroundColor: 'blue',
      borderColor: '#000000',
      borderRadius: 5,
      width: 100,
      height: 50,
      justifyContent: 'center',
      alignItems: 'center',
      marginTop: 10,
    },
  });
@sourabhkhandelwal099
Copy link

facing the same issue. It share only one at a time, if we use both message and url, only message is shared.

@amhinson
Copy link

amhinson commented Feb 1, 2024

I'm also seeing this when clicking "Copy" from the menu. The url is there on the iOS simulator, but doesn't work on a physical device.

@Pravind21
Copy link

Encountering a similar problem on iOS after testing on real devices, while it functions seamlessly on Android. Seeking assistance—does anyone have a solution or insights to share?

@jpcastilhano
Copy link

Facing the same issue. Im passing this config:

const shareOptions = { 
  message: message, (String)
  url: base64, (String base64 format)
  failOnCancel: false,
};

@akshgods
Copy link

akshgods commented May 2, 2024

same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants