|
|
@@ -222,13 +222,19 @@ function detectReactNative() {
|
|
222
|
222
|
var match
|
|
223
|
223
|
= navigator.userAgent.match(/\b(react[ \t_-]*native)(?:\/(\S+))?/i);
|
|
224
|
224
|
var version;
|
|
225
|
|
- if (match) {
|
|
|
225
|
+ // If we're debugging React-Native app, it may be treated as Chrome, which
|
|
|
226
|
+ // leads to some bugs.
|
|
|
227
|
+ // So we need to check navigator.product and always return some version
|
|
|
228
|
+ // even if can't get the real one.
|
|
|
229
|
+ if (match || navigator.product === "ReactNative") {
|
|
226
|
230
|
currentBrowser = RTCBrowserType.RTC_BROWSER_REACT_NATIVE;
|
|
227
|
|
- if (match.length > 2) {
|
|
|
231
|
+ if (match && match[2]) {
|
|
228
|
232
|
version = match[2];
|
|
|
233
|
+ } else {
|
|
|
234
|
+ version = "react_native";
|
|
229
|
235
|
}
|
|
230
|
236
|
console.info(
|
|
231
|
|
- "This appears to be " + /* name */ match[1] + ", ver: " + version);
|
|
|
237
|
+ "This appears to be React-Native, ver: " + version);
|
|
232
|
238
|
}
|
|
233
|
239
|
return version;
|
|
234
|
240
|
}
|