title: React Native - Single select in Flatlist
body: <p>I'm trying to make a simple button with text where if a user taps on it, it would change it's colour and text. This button with text is displayed in my <strong>Flatlist</strong> I can now change the text on it if it is tapped, but the problem is the other buttons with text in my <strong>Flatlist</strong> is also changing.</p>
  
  <p>What I'am targeting is to change the single button that will be tapped.</p>
  
  <p>Here's my code.</p>
  
  <pre><code>export default class tables extends Component {
      constructor(props){
          super(props)
          this.state = {
              data: [],
              ...
              toggle: true,
          }
      }
      _onPress() {
          const newState = !this.state.toggle;
          this.setState({ toggle: newState })
      }
      render() {
          const { toggle } = this.state;
          const textValue = toggle?"Available":"Occupied";
          const buttonBg = toggle?"dodgerblue":"white";
          const textColor = toggle?"white":"black";
          return (
              &lt;View&gt;
                  &lt;FlatList
                  ....
                  renderItem = {({ item }) =&gt; 
                      &lt;View&gt;
                          &lt;Text&gt;Table No: { item.tbl_id }&lt;/Text&gt;
  
                          &lt;TouchableHighlight
                          onPress = { () =&gt; this._onPress()}&gt;
                              &lt;Text&gt;{textValue}&lt;/Text&gt;              // Button with text
                          &lt;/TouchableHighlight&gt;
  
                              &lt;View&gt;
                                  &lt;TouchableHighlight
                                  ....&gt;
                                      &lt;Text&gt;DINE-IN&lt;/Text&gt;
                                  &lt;/TouchableHighlight&gt;
  
                                  &lt;TouchableHighlight
                                  ....
                                      &lt;Text&gt;TAKE-OUT&lt;/Text&gt;
                                  &lt;/TouchableHighlight&gt; 
                              &lt;/View&gt;
                      &lt;/View&gt;
                  }
                  /&gt;
              &lt;/View&gt;
          )
      }
  }
  </code></pre>