-
Notifications
You must be signed in to change notification settings - Fork 940
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
Make it works on React Native #460
Conversation
make it works on React Native
We just had an issue with this in our React-Native project. I manually implemented your change in this PR and it worked for me. |
@@ -40,7 +40,7 @@ function useColors() { | |||
// NB: In an Electron preload script, document will be defined but not fully | |||
// initialized. Since we know we're in Chrome, we'll just detect this case | |||
// explicitly | |||
if (window && window.process && window.process.type === 'renderer') { | |||
if (window && window.process && window.process.type === 'renderer' || !window.document) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really the best feature-detection for react-native
though? Seems fragile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we can do navigator.product === 'ReactNative'
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the point wasn't just to detect react-native, but to detect a lack of window.document
which is used in the next part of the check.
I'm guessing #462 fixes this so it should be closed? |
I believe fixed #462. Closing |
Hi, how exactly would this work? I'm not able to see the logs on the browser running the React Native debugger. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with @TooTallNate, seems wrong. I'm very skeptical of adding these sorts of checks because platforms should be providing a standardized way to do this.
No description provided.