Procházet zdrojové kódy

fix: irregular cursor movement in settings

master
Bettenbuk Zoltan před 5 roky
rodič
revize
25b4843327
1 změnil soubory, kde provedl 134 přidání a 23 odebrání
  1. 134
    23
      react/features/settings/components/native/SettingsView.js

+ 134
- 23
react/features/settings/components/native/SettingsView.js Zobrazit soubor

34
 
34
 
35
 type State = {
35
 type State = {
36
 
36
 
37
+    /**
38
+     * State variable for the disable call integration switch.
39
+     */
40
+    disableCallIntegration: boolean,
41
+
42
+    /**
43
+     * State variable for the disable p2p switch.
44
+     */
45
+    disableP2P: boolean,
46
+
47
+    /**
48
+     * State variable for the display name field.
49
+     */
50
+    displayName: string,
51
+
52
+    /**
53
+     * State variable for the email field.
54
+     */
55
+    email: string,
56
+
57
+    /**
58
+     * State variable for the server URL field.
59
+     */
60
+    serverURL: string,
61
+
37
     /**
62
     /**
38
      * Whether to show advanced settings or not.
63
      * Whether to show advanced settings or not.
39
      */
64
      */
40
-    showAdvanced: boolean
65
+    showAdvanced: boolean,
66
+
67
+    /**
68
+     * State variable for the start with audio muted switch.
69
+     */
70
+    startWithAudioMuted: boolean,
71
+
72
+    /**
73
+     * State variable for the start with video muted switch.
74
+     */
75
+    startWithVideoMuted: boolean,
41
 }
76
 }
42
 
77
 
43
 /**
78
 /**
55
      */
90
      */
56
     constructor(props) {
91
     constructor(props) {
57
         super(props);
92
         super(props);
93
+        const {
94
+            disableCallIntegration,
95
+            disableP2P,
96
+            displayName,
97
+            email,
98
+            serverURL,
99
+            startWithAudioMuted,
100
+            startWithVideoMuted
101
+        } = props._settings || {};
58
 
102
 
59
         this.state = {
103
         this.state = {
60
-            showAdvanced: false
104
+            disableCallIntegration,
105
+            disableP2P,
106
+            displayName,
107
+            email,
108
+            serverURL,
109
+            showAdvanced: false,
110
+            startWithAudioMuted,
111
+            startWithVideoMuted
61
         };
112
         };
62
 
113
 
63
         // Bind event handlers so they are only bound once per instance.
114
         // Bind event handlers so they are only bound once per instance.
103
         this._processServerURL(false /* hideOnSuccess */);
154
         this._processServerURL(false /* hideOnSuccess */);
104
     }
155
     }
105
 
156
 
106
-    _onChangeDisplayName: (string) => void;
157
+    /**
158
+     * Callback to update the display name.
159
+     *
160
+     * @param {string} displayName - The new value to set.
161
+     * @returns {void}
162
+     */
163
+    _onChangeDisplayName(displayName) {
164
+        super._onChangeDisplayName(displayName);
165
+        this.setState({
166
+            displayName
167
+        });
168
+    }
107
 
169
 
108
-    _onChangeEmail: (string) => void;
170
+    /**
171
+     * Callback to update the email.
172
+     *
173
+     * @param {string} email - The new value to set.
174
+     * @returns {void}
175
+     */
176
+    _onChangeEmail(email) {
177
+        super._onChangeEmail(email);
178
+        this.setState({
179
+            email
180
+        });
181
+    }
109
 
182
 
110
-    _onChangeServerURL: (string) => void;
183
+    /**
184
+     * Callback to update the server URL.
185
+     *
186
+     * @param {string} serverURL - The new value to set.
187
+     * @returns {void}
188
+     */
189
+    _onChangeServerURL(serverURL) {
190
+        super._onChangeServerURL(serverURL);
191
+        this.setState({
192
+            serverURL
193
+        });
194
+    }
111
 
195
 
112
     _onDisableCallIntegration: (boolean) => void;
