Browse Source

feat: add column layout to settings fields

master
Bettenbuk Zoltan 5 years ago
parent
commit
8cc9b78e21

+ 20
- 4
react/features/settings/components/native/FormRow.js View File

27
      */
27
      */
28
     label: string,
28
     label: string,
29
 
29
 
30
+    /**
31
+     * One of 'row' (default) or 'column'.
32
+     */
33
+    layout: string,
34
+
30
     /**
35
     /**
31
      * Invoked to obtain translated strings.
36
      * Invoked to obtain translated strings.
32
      */
37
      */
60
      * @returns {ReactElement}
65
      * @returns {ReactElement}
61
      */
66
      */
62
     render() {
67
     render() {
63
-        const { t } = this.props;
68
+        const { layout, t } = this.props;
64
 
69
 
65
         // Some field types need additional props to look good and standardized
70
         // Some field types need additional props to look good and standardized
66
         // on a form.
71
         // on a form.
76
                     <Text
81
                     <Text
77
                         style = { [
82
                         style = { [
78
                             styles.text,
83
                             styles.text,
79
-                            styles.fieldLabelText
84
+                            styles.fieldLabelText,
85
+                            layout === 'column' ? styles.fieldLabelTextColumn : undefined
80
                         ] } >
86
                         ] } >
81
                         { t(this.props.label) }
87
                         { t(this.props.label) }
82
                     </Text>
88
                     </Text>
108
             case 'TextInput':
114
             case 'TextInput':
109
                 return {
115
                 return {
110
                     placeholderTextColor: PLACEHOLDER_COLOR,
116
                     placeholderTextColor: PLACEHOLDER_COLOR,
111
-                    style: styles.textInputField,
117
+                    style: [
118
+                        styles.textInputField,
119
+                        this.props.layout === 'column' ? styles.textInputFieldColumn : undefined
120
+                    ],
112
                     underlineColorAndroid: ANDROID_UNDERLINE_COLOR
121
                     underlineColorAndroid: ANDROID_UNDERLINE_COLOR
113
                 };
122
                 };
114
             }
123
             }
126
      * @returns {Array<Object>}
135
      * @returns {Array<Object>}
127
      */
136
      */
128
     _getRowStyle() {
137
     _getRowStyle() {
138
+        const { fieldSeparator, layout } = this.props;
129
         const rowStyle = [
139
         const rowStyle = [
130
             styles.fieldContainer
140
             styles.fieldContainer
131
         ];
141
         ];
132
 
142
 
133
-        if (this.props.fieldSeparator) {
143
+        if (fieldSeparator) {
134
             rowStyle.push(styles.fieldSeparator);
144
             rowStyle.push(styles.fieldSeparator);
135
         }
145
         }
136
 
146
 
147
+        if (layout === 'column') {
148
+            rowStyle.push(
149
+                styles.fieldContainerColumn
150
+            );
151
+        }
152
+
137
         return rowStyle;
153
         return rowStyle;
138
     }
154
     }
139
 }
155
 }

+ 7
- 3
react/features/settings/components/native/SettingsView.js View File

361
                         label = 'settingsView.profileSection' />
361
                         label = 'settingsView.profileSection' />
362
                     <FormRow
362
                     <FormRow
363
                         fieldSeparator = { true }
363
                         fieldSeparator = { true }
364
-                        label = 'settingsView.displayName'>
364
+                        label = 'settingsView.displayName'
365
+                        layout = 'column'>
365
                         <TextInput
366
                         <TextInput
366
                             autoCorrect = { false }
367
                             autoCorrect = { false }
367
                             onChangeText = { this._onChangeDisplayName }
368
                             onChangeText = { this._onChangeDisplayName }
368
                             placeholder = 'John Doe'
369
                             placeholder = 'John Doe'
369
                             value = { displayName } />
370
                             value = { displayName } />
370
                     </FormRow>
371
                     </FormRow>
371
-                    <FormRow label = 'settingsView.email'>
372
+                    <FormRow
373
+                        label = 'settingsView.email'
374
+                        layout = 'column'>
372
                         <TextInput
375
                         <TextInput
373
                             autoCapitalize = 'none'
376
                             autoCapitalize = 'none'
374
                             autoCorrect = { false }
377
                             autoCorrect = { false }
381
                         label = 'settingsView.conferenceSection' />
384
                         label = 'settingsView.conferenceSection' />
382
                     <FormRow
385
                     <FormRow
383
                         fieldSeparator = { true }
386
                         fieldSeparator = { true }
384
-                        label = 'settingsView.serverURL'>
387
+                        label = 'settingsView.serverURL'
388
+                        layout = 'column'>
385
                         <TextInput
389
                         <TextInput
386
                             autoCapitalize = 'none'
390
                             autoCapitalize = 'none'
387
                             autoCorrect = { false }
391
                             autoCorrect = { false }

+ 30
- 6
react/features/settings/components/native/styles.js View File

1
-import {
2
-    ColorPalette,
3
-    createStyleSheet
4
-} from '../../../base/styles';
1
+import { ColorPalette } from '../../../base/styles';
5
 
2
 
6
 export const ANDROID_UNDERLINE_COLOR = 'transparent';
3
 export const ANDROID_UNDERLINE_COLOR = 'transparent';
7
 export const PLACEHOLDER_COLOR = ColorPalette.lightGrey;
4
 export const PLACEHOLDER_COLOR = ColorPalette.lightGrey;
11
 /**
8
 /**
12
  * The styles of the native components of the feature {@code settings}.
9
  * The styles of the native components of the feature {@code settings}.
13
  */
10
  */
14
-export default createStyleSheet({
11
+export default {
15
     /**
12
     /**
16
      * Standardized style for a field container {@code View}.
13
      * Standardized style for a field container {@code View}.
17
      */
14
      */
22
         paddingHorizontal: 8
19
         paddingHorizontal: 8
23
     },
20
     },
24
 
21
 
22
+    /**
23
+     * * Appended style for column layout fields.
24
+     */
25
+    fieldContainerColumn: {
26
+        alignItems: 'flex-start',
27
+        flexDirection: 'column',
28
+        paddingVertical: 3
29
+    },
30
+
25
     /**
31
     /**
26
      * Standard container for a {@code View} containing a field label.
32
      * Standard container for a {@code View} containing a field label.
27
      */
33
      */
38
         fontSize: TEXT_SIZE
44
         fontSize: TEXT_SIZE
39
     },
45
     },
40
 
46
 
47
+    /**
48
+     * Appended style for column layout fields.
49
+     */
50
+    fieldLabelTextColumn: {
51
+        fontSize: 12
52
+    },
53
+
41
     /**
54
     /**
42
      * Field container style for all but last row {@code View}.
55
      * Field container style for all but last row {@code View}.
43
      */
56
      */
85
         flex: 1,
98
         flex: 1,
86
         fontSize: TEXT_SIZE,
99
         fontSize: TEXT_SIZE,
87
         textAlign: 'right'
100
         textAlign: 'right'
101
+    },
102
+
103
+    /**
104
+     * Appended style for column layout fields.
105
+     */
106
+    textInputFieldColumn: {
107
+        backgroundColor: 'rgb(245, 245, 245)',
108
+        borderRadius: 8,
109
+        marginVertical: 5,
110
+        paddingVertical: 3,
111
+        textAlign: 'left'
88
     }
112
     }
89
-});
113
+};

Loading…
Cancel
Save