<Button titleStyle={{color: "white",fontSize: 14, fontWeight: 500}}
title={recording ? 'Stop Recording' : 'Start Recording'}
onPress={recording ? stopRecording : startRecording}
/>
Let’s say I press the button and the recording starts, how do I stop the recording after 60 seconds if the user hasn’t already pressed the button again to stop the recording?
2
Answers
setTimeout() function is used to start a timer that calls the stopRecording() function after 60 seconds.
clearTimeout() function is used to cancel the timer if the user presses the stop button .