Expensify / react-native-share-menu

A module for React Native that adds your app to the share menu of the device
MIT License
652 stars 237 forks source link

Update example project #305

Closed lindboe closed 7 months ago

lindboe commented 8 months ago

Why this PR?

This PR replaces the old example app with two new example apps: one to show "basic" share, with both Android and the default, non-customizable iOS share, and "custom", which demos creating a custom react-native UI in the share extension.

These example projects have been created using latest react-native so that it's easier to test changes to the library.

Note:

Additional changes

  1. I copied the existing example where I could, but ran into some bugs with data being undefined (expectedly) causing crashes, so I did alter the code where I needed to in order to avoid crashes.
  2. I updated documentation where I could to reflect current Xcode behavior
  3. I added a new file, IOS_DEBUGGING.md, that should help empower developers to track down any issues they encountering in the share extension
  4. I used metro's new symlinking support instead of the previous modification in use, and also added dev dependencies to the library (and symlinked those in the app) for better editor support when modifying the library a. react-native must be symlinked so that the app's copy and the library's copy are the same, or events won't work
  5. I added a few Swift fixes while debugging an issue with the basic app: a. fixed an issue with NSError that caused Xcode to complain b. Made the code to store data on UserDefaults more consistent across code paths (updated to match here). c. Fixed the issue that text sent in the share extension UI in the "basic" case was not sent, and so the demo code couldn't show extraData

Additional notes:

  1. When previewing the docs with new screenshots files added, they won't render correctly on the PR. This is a long-standing issue with GitHub markdown and PRs.
  2. The custom share extension example does have a bug that has existed for a while: every second share attempt can crash. This should be fixed by https://github.com/Expensify/react-native-share-menu/pull/271.