Sharing on iOS 11 leads to duplicated content on "Copy & Paste"
See original GitHub issueIs 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
-
Install iOS 11
-
Create a vanilla React Native app
- Install Create React Native App:
npm install -g create-react-native-app
- Create a new app:
create-react-native-app AwesomeProject
- Launch packager:
cd AwesomeProject && npm start
- Install Create React Native App:
-
Add some UI and trigger a share action:
Share.share({message: "The message", title: "The title", url: "http://facebook.github.io"})
-
Choose “Copy” from the UIActivityViewController
-
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:
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:
- https://stackoverflow.com/questions/46424313/uiactivityviewcontroller-duplicate-url-in-ios-11
- https://stackoverflow.com/questions/46526609/uiactivityviewcontroller-copy-copies-item-twice-on-ios-11
- https://www.reddit.com/r/getnarwhal/comments/6ufqr8/url_duplicated_when_sharing_it_via_copy_on_iphone/
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.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:6 (1 by maintainers)
Top GitHub Comments
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.
Go to the App Store and share an app via copy. You will see it’s a iOS bug.