Adding event handlers 

All the interaction with the user will happen through event handlers in React Native. Depending on the controller, we will have different events which can be triggered. The most common event is onPress, as it will be triggered every time we push a button, a checkbox, or a view in general. Let's add some onPress handlers for all the components which can be pushed in our screen:

/*** ShoppingList.js ***/...render() { return (   <Container>     <Content>       <List>        {this.state.products.map(p => {          return (            <ListItem              key={p.id}              onPress={this._handleProductPress.bind(this, p)}            >              <Body>                <Text style={{ color: p.gotten ? '#bbb' : '#000' }}>                  {p.name}                </Text>              </Body>              <Right>                <CheckBox                  checked={p.gotten} onPress={this._handleProductPress.bind(this, ...

Get React Native Blueprints now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.