Guest User

Untitled

a guest
May 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <ScrollView horizontal={true} showsHorizontalScrollIndicator={false}>
  2. <Tag onChange={() => this.handleAbility('Hell')} style={{ marginRight: 7 }}> Hell </Tag>
  3. {this.state.abilities.map(function (ability) {
  4. return <Tag onChange={() =>this.handleAbility(ability.label)} style={{ marginRight: 7 }}> {ability.label} </Tag>
  5. })}
  6. </ScrollView>
  7.  
  8. handleAbility = (label) => {
  9. let character = Object.assign({}, this.state.character);
  10. if (character.abilities.indexOf(label) == -1) {
  11. character.abilities.push(label);
  12. this.setState({ character });
  13. } else {
  14. character.abilities.pop();
  15. this.setState({ character });
  16. }
  17. }
Add Comment
Please, Sign In to add comment