@@ -36,6 +36,7 @@ export type AudioAttachmentProps = {
3636 */
3737export const AudioAttachment = ( props : AudioAttachmentProps ) => {
3838 const [ width , setWidth ] = useState ( 0 ) ;
39+ const [ progressControlTextWidth , setProgressControlTextWidth ] = useState ( 0 ) ;
3940 const [ currentSpeed , setCurrentSpeed ] = useState < number > ( 1.0 ) ;
4041 const soundRef = React . useRef < SoundReturnType | null > ( null ) ;
4142 const {
@@ -228,9 +229,6 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
228229 return (
229230 < View
230231 accessibilityLabel = 'audio-attachment-preview'
231- onLayout = { ( { nativeEvent } ) => {
232- setWidth ( nativeEvent . layout . width ) ;
233- } }
234232 style = { [
235233 styles . container ,
236234 {
@@ -256,19 +254,19 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
256254 < Pause fill = { static_black } height = { 32 } width = { 32 } />
257255 ) }
258256 </ Pressable >
259- < View style = { [ styles . leftContainer , leftContainer ] } >
257+ < View
258+ onLayout = { ( { nativeEvent } ) => {
259+ setWidth ( nativeEvent . layout . width ) ;
260+ } }
261+ style = { [ styles . leftContainer , leftContainer ] }
262+ >
260263 < Text
261264 accessibilityLabel = 'File Name'
262265 numberOfLines = { 1 }
263266 style = { [
264267 styles . filenameText ,
265268 {
266269 color : black ,
267- width :
268- 16 - // 16 = horizontal padding
269- 40 - // 40 = file icon size
270- 24 - // 24 = close icon size
271- 24 , // 24 = internal padding
272270 } ,
273271 I18nManager . isRTL ? { writingDirection : 'rtl' } : { writingDirection : 'ltr' } ,
274272 filenameText ,
@@ -290,7 +288,12 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
290288 uri = { item . file . uri }
291289 />
292290 ) }
293- < Text style = { [ styles . progressDurationText , { color : grey_dark } , progressDurationText ] } >
291+ < Text
292+ onLayout = { ( { nativeEvent } ) => {
293+ setProgressControlTextWidth ( nativeEvent . layout . width ) ;
294+ } }
295+ style = { [ styles . progressDurationText , { color : grey_dark } , progressDurationText ] }
296+ >
294297 { progressDuration }
295298 </ Text >
296299 { ! hideProgressBar && (
@@ -316,7 +319,7 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
316319 onProgressDrag = { handleProgressDrag }
317320 progress = { item . progress as number }
318321 testID = 'progress-control'
319- width = { width / 2 }
322+ width = { width - progressControlTextWidth }
320323 />
321324 ) }
322325 </ View >
@@ -365,50 +368,48 @@ const styles = StyleSheet.create({
365368 fontSize : 14 ,
366369 fontWeight : 'bold' ,
367370 paddingBottom : 12 ,
368- paddingLeft : 8 ,
369371 } ,
370372 leftContainer : {
371373 justifyContent : 'space-around' ,
374+ marginHorizontal : 16 ,
375+ width : '60%' ,
372376 } ,
373377 playPauseButton : {
374378 alignItems : 'center' ,
375379 alignSelf : 'center' ,
376380 borderRadius : 50 ,
377- display : 'flex' ,
378381 elevation : 4 ,
379382 justifyContent : 'center' ,
380- paddingVertical : 2 ,
383+ padding : 2 ,
381384 shadowOffset : {
382385 height : 2 ,
383386 width : 0 ,
384387 } ,
385388 shadowOpacity : 0.23 ,
386389 shadowRadius : 2.62 ,
387- width : 36 ,
388390 } ,
389391 progressControlContainer : { } ,
390392 progressDurationText : {
391393 fontSize : 12 ,
392- paddingLeft : 10 ,
393- paddingRight : 8 ,
394+ marginRight : 4 ,
394395 } ,
395396 rightContainer : {
396- marginLeft : 10 ,
397+ marginLeft : 'auto' ,
397398 } ,
398399 speedChangeButton : {
399400 alignItems : 'center' ,
400401 alignSelf : 'center' ,
401402 borderRadius : 50 ,
402403 elevation : 4 ,
403404 justifyContent : 'center' ,
405+ paddingHorizontal : 10 ,
404406 paddingVertical : 5 ,
405407 shadowOffset : {
406408 height : 2 ,
407409 width : 0 ,
408410 } ,
409411 shadowOpacity : 0.23 ,
410412 shadowRadius : 2.62 ,
411- width : 36 ,
412413 } ,
413414 speedChangeButtonText : {
414415 fontSize : 12 ,
0 commit comments