196
     _onDisableCallIntegration: (boolean) => void;
113
 
197
 
114
     /**
198
     /**
115
      * Handles the disable call integration change event.
199
      * Handles the disable call integration change event.
116
      *
200
      *
117
-     * @param {boolean} newValue - The new value
201
+     * @param {boolean} disableCallIntegration - The new value
118
      * option.
202
      * option.
119
      * @private
203
      * @private
120
      * @returns {void}
204
      * @returns {void}
121
      */
205
      */
122
-    _onDisableCallIntegration(newValue) {
206
+    _onDisableCallIntegration(disableCallIntegration) {
123
         this._updateSettings({
207
         this._updateSettings({
124
-            disableCallIntegration: newValue
208
+            disableCallIntegration
209
+        });
210
+        this.setState({
211
+            disableCallIntegration
125
         });
212
         });
126
     }
213
     }
127
 
214
 
130
     /**
217
     /**
131
      * Handles the disable P2P change event.
218
      * Handles the disable P2P change event.
132
      *
219
      *
133
-     * @param {boolean} newValue - The new value
220
+     * @param {boolean} disableP2P - The new value
134
      * option.
221
      * option.
135
      * @private
222
      * @private
136
      * @returns {void}
223
      * @returns {void}
137
      */
224
      */
138
-    _onDisableP2P(newValue) {
225
+    _onDisableP2P(disableP2P) {
139
         this._updateSettings({
226
         this._updateSettings({
140
-            disableP2P: newValue
227
+            disableP2P
228
+        });
229
+        this.setState({
230
+            disableP2P
141
         });
231
         });
142
     }
232
     }
143
 
233
 
165
         this.setState({ showAdvanced: !this.state.showAdvanced });
255
         this.setState({ showAdvanced: !this.state.showAdvanced });
166
     }
256
     }
167
 
257
 
168
-    _onStartAudioMutedChange: (boolean) => void;
258
+    /**
259
+     * Callback to update the start with audio muted value.
260
+     *
261
+     * @param {boolean} startWithAudioMuted - The new value to set.
262
+     * @returns {void}
263
+     */
264
+    _onStartAudioMutedChange(startWithAudioMuted) {
265
+        super._onStartAudioMutedChange(startWithAudioMuted);
266
+        this.setState({
267
+            startWithAudioMuted
268
+        });
269
+    }
169
 
270
 
170
-    _onStartVideoMutedChange: (boolean) => void;
271
+    /**
272
+     * Callback to update the start with video muted value.
273
+     *
274
+     * @param {boolean} startWithVideoMuted - The new value to set.
275
+     * @returns {void}
276
+     */
277
+    _onStartVideoMutedChange(startWithVideoMuted) {
278
+        super._onStartVideoMutedChange(startWithVideoMuted);
279
+        this.setState({
280
+            startWithVideoMuted
281
+        });
282
+    }
171
 
283
 
172
     /**
284
     /**
173
      * Processes the server URL. It normalizes it and an error alert is
285
      * Processes the server URL. It normalizes it and an error alert is
199
      * @returns {React$Element}
311
      * @returns {React$Element}
200
      */
312
      */
201
     _renderAdvancedSettings() {
313
     _renderAdvancedSettings() {
202
-        const { _settings } = this.props;
203
-        const { showAdvanced } = this.state;
314
+        const { disableCallIntegration, disableP2P, showAdvanced } = this.state;
204
 
315
 
205
         if (!showAdvanced) {
316
         if (!showAdvanced) {
206
             return (
317
             return (
221
                     label = 'settingsView.disableCallIntegration'>
332
                     label = 'settingsView.disableCallIntegration'>
222
                     <Switch
333
                     <Switch
223
                         onValueChange = { this._onDisableCallIntegration }
334
                         onValueChange = { this._onDisableCallIntegration }
224
-                        value = { _settings.disableCallIntegration } />
335
+                        value = { disableCallIntegration } />
225
                 </FormRow>
336
                 </FormRow>
226
                 <FormRow
337
                 <FormRow
227
                     fieldSeparator = { true }
338
                     fieldSeparator = { true }
228
                     label = 'settingsView.disableP2P'>
339
                     label = 'settingsView.disableP2P'>
229
                     <Switch
340
                     <Switch
230
                         onValueChange = { this._onDisableP2P }
341
                         onValueChange = { this._onDisableP2P }
231
-                        value = { _settings.disableP2P } />
342
+                        value = { disableP2P } />
232
                 </FormRow>
343
                 </FormRow>
233
             </>
344
             </>
234
         );
345
         );
241
      * @returns {React$Element}
352
      * @returns {React$Element}
242
      */
353
      */
243
     _renderBody() {
354
     _renderBody() {
244
-        const { _settings } = this.props;
355
+        const { displayName, email, serverURL, startWithAudioMuted, startWithVideoMuted } = this.state;
245
 
356
 
246
         return (
357
         return (
247
             <SafeAreaView style = { styles.settingsForm }>
358
             <SafeAreaView style = { styles.settingsForm }>
255
                             autoCorrect = { false }
366
                             autoCorrect = { false }
256
                             onChangeText = { this._onChangeDisplayName }
367
                             onChangeText = { this._onChangeDisplayName }
257
                             placeholder = 'John Doe'
368
                             placeholder = 'John Doe'
258
-                            value = { _settings.displayName } />
369
+                            value = { displayName } />
259
                     </FormRow>
370
                     </FormRow>
260
                     <FormRow label = 'settingsView.email'>
371
                     <FormRow label = 'settingsView.email'>
261
                         <TextInput
372
                         <TextInput
264
                             keyboardType = { 'email-address' }
375
                             keyboardType = { 'email-address' }
265
                             onChangeText = { this._onChangeEmail }
376
                             onChangeText = { this._onChangeEmail }
266
                             placeholder = 'email@example.com'
377
                             placeholder = 'email@example.com'
267
-                            value = { _settings.email } />
378
+                            value = { email } />
268
                     </FormRow>
379
                     </FormRow>
269
                     <FormSectionHeader
380
                     <FormSectionHeader
270
                         label = 'settingsView.conferenceSection' />
381
                         label = 'settingsView.conferenceSection' />
277
                             onBlur = { this._onBlurServerURL }
388
                             onBlur = { this._onBlurServerURL }
278
                             onChangeText = { this._onChangeServerURL }
389
                             onChangeText = { this._onChangeServerURL }
279
                             placeholder = { this.props._serverURL }
390
                             placeholder = { this.props._serverURL }
280
-                            value = { _settings.serverURL } />
391
+                            value = { serverURL } />
281
                     </FormRow>
392
                     </FormRow>
282
                     <FormRow
393
                     <FormRow
283
                         fieldSeparator = { true }
394
                         fieldSeparator = { true }
284
                         label = 'settingsView.startWithAudioMuted'>
395
                         label = 'settingsView.startWithAudioMuted'>
285
                         <Switch
396
                         <Switch
286
                             onValueChange = { this._onStartAudioMutedChange }
397
                             onValueChange = { this._onStartAudioMutedChange }
287
-                            value = { _settings.startWithAudioMuted } />
398
+                            value = { startWithAudioMuted } />
288
                     </FormRow>
399
                     </FormRow>
289
                     <FormRow label = 'settingsView.startWithVideoMuted'>
400
                     <FormRow label = 'settingsView.startWithVideoMuted'>
290
                         <Switch
401
                         <Switch
291
                             onValueChange = { this._onStartVideoMutedChange }
402
                             onValueChange = { this._onStartVideoMutedChange }
292
-                            value = { _settings.startWithVideoMuted } />
403
+                            value = { startWithVideoMuted } />
293
                     </FormRow>
404
                     </FormRow>
294
                     <FormSectionHeader
405
                     <FormSectionHeader
295
                         label = 'settingsView.buildInfoSection' />
406
                         label = 'settingsView.buildInfoSection' />

Načítá se…
Zrušit
Uložit