Przeglądaj źródła

feat(rnsdk) share bootsrap code with app

factor2
Saúl Ibarra Corretgé 2 lat temu
rodzic
commit
c83c4488bf

+ 5
- 11
react-native-sdk/index.tsx Wyświetl plik

1
 /* eslint-disable lines-around-comment,  no-undef, no-unused-vars  */
1
 /* eslint-disable lines-around-comment,  no-undef, no-unused-vars  */
2
 
2
 
3
-import 'react-native-gesture-handler';
4
-// Apply all necessary polyfills as early as possible
5
-// to make sure anything imported henceforth sees them.
6
-import 'react-native-get-random-values';
7
-import './react/features/mobile/polyfills';
3
+// NB: This import must always come first.
4
+import './react/bootstrap.native';
8
 
5
 
9
 import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
6
 import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
10
 import { View, ViewStyle } from 'react-native';
7
 import { View, ViewStyle } from 'react-native';
12
 import { appNavigate } from './react/features/app/actions.native';
9
 import { appNavigate } from './react/features/app/actions.native';
13
 import { App } from './react/features/app/components/App.native';
10
 import { App } from './react/features/app/components/App.native';
14
 import { setAudioMuted, setVideoMuted } from './react/features/base/media/actions';
11
 import { setAudioMuted, setVideoMuted } from './react/features/base/media/actions';
15
-import JitsiThemePaperProvider from './react/features/base/ui/components/JitsiThemeProvider.native';
16
 
12
 
17
 
13
 
18
 interface IEventListeners {
14
 interface IEventListeners {
117
 
113
 
118
     return (
114
     return (
119
         <View style = { style as ViewStyle }>
115
         <View style = { style as ViewStyle }>
120
-            <JitsiThemePaperProvider>
121
-                <App
122
-                    { ...appProps }
123
-                    ref = { app } />
124
-            </JitsiThemePaperProvider>
116
+            <App
117
+                { ...appProps }
118
+                ref = { app } />
125
         </View>
119
         </View>
126
     );
120
     );
127
 });
121
 });

+ 7
- 0
react/bootstrap.native.js Wyświetl plik

1
+// https://github.com/software-mansion/react-native-gesture-handler/issues/320#issuecomment-443815828
2
+import 'react-native-gesture-handler';
3
+
4
+// Apply all necessary polyfills as early as possible to make sure anything imported henceforth
5
+// sees them.
6
+import 'react-native-get-random-values';
7
+import './features/mobile/polyfills';

+ 15
- 0
react/features/app/components/App.native.tsx Wyświetl plik

12
 import { clientResized, setSafeAreaInsets } from '../../base/responsive-ui/actions';
12
 import { clientResized, setSafeAreaInsets } from '../../base/responsive-ui/actions';
13
 import DimensionsDetector from '../../base/responsive-ui/components/DimensionsDetector.native';
13
 import DimensionsDetector from '../../base/responsive-ui/components/DimensionsDetector.native';
14
 import { updateSettings } from '../../base/settings/actions';
14
 import { updateSettings } from '../../base/settings/actions';
15
+import JitsiThemePaperProvider from '../../base/ui/components/JitsiThemeProvider.native';
15
 import { _getRouteToRender } from '../getRouteToRender.native';
16
 import { _getRouteToRender } from '../getRouteToRender.native';
16
 import logger from '../logger';
17
 import logger from '../logger';
17
 
18
 
89
         logger.info(`Loaded SDK ${AppInfo.sdkVersion}${liteTxt}`);
90
         logger.info(`Loaded SDK ${AppInfo.sdkVersion}${liteTxt}`);
90
     }
91
     }
91
 
92
 
93
+    /**
94
+     * Implements React's {@link Component#render()}.
95
+     *
96
+     * @inheritdoc
97
+     * @returns {ReactElement}
98
+     */
99
+    render() {
100
+        return (
101
+            <JitsiThemePaperProvider>
102
+                { super.render() }
103
+            </JitsiThemePaperProvider>
104
+        );
105
+    }
106
+
92
     /**
107
     /**
93
      * Initializes feature flags and updates settings.
108
      * Initializes feature flags and updates settings.
94
      *
109
      *

+ 3
- 12
react/index.native.js Wyświetl plik

1
-// https://github.com/software-mansion/react-native-gesture-handler/issues/320#issuecomment-443815828
2
-import 'react-native-gesture-handler';
3
-
4
-// Apply all necessary polyfills as early as possible to make sure anything imported henceforth
5
-// sees them.
6
-import 'react-native-get-random-values';
7
-import './features/mobile/polyfills';
1
+// NB: This import must always come first.
2
+import './bootstrap.native';
8
 
3
 
9
 import React, { PureComponent } from 'react';
4
 import React, { PureComponent } from 'react';
10
 import { AppRegistry } from 'react-native';
5
 import { AppRegistry } from 'react-native';
11
 
6
 
12
 import { App } from './features/app/components/App.native';
7
 import { App } from './features/app/components/App.native';
13
 import { _initLogging } from './features/base/logging/functions';
8
 import { _initLogging } from './features/base/logging/functions';
14
-import JitsiThemePaperProvider from './features/base/ui/components/JitsiThemeProvider';
15
 
9
 
16
 /**
10
 /**
17
  * React Native doesn't support specifying props to the main/root component (in
11
  * React Native doesn't support specifying props to the main/root component (in
29
      */
23
      */
30
     render() {
24
     render() {
31
         return (
25
         return (
32
-            <JitsiThemePaperProvider>
33
-                <App
34
-                    { ...this.props } />
35
-            </JitsiThemePaperProvider>
26
+            <App { ...this.props } />
36
         );
27
         );
37
     }
28
     }
38
 }
29
 }

Ładowanie…
Anuluj
Zapisz