title: Out of memory onPress TouchableOpacity, React native
body: <p>I have a component where I display a button when certain conditions are met (based on component state)</p>
  
  <pre><code>{
        this.state.inputTag !== null &amp;&amp; this.state.inputTagFocused ? (
          &lt;TouchableOpacity 
            style = {{backgroundColor : Colors.primary, padding : 15, paddingBottom : 5, paddingTop : 5, borderRadius: 2}}
            onPress = {this.handleAddTags}
          &gt;
            &lt;Text style = {{fontFamily : Fonts.primary, color : Colors.white}}&gt;Add&lt;/Text&gt;
          &lt;/TouchableOpacity&gt;
        ) : null
      }
  </code></pre>
  
  <p>Using TextInput component I am updating the state like this</p>
  
  <pre><code>&lt;TextInput
    style = {{ borderBottomColor : Colors.grey, padding : 15, paddingLeft :0, paddingRight : 0, marginRight : 15}}
    onChange = {(text)=&gt; this.setState({inputTag : text})}
    onFocus = {() =&gt; this.setState({inputTagFocused : true})}
    placeholderTextColor = {Colors.grey}
    ref = {(tags) =&gt; {this.tags = tags}}
    underlineColorAndroid = 'transparent'
    placeholder = 'Add Tags'
    returnKeyType = 'done'
    multiline = {false}
  /&gt;
  </code></pre>
  
  <p>Everything seems to work except when I press the add button the whole app crashes  and after few minutes I get the error of 'out of memory'.</p>
  
  <p>What is causing the issue? and how can I solve it?</p>
  
  <p>the full code can be found <strong><a href="https://snack.expo.io/@tufailra97/onpress-issue-rn" rel="nofollow noreferrer">here</a></strong></p>