Skip to content

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

@jnbt

Description

@jnbt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help Wanted :octocat:Issues ideal for external contributors.Issue: Author Provided ReproThis issue can be reproduced in Snack or an attached project.Platform: iOSiOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions