-
Notifications
You must be signed in to change notification settings - Fork 52
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
React Native compatibility? #24
Comments
Hello, I don't know how React Native works but for Node.js environment I included a DOM polyfill (https://github.com/rstacruz/jsdom-global). if(typeof module !== 'undefined'){
require('jsdom-global')();
module.exports = gpxParser;
} It's already included in GPXParser but you may need to include it in a different way to make it works with React Native. Fell free to give me the solution if you found it, I will add it to the Readme :) |
Thanks for the quick response :) I figured out it's because React Native's bundler (Metro) uses the One solution might be to remove the if (typeof document != 'undefined') {
// I'm on the web!
}
else if (typeof navigator != 'undefined' && navigator.product == 'ReactNative') {
// I'm in react-native
}
else {
// I'm in node js
} |
Hi, Is there a solution to this at all? I'm having the same issue and I can't find an answer anywhere. |
window.DOMParser is preventing this from working in React Native. Any ideas?
GPXParser.js/src/GPXParser.js
Line 24 in d9c41f7
The text was updated successfully, but these errors were encountered: