title: React Native - Listview Error getting data on the same screen
body: <p><strong>What I am trying to do:</strong></p>
  
  <p>I am trying to have a page where you can search for particular items, this then sends a request to the API which returns back a set of values based on this search. </p>
  
  <p>Currently, I am using a Listview which does not show until the user has put in their search term and clicked ok. Which once the user has clicked search, the list view is then updated with the reply.</p>
  
  <p><strong>What is happening:</strong></p>
  
  <p>When the user clicks searches, I get the following error:</p>
  
  <blockquote>
    <p>Undefined is not an object (evaluating dataSource.rowIdentities)</p>
  </blockquote>
  
  <p>Here is the code so far:</p>
  
  <pre><code>class Search extends Component {
  
      constructor(props) {
        super(props);
  
        this.state = {
            term: '',
            showResults: false,
            isSearch: false,
            SearchResults: ''
        }
  
        this.ds = new ListView.DataSource({rowHasChanged: (r1, r2) =&gt; r1 !== r2});
        this.state = {
          SearchResults: this.ds.cloneWithRows(["Row 1", "Row 2"]),
        };
      }
  
      onSearchButtonPress() {
  
          this.setState({isSearch: true});
  
      }
  
      _renderCategoryIcon() {
  
  
      }
  
      _renderSearchResults(item) {
  
        return (
            &lt;Text&gt;Hello world&lt;/Text&gt;
  
  
        )
      }
      render() {
  
        if(this.state.isSearch)
        {
            return (
                &lt;ViewContainer&gt;
                  &lt;StatusBarBackground style={{backgroundColor: "#009fe3"}} navigator={this.props.navigator} /&gt;
  
                  &lt;SearchBar
                    placeholder='Search'
                    onChangeText={(text)=&gt; this.setState({term: text})}
                    onSearchButtonPress={this.onSearchButtonPress.bind(this)}
                  /&gt;
  
                  &lt;ListView
                    style={styles.containerView}
                    enableEmptySections={true}
                    horizontal={false}
                    initialListSize={10}
                    dataSource={this.state.SeachResults}
                    automaticallyAdjustContentInsets={false}
                    renderRow={(item) =&gt; { return this._renderSearchResults(item) }} /&gt;
  
                &lt;/ViewContainer&gt;
            );
  
        }else{
  
          return (
            &lt;ViewContainer&gt;
              &lt;StatusBarBackground style={{backgroundColor: "#009fe3"}} navigator={this.props.navigator} /&gt;
  
              &lt;SearchBar
                placeholder='Search'
                onChangeText={(text)=&gt; this.setState({term: text})}
                onSearchButtonPress={this.onSearchButtonPress.bind(this)}
            /&gt;
  
  
            &lt;/ViewContainer&gt;
          )
  
        }
      }
  }
  
  
  const styles = StyleSheet.create({
    title: {
      fontSize:30,
  
    },
  
  });
  </code></pre>