DamonOehlman / detect-browser

Unpack a browser type and version from the useragent string
MIT License
687 stars 102 forks source link

fix: add non-null version to ReactNativeInfo #172

Open robertjcolley opened 2 years ago

robertjcolley commented 2 years ago

While implementing with amazon-chime-sdk-js, the react-native browser detection caused an error documented in this issue: https://github.com/aws/amazon-chime-sdk-js/issues/1856. This PR adds a default version based on the version here, which gets replaced when they cut a new version

https://github.com/facebook/react-native/blob/09b69036c023ccab47b7c5b950247217bb975686/package.json#L4

robertjcolley commented 2 years ago

RFC: what version should we use here? I figured the ideal version would be to use the actual running react native version, which react native does not expose in the global setup or the navigator setup. In a perfect world, they would be able to set the current running react native version somewhere and we read it in, but I don't think they do that.

robertjcolley commented 2 years ago

I was able to patch in a version to react native like so:

react-native+0.64.2.patch.txt

This begs the question - should I open a PR with React Native to get this detection working from global.process.version so we can use that here? That might be a longer-term solution.