Code:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{ this.setState({ isAutoSending: true }); let dt = setInterval(()=>{ this.init() }, 5000); this.setState( { clearTime: dt, isBlinking: true, }, () => { this.startBlinkAnimation(); } ); } startBlinkAnimation = () => { if (this.state.isBlinking) { this.setState({ buttonBackgroundColor: 'red' }); setTimeout(() => { this.setState({ buttonBackgroundColor: 'green' }); setTimeout(this.startBlinkAnimation, 500); }, 500); } }; <Button color={this.state.buttonBackgroundColor} title={'Start'} onPress={() => !this.state.isAutoSending && this.autoStart()}/> You can click the button to see the effect.

Comment