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

Replaces deprecated Android addDefaultShareMenuItem with setShareState #307

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Property | Description
`navigationBarColor` (String) | Sets the navigation bar color. [`gray`/`#808080`]
`navigationBarDividerColor` (String) | Sets the navigation bar divider color. [`white`/`#FFFFFF`]
`enableUrlBarHiding` (Boolean) | Enables the url bar to hide as the user scrolls down on the page. [`true`/`false`]
`enableDefaultShare` (Boolean) | Adds a default share item to the menu. [`true`/`false`]
`enableShareState` (Boolean) | Sets the share item in the toolbar. Browser default will be used if this is not set. [`true`/`false`]
`animations` (Object) | Sets the start and exit animations. [`{ startEnter, startExit, endEnter, endExit }`]
`headers` (Object) | The data are key/value pairs, they will be sent in the HTTP request headers for the provided url. [`{ 'Authorization': 'Bearer ...' }`]
`forceCloseOnRedirection` (Boolean) | Open Custom Tab in a new task to avoid issues redirecting back to app scheme. [`true`/`false`]
Expand Down Expand Up @@ -205,7 +205,7 @@ import { InAppBrowser } from 'react-native-inappbrowser-reborn'
navigationBarColor: 'black',
navigationBarDividerColor: 'white',
enableUrlBarHiding: true,
enableDefaultShare: true,
enableShareState: true,
forceCloseOnRedirection: false,
// Specify full animation resource identifier(package:anim/name)
// or only resource name(in case of animation bundled with app).
Expand Down Expand Up @@ -324,7 +324,7 @@ import { getDeepLink } from './utilities'
// Android Properties
showTitle: false,
enableUrlBarHiding: true,
enableDefaultShare: false
enableShareState: false
}).then((response) => {
if (
response.type === 'success' &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class RNInAppBrowser {
private static final String KEY_NAVIGATION_BAR_DIVIDER_COLOR = "navigationBarDividerColor";
private static final String KEY_ENABLE_URL_BAR_HIDING = "enableUrlBarHiding";
private static final String KEY_SHOW_PAGE_TITLE = "showTitle";
private static final String KEY_DEFAULT_SHARE_MENU_ITEM = "enableDefaultShare";
private static final String KEY_ENABLE_SHARE_STATE = "enableShareState";
private static final String KEY_FORCE_CLOSE_ON_REDIRECTION = "forceCloseOnRedirection";
private static final String KEY_ANIMATIONS = "animations";
private static final String KEY_HEADERS = "headers";
Expand Down Expand Up @@ -111,9 +111,10 @@ public void open(Context context, final ReadableMap options, final Promise promi
setColor(builder, options, KEY_NAVIGATION_BAR_COLOR, "setNavigationBarColor", "navigation bar");
setColor(builder, options, KEY_NAVIGATION_BAR_DIVIDER_COLOR, "setNavigationBarDividerColor", "navigation bar divider");

if (options.hasKey(KEY_DEFAULT_SHARE_MENU_ITEM) &&
options.getBoolean(KEY_DEFAULT_SHARE_MENU_ITEM)) {
builder.addDefaultShareMenuItem();
if (options.hasKey(KEY_ENABLE_SHARE_STATE)) {
builder.setShareState(
options.getBoolean(KEY_ENABLE_SHARE_STATE) ? CustomTabsIntent.SHARE_STATE_ON : CustomTabsIntent.SHARE_STATE_OFF
);
}
if (options.hasKey(KEY_ANIMATIONS)) {
final ReadableMap animations = options.getMap(KEY_ANIMATIONS);
Expand Down