title: Unit testing touch events in react native
body: <p>I am trying to test drive react native code using <a href="http://www.schibsted.pl/2015/10/testing-react-native-components-with-jest/">this</a> guide. The react native is overridden by reactjs to enable shallow rendering and testing using jestjs.</p>
  
  <p>Even though I am able test shallow rendered components (checking its presence and children), I am unable to test touch events.</p>
  
  <pre><code>handleTouch() {
   this.setState({ showDescription: !this.state.showDescription });
  }
  
  
  render() {
  const description = this.state.showDescription ? (&lt;Text style={styles.description}&gt;{this.props.entry.description}&lt;/Text&gt;) : null;
  return (
    &lt;TouchableNativeFeedback onPress={() =&gt; this.handleTouch()}&gt;
      &lt;View style={styles.rowContainer}&gt;
        &lt;View style={styles.row}&gt;
        &lt;/View&gt;
        {description}
      &lt;/View&gt;
    &lt;/TouchableNativeFeedback&gt;
   )
  }
  </code></pre>
  
  <p>I'm trying to test if on touch of <code>TouchableNativeFeedback</code>, <code>description</code> tag is rendered. The reactjs <a href="https://facebook.github.io/react/docs/test-utils.html#simulate">TestUtils</a> provides <code>Simulate</code> but it didn't work. </p>
  
  <p>This is my spec setup:</p>
  
  <pre><code>beforeEach(function() {
      profileView = TestUtils.renderIntoDocument(&lt;ProfileEntryView entry={entry}/&gt;);
      var touchableNativeFeedback = TestUtils.findRenderedComponentWithType(profileView, TouchableNativeFeedback);
      TestUtils.Simulate.onTouchEnd(touchableNativeFeedback);
  });
  </code></pre>
  
  <p>How will I test UI interactions using reactjs <code>TestUtils</code> for react-native?</p>