Skip to content

PermissionsAndroid request - missing dismiss button for initial dialog (or custom buttons) #19327

Closed
@MarkOSullivan94

Description

@MarkOSullivan94

I seen this had already been reported #13920 but had been closed so reopening this.

The dialog produced when requesting permissions isn't user friendly. There's no option to dismiss the dialog and so may seem confusing to the users.

An quick fix would be to include a dismiss button automatically but an additional field along with 'title' and 'message' called 'button' would be great for having custom text in the button.

Environment

Environment:
OS: Linux 4.4
Node: 9.4.0
Yarn: Not Found
npm: 5.8.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.0.0-beta.5 => 16.0.0-beta.5
react-native: ^0.50.4 => 0.50.4

Steps to Reproduce

Add the following function to your project and call it.

async function requestPermission() {
	if (Platform.OS === "ios") {
		return true;
	}

	try {
		const granted = await PermissionsAndroid.request(
			PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
			{
				title: "Enable Permission",
				message:
					"Message here"
			}
		);
		switch (granted) {
			case PermissionsAndroid.RESULTS.GRANTED:
				return true;
			case PermissionsAndroid.RESULTS.DENIED:
				return false;
			case PermissionsAndroid.RESULTS.NEVER_ASK_AGAIN:
				await doAlert(neverAskAgainTitle, neverAskAgainMessage);
				return false;
		}
	} catch (e) {
		console.log(e);

		// fall through
	}
	return false;
}

Expected Behavior

Expected the dialog to include a dismiss button so they can get to the actual permission dialog.

Actual Behavior

Dialog produced shown below.
screenshot_1526551341

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions