@@ -227,6 +227,7 @@ const AppContainer = () => {
227227 const [ shouldScroll , setShouldScroll ] = useState < boolean > ( true ) ;
228228 const [ currentPlaying , setCurrentPlaying ] = useState < string > ( '' ) ;
229229 const [ list , setList ] = useState < ListItem [ ] > ( [ ] ) ;
230+ const [ nbOfRecording , setNumberOfRecording ] = useState < number > ( 0 ) ;
230231 const [ currentPlaybackSpeed , setCurrentPlaybackSpeed ] =
231232 useState < PlaybackSpeedType > ( 1.0 ) ;
232233
@@ -241,6 +242,12 @@ const AppContainer = () => {
241242 } ) ;
242243 } , [ ] ) ;
243244
245+ useEffect ( ( ) => {
246+ getRecordedAudios ( ) . then ( recordedAudios =>
247+ setNumberOfRecording ( recordedAudios . length )
248+ ) ;
249+ } , [ list ] ) ;
250+
244251 const changeSpeed = ( ) => {
245252 setCurrentPlaybackSpeed (
246253 prev =>
@@ -291,20 +298,27 @@ const AppContainer = () => {
291298 < GestureHandlerRootView style = { styles . appContainer } >
292299 < View style = { styles . screenBackground } >
293300 < View style = { styles . container } >
294- < View style = { styles . simformImageContainer } >
301+ < View style = { styles . headerContainer } >
295302 < Image
296303 source = { Icons . simform }
297304 style = { styles . simformImage }
298305 resizeMode = "contain"
299306 />
300307 < Pressable
301- style = { styles . playBackControlPressable }
302- onPress = { handleDeleteRecordings } >
308+ style = { [
309+ styles . deleteRecordingContainer ,
310+ { opacity : nbOfRecording ? 1 : 0.5 } ,
311+ ] }
312+ onPress = { handleDeleteRecordings }
313+ disabled = { ! nbOfRecording } >
303314 < Image
304315 source = { Icons . delete }
305316 style = { styles . buttonImage }
306317 resizeMode = "contain"
307318 />
319+ < Text style = { styles . deleteRecordingTitle } >
320+ { 'Delete recorded audio files' }
321+ </ Text >
308322 </ Pressable >
309323 </ View >
310324 < ScrollView scrollEnabled = { shouldScroll } >
0 commit comments