Switch
Switch is a component that renders a Boolean input and allows the user to toggle back and forth.
With Switch, these are the props that we will use:
onValueChange: This is a callback that is invoked with the new value of the switch when the value changesvalue: This is a Boolean that determines whether the switch is set to its 'on' position or not; it defaults tofalse
A simple Switch component can look like this:
<Switch
onValueChange={ (value) =? this.setState({ toggled: value })}
value={ this.state.toggled }
/> As stated earlier, Switch has two props that are required: its value and a callback to change its value when toggled.
Using this knowledge, let's make changes to the TasksList component so that it passes the completed, due, formattedDate, and text properties of each row to the EditTask component for use.
Then, make additions to the EditTask component so that it:
- Expects the
completed,due,formattedDate, andtextprops as part of itspropTypesdeclaration. - Contains a...