From 1d90826098bf227c86da47b51ab2f51b387b5fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 19 Jul 2017 10:51:07 +0200 Subject: [PATCH] [RN] Use a more resilient way for testing if we are on React Native navigator.product is read-only, so we don't run into the risk of it being changed. --- react/features/app/middleware.js | 2 +- react/features/base/config/reducer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react/features/app/middleware.js b/react/features/app/middleware.js index 3babf2eb1..bde2c8b6a 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 41cc9ddbc..5eab95f62 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); }