Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[RN] Use a more resilient way for testing if we are on React Native

Saúl Ibarra Corretgé1d90826098bf
diff --git a/react/features/app/middleware.js b/react/features/app/middleware.js
index 3babf2eb12..bde2c8b6a4 100644
--- a/react/features/app/middleware.js
+++ b/react/features/app/middleware.js
@@ -83,7 +83,7 @@ function _navigate({ dispatch, getState }) {
// abstraction. Because of the first point, I'm leaving the second point
// unresolved to attract attention to the fact that the following needs more
// thinking.
- if (navigator.userAgent.match(/react[ \s-]*native/i)) {
+ if (navigator.product === 'ReactNative') {
// Create/destroy the local tracks as needed: create them the first time
// we are going to render an actual route (be that the WelcomePage or
// the Conference).
diff --git a/react/features/base/config/reducer.js b/react/features/base/config/reducer.js
index 41cc9ddbc3..5eab95f622 100644
--- a/react/features/base/config/reducer.js
+++ b/react/features/base/config/reducer.js
@@ -73,7 +73,7 @@ ReducerRegistry.register(
*/
function _getInitialState() {
return (
- navigator.userAgent.match(/react[ \s-]*native/i)
+ navigator.product === 'ReactNative'
? INITIAL_RN_STATE
: INITIAL_NON_RN_STATE);
}