Menu._isBrowser returning true on iOS and Android
See original GitHub issueEnvironment
Android and iOS
Description
I’m trying to use the Menu component, but when I tap the button to show the menu, I get the error:
TypeError: node.querySelector is not a function. (In 'node.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')', 'node.querySelector' is undefined)
Looking at the code in Menu.js, I can see that _focusFirstDOMNode
is being called. In fact I tried with a little log statement:
console.log(`In _focusFirstDOMNode and isBrowser is ${this._isBrowser()}`);
And the output of this is true
, i.e. the code thinks it’s in the browser.
I’ve tried this on Android and iOS and get the same result. If I change the definition of _isBrowser
to return false, then everything works.
Can you think of any reason while 'document' in global
might be true? Any work arounds?
Reproducible Demo
I thought perhaps having a web view in the application (albeit not displayed when I’ve got the menu showing was maybe the cause, but when I built a minimal test app with a WebView, that worked fine.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
How can I check if my React-Native app is running in a web ...
@NicholasPfeiffer definitely "web" ; it only returns "ios" if the app runs as actual iOS app. The whole point of React native is...
Read more >Platform | Ionic Platform to Customize Apps to Fit Any Device
Note that the same app can return true for more than one platform name. For example, an app running from an iPad would...
Read more >Browser detection using the user agent - HTTP - MDN Web Docs
Serving different Web pages or services to different browsers is usually a bad idea. The Web is meant to be accessible to everyone, ......
Read more >The Browser Object - WebdriverIO
If you use WebdriverIO in standalone mode the browser object is returned by the remote method. ... isAndroid, Boolean, Indicates an Android session....
Read more >Shield Your Internet History: How to Clear Your Cache on Any ...
With iOS, you have the option to either tap Edit or Clear Browsing Data. With the latter (which is the only option on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also experiencing this issue. Downgrading to 2.15.2 prevented the runtime error, but there are features we need in 2.16.0.
I’m getting the same, more information: it works fine with 2.15.2 but breaks with 2.16.0. So a very recent regression.