Let's build a clear due date button for the EditTask component and only selectively enable it if a due date has been selected for the to-do item. The Button component in React Native should help us render one quickly.
The Button component accepts a couple of props; the following four will be used in our application:
- color: This is a string (or stringified hex) that sets either the text color on iOS or the background color on Android
- disabled: This is a Boolean that disables the button if set to true; it defaults to false
- onPress: This is a callback that is fired when a button is pressed
- title: This is the text to display within the button
A sample Button component can be rendered like this:
<Button
color={ 'blue' }
disabled={ this.state.buttonDisabled }
onPress={ () => alert('Submit button pressed') }
title={ 'Submit' }
/>
Modify EditTask...