Browse Source

[RN] Fix full-screen mode when coming back from the background

On Android the status and navigation bars are shown again after coming back from
the background, so enter full-screen mode again if needed.
j8
Saúl Ibarra Corretgé 8 years ago
parent
commit
c57e713696
2 changed files with 14 additions and 5 deletions
  1. 1
    0
      react/features/background/index.js
  2. 13
    5
      react/features/full-screen/middleware.js

+ 1
- 0
react/features/background/index.js View File

@@ -1,2 +1,3 @@
1
+export * from './actionTypes';
1 2
 import './middleware';
2 3
 import './reducer';

+ 13
- 5
react/features/full-screen/middleware.js View File

@@ -3,6 +3,7 @@
3 3
 import { StatusBar } from 'react-native';
4 4
 import { Immersive } from 'react-native-immersive';
5 5
 
6
+import { APP_STATE_CHANGED } from '../background';
6 7
 import {
7 8
     CONFERENCE_FAILED,
8 9
     CONFERENCE_LEFT,
@@ -23,9 +24,20 @@ import { MiddlewareRegistry } from '../base/redux';
23 24
  * @returns {Function}
24 25
  */
25 26
 MiddlewareRegistry.register(store => next => action => {
26
-    let fullScreen;
27
+    let fullScreen = null;
27 28
 
28 29
     switch (action.type) {
30
+    case APP_STATE_CHANGED: {
31
+        // Check if we just came back from the background and reenable full
32
+        // screen mode if necessary.
33
+        if (action.appState === 'active') {
34
+            const conference = store.getState()['features/base/conference'];
35
+
36
+            fullScreen = conference ? !conference.audioOnly : false;
37
+        }
38
+        break;
39
+    }
40
+
29 41
     case CONFERENCE_WILL_JOIN: {
30 42
         const conference = store.getState()['features/base/conference'];
31 43
 
@@ -37,10 +49,6 @@ MiddlewareRegistry.register(store => next => action => {
37 49
     case CONFERENCE_LEFT:
38 50
         fullScreen = false;
39 51
         break;
40
-
41
-    default:
42
-        fullScreen = null;
43
-        break;
44 52
     }
45 53
 
46 54
     if (fullScreen !== null) {

Loading…
Cancel
Save