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

Sharing on iOS 11 leads to duplicated content on "Copy & Paste" #16258

Closed
jnbt opened this Issue Oct 9, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@jnbt
Copy link

commented Oct 9, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
  OS:  macOS Sierra 10.12.6
  Node:  7.7.1
  Yarn:  0.27.5
  npm:  4.1.2
  Watchman:  4.7.0
  Xcode:  Xcode 9.0 Build version 9A235
  Android Studio:  2.3 AI-162.4069837

Packages: (wanted => installed)
  react: 16.0.0-alpha.12 => 16.0.0-alpha.12
  react-native: ^0.48.4 => 0.48.4

Steps to Reproduce

  1. Install iOS 11

  2. Create a vanilla React Native app

    1. Install Create React Native App: npm install -g create-react-native-app
    2. Create a new app: create-react-native-app AwesomeProject
    3. Launch packager: cd AwesomeProject && npm start
  3. Add some UI and trigger a share action:

    Share.share({message: "The message", title: "The title", url: "http://facebook.github.io"}) 
    
  4. Choose "Copy" from the UIActivityViewController

  5. Open the "Notes" app and paste the clipboard

Expected Behavior

The URL should not be duplicated

Actual Behavior

The URL is duplicated when the clipboard is pasted

Screenshot:

img_2462

Video capture: https://www.youtube.com/watch?v=i7BuwwNHYqg

Reproducible Demo

Snack: https://snack.expo.io/r1KP-GYhW

Insights

From my findings this is a bug of UIActivityViewController in iOS 11:

Changing the implementation in RCTActionSheetManager.m slightly seems to solve this issue:

Replace [items addObject:URL]; with [items addObject:URL.absoluteString];

solves the issue. For me sharing to other apps (e.g. Facebook) still works. Another option would be to add iOS version checks here or to wait for Apple to fix this problem (might only take some years).

I'm more than happy to provide this little change as a PR.

@ethanneff

This comment has been minimized.

Copy link

commented Oct 13, 2017

Go to the App Store and share an app via copy. You will see it's a iOS bug.

@jnbt

This comment has been minimized.

Copy link
Author

commented Oct 13, 2017

@ethanneff I totally agree.

Sadly users won't get this and blame the app itself. Therefor I was asking if this project is willing to accept a workaround für iOS 11?

@jayasme

This comment has been minimized.

Copy link

commented Oct 13, 2017

It seems only happened in Apple's apps such as SMS and Note

@janicduplessis

This comment has been minimized.

Copy link
Collaborator

commented Oct 13, 2017

If the workaround works and doesn't break any other use cases I think this is fine. Just make sure iOS still detects the URL and it is clickable.

Feel free to open a PR and document the fix since it is a bit of a workaround.

@dlowder-salesforce

This comment has been minimized.

Copy link
Collaborator

commented Oct 28, 2017

Sorry the commit mentioned above is for #16528 ....

@stale

This comment has been minimized.

Copy link

commented Dec 27, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale label Dec 27, 2017

@stale stale bot closed this Jan 3, 2018

@facebook facebook locked as resolved and limited conversation to collaborators Jan 3, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.