Browse Source

rn,invite: fix bottom padding on AddPeopleDialog on Android

master
Saúl Ibarra Corretgé 5 years ago
parent
commit
a9da047d3a

+ 30
- 2
react/features/invite/components/add-people-dialog/native/AddPeopleDialog.js View File

@@ -67,6 +67,11 @@ type Props = AbstractProps & {
67 67
 
68 68
 type State = AbstractState & {
69 69
 
70
+    /**
71
+     * Boolean to show if an extra padding needs to be added to the bottom bar.
72
+     */
73
+    bottomPadding: boolean,
74
+
70 75
     /**
71 76
      * State variable to keep track of the search field value.
72 77
      */
@@ -94,6 +99,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
94 99
     defaultState = {
95 100
         addToCallError: false,
96 101
         addToCallInProgress: false,
102
+        bottomPadding: false,
97 103
         fieldValue: '',
98 104
         inviteItems: [],
99 105
         searchInprogress: false,
@@ -194,9 +200,11 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
194 200
                             </View>
195 201
                             <TextInput
196 202
                                 autoCorrect = { false }
197
-                                autoFocus = { true }
203
+                                autoFocus = { false }
198 204
                                 clearButtonMode = 'always' // iOS only
205
+                                onBlur = { this._onFocused(false) }
199 206
                                 onChangeText = { this._onTypeQuery }
207
+                                onFocus = { this._onFocused(true) }
200 208
                                 placeholder = {
201 209
                                     this.props.t(`inviteDialog.${placeholderKey}`)
202 210
                                 }
@@ -223,7 +231,11 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
223 231
                                 renderItem = { this._renderItem } />
224 232
                         </View>
225 233
                     </SafeAreaView>
226
-                    <SafeAreaView style = { [ styles.bottomBar, _headerStyles.headerOverlay ] }>
234
+                    <SafeAreaView
235
+                        style = { [
236
+                            styles.bottomBar,
237
+                            _headerStyles.headerOverlay,
238
+                            this.state.bottomPadding ? styles.extraBarPadding : null ] }>
227 239
                         { this._renderShareMeetingButton() }
228 240
                     </SafeAreaView>
229 241
                 </KeyboardAvoidingView>
@@ -317,6 +329,22 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
317 329
         return false;
318 330
     }
319 331
 
332
+    _onFocused: boolean => Function;
333
+
334
+    /**
335
+     * Constructs a callback to be used to update the padding of the field if necessary.
336
+     *
337
+     * @param {boolean} focused - True of the field is focused.
338
+     * @returns {Function}
339
+     */
340
+    _onFocused(focused) {
341
+        return () => {
342
+            Platform.OS === 'android' && this.setState({
343
+                bottomPadding: focused
344
+            });
345
+        };
346
+    }
347
+
320 348
     _onInvite: () => void
321 349
 
322 350
     /**

+ 7
- 0
react/features/invite/components/add-people-dialog/native/styles.js View File

@@ -58,6 +58,13 @@ export default {
58 58
         justifyContent: 'flex-start'
59 59
     },
60 60
 
61
+    /**
62
+     * A special padding to avoid issues on some devices (such as Android devices with custom suggestions bar).
63
+     */
64
+    extraBarPadding: {
65
+        paddingBottom: 30
66
+    },
67
+
61 68
     invitedList: {
62 69
         padding: 3
63 70
     },

Loading…
Cancel
Save