react-native-inappbrowser icon indicating copy to clipboard operation
react-native-inappbrowser copied to clipboard

Replaces deprecated Android addDefaultShareMenuItem with setShareState

Open jezallan opened this issue 4 years ago • 1 comments

PR Checklist

  • [x] The PR title follows our guidelines: https://github.com/proyecto26/react-native-inappbrowser/blob/main/CONTRIBUTING.md#pull-request-process.
  • [ ] There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
  • [ ] All existing tests are passing
  • [ ] Tests for the changes are included

What is the current behavior?

The Android option enableDefaultShare uses a deprecated method setDefaultShareMenuItemEnabled on CustomTabsIntent.

It is not possible to disable the share button with the current option.

What is the new behavior?

This PR replaces the enableDefaultShare option with a new enableShareState option that uses the new setShareState method.

This allows the share button in the toolbar to be enabled or disabled.

BREAKING CHANGES: enableDefaultShare option changed to enableShareState

jezallan avatar Oct 20 '21 14:10 jezallan

@jezallan Hey mate, thanks for your contribution! Can you use Reflection to avoid a BREAKING CHANGE here? Please check out this example: https://github.com/proyecto26/react-native-inappbrowser/blob/develop/android/src/main/java/com/proyecto26/inappbrowser/RNInAppBrowser.java#L95

Let me know what you think! <3

jdnichollsc avatar Aug 03 '22 15:08 jdnichollsc