@@ -14,6 +14,7 @@ import ZulipTextIntl from './ZulipTextIntl';
14
14
import { IconRight } from './Icons' ;
15
15
import type { AppNavigationMethods } from '../nav/AppNavigator' ;
16
16
import { ThemeContext } from '../styles/theme' ;
17
+ import type { SpecificIconType } from './Icons' ;
17
18
18
19
type Item < TKey > = $ReadOnly < { |
19
20
key : TKey ,
@@ -32,6 +33,11 @@ type Item<TKey> = $ReadOnly<{|
32
33
| } > ;
33
34
34
35
type Props < TItemKey > = $ReadOnly < { |
36
+ icon ?: { |
37
+ + Component : SpecificIconType ,
38
+ + color ? : string ,
39
+ | } ,
40
+
35
41
/**
36
42
* Component must be under the stack nav with the selectable-options screen.
37
43
*
@@ -78,7 +84,7 @@ type Props<TItemKey> = $ReadOnly<{|
78
84
export default function InputRowRadioButtons < TItemKey : string | number > (
79
85
props: Props< TItemKey > ,
80
86
): Node {
81
- const { navigation , label , description , valueKey , items , onValueChange , search } = props;
87
+ const { navigation , label , description , valueKey , items , onValueChange , search , icon } = props;
82
88
83
89
const screenKey: string = useRef(`selectable-options-${ randString ( ) } `).current;
84
90
@@ -153,6 +159,11 @@ export default function InputRowRadioButtons<TItemKey: string | number>(
153
159
// https://material.io/design/usability/accessibility.html#layout-and-typography
154
160
minHeight : 48 ,
155
161
} ,
162
+ iconFromProps : {
163
+ textAlign : 'center' ,
164
+ marginRight : 8 ,
165
+ color : icon ?. color ?? themeData . color ,
166
+ } ,
156
167
textWrapper : {
157
168
flex : 1 ,
158
169
flexDirection : 'column' ,
@@ -169,12 +180,13 @@ export default function InputRowRadioButtons<TItemKey: string | number>(
169
180
width : kRightArrowIconSize ,
170
181
} ,
171
182
} ) ,
172
- [ ] ,
183
+ [ themeData , icon ] ,
173
184
) ;
174
185
175
186
return (
176
187
< Touchable onPress = { handleRowPressed } >
177
188
< View style = { styles . wrapper } >
189
+ { ! ! icon && < icon . Component size = { 24 } style = { styles . iconFromProps } /> }
178
190
< View style = { styles . textWrapper } >
179
191
< ZulipTextIntl text = { label } />
180
192
< ZulipTextIntl text = { selectedItem . title } style = { styles . valueTitle } />
0 commit comments