Button
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 Androiddisabled
: This is a Boolean that disables the button if set totrue
; it defaults tofalse
onPress
: This is a callback that is fired when a button is pressedtitle
: 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
so that it has the following features:
- It contains a Boolean, titled
expanded
, in its state to control the open/closed status of...