import React, {Component} from 'react'; import {View, Text, Colors, ChipsInput} from 'react-native-ui-lib'; import _ from 'lodash'; export default class ChipsInputScreen extends Component { state = { chips: [{label: 'one'}, {label: 'two'}], chips2: [] }; render() { return ( ChipsInput TO: } onChange={newChips => { _.flow(newChips => _.groupBy(newChips, 'label'), newChips => _.forEach(newChips, group => { if (group.length === 1) { delete group[0].invalid; } else { group[group.length - 1].invalid = true; } }), _.values, _.flatten)(newChips); this.setState({chips: newChips}); }} validate={'required'} validateOnChange validationMessage={'You must add at least one chip'} marginB-10 /> this.setState({chips2: newChips})} maxChips={3} /> ); } }