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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.