Error: Another WebBrowser is already being presented.

Hi!

Please see the error in the title, what is it and how do I fix it? :slight_smile:

The code that generates the error looks as following. I also use the WebBrowser to open up links elsewhere within the app, using the same method.

onBtnPress = async (btn: string): void => {

		let link;

		switch (btn) {
			case "web":
				link = _.get(this.props.poi, "item.properties.hsaVpwWebPage", undefined);
				break;
			case "email":
				const mail = _.get(this.props.poi, "item.properties.hsaVpwWebPage", undefined);
				link = "mailto://" + mail;
				break;
			case "directions":
				const longitude = _.get(this.props.poi, "item.geometry.longitude", undefined);
				const latitude = _.get(this.props.poi, "item.geometry.latitude", undefined);
				const label = _.get(this.props.poi, "item.properties.title", undefined);

				const scheme = Platform.select({ ios: "maps:0,0?q=", android: "geo:0,0?q=" });
				const location = `${latitude},${longitude}`;

				link = Platform.select({
					ios: `${scheme}${label}@${location}`,
					android: `${scheme}${location}(${label})`,
				});

				link = "mailto://" + mail;
				break;
		}

		await WebBrowser.openBrowserAsync(link);
	}

Here is the complete stack trace

[Unhandled promise rejection: Error: Another WebBrowser is already being presented.]
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:155:31 in createErrorFromErrorData
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:104:30 in <unknown>
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:414:12 in MessageQueue.__invokeCallback
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:127:11 in <unknown>
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:314:8 in MessageQueue.__guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:126:9 in MessageQueue.invokeCallbackAndReturnFlushedQueue
* null:null in e
1 Like

Hey @simpel,

Can you try and create a minimal Snack that reproduces this error for us to try on our end?

Cheers,
Adam

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.