@@ -22,6 +22,7 @@ import {
22
22
import AnimatedComponent from '../animation/AnimatedComponent' ;
23
23
import { uploadFile } from '../actions' ;
24
24
import { androidEnsureStoragePermission } from '../lightbox/download' ;
25
+ import type { SpecificIconType } from '../common/Icons' ;
25
26
26
27
type Props = $ReadOnly < { |
27
28
expanded : boolean ,
@@ -74,6 +75,18 @@ export const chooseUploadImageFilename = (uri: string, fileName: string): string
74
75
return nameWithoutPrefix ;
75
76
} ;
76
77
78
+ type MenuButtonProps = $ReadOnly < { |
79
+ onPress : ( ) => void | Promise < void > ,
80
+ IconComponent : SpecificIconType ,
81
+ | } > ;
82
+
83
+ function MenuButton ( props : MenuButtonProps ) {
84
+ const { onPress, IconComponent } = props ;
85
+ const style = useMemo ( ( ) => ( { padding : 12 , marginRight : - 8 , color : BRAND_COLOR } ) , [ ] ) ;
86
+
87
+ return < IconComponent style = { style } size = { 24 } onPress = { onPress } /> ;
88
+ }
89
+
77
90
export default function ComposeMenu ( props : Props ) : Node {
78
91
const { destinationNarrow, insertAttachment, expanded, insertVideoCallLink, onExpandContract } =
79
92
props ;
@@ -220,11 +233,6 @@ export default function ComposeMenu(props: Props): Node {
220
233
padding : 12 ,
221
234
color : BRAND_COLOR ,
222
235
} ,
223
- composeMenuButton : {
224
- padding : 12 ,
225
- marginRight : - 8 ,
226
- color : BRAND_COLOR ,
227
- } ,
228
236
} ) ,
229
237
[ ] ,
230
238
) ;
@@ -241,12 +249,12 @@ export default function ComposeMenu(props: Props): Node {
241
249
>
242
250
< View style = { styles . composeMenu } >
243
251
{ Platform . OS === 'android' && (
244
- < IconAttach style = { styles . composeMenuButton } size = { 24 } onPress = { handleFilesPicker } />
252
+ < MenuButton onPress = { handleFilesPicker } IconComponent = { IconAttach } />
245
253
) }
246
- < IconImage style = { styles . composeMenuButton } size = { 24 } onPress = { handleImagePicker } />
247
- < IconCamera style = { styles . composeMenuButton } size = { 24 } onPress = { handleCameraCapture } />
254
+ < MenuButton onPress = { handleImagePicker } IconComponent = { IconImage } />
255
+ < MenuButton onPress = { handleCameraCapture } IconComponent = { IconCamera } />
248
256
{ insertVideoCallLink !== null ? (
249
- < IconVideo style = { styles . composeMenuButton } size = { 24 } onPress = { insertVideoCallLink } />
257
+ < MenuButton onPress = { insertVideoCallLink } IconComponent = { IconVideo } />
250
258
) : null }
251
259
</ View >
252
260
</ AnimatedComponent >
0 commit comments