title: Hide/Show dynamically created view - React Native
body: <p>As I am working on react native platform, I have achieved many UI and dynamic challenges but here I have multiple view which I am creating dynamically as per the API response like</p>
  
  <p>if data length is 3</p>
  
  <pre><code>for(i=0;i&lt;data.length;i++)
  {
      this.setState({ responseData:
          &lt;View&gt;
              &lt;Text&gt;{data[i].title}&lt;/Text&gt;
              &lt;Text&gt;Click to view more +&lt;/Text&gt;
              &lt;View style={{height: 0}}&gt;
                  &lt;Text&gt;View {i}&lt;/Text&gt;
                  &lt;Text&gt;{data[i].requesttext}&lt;/Text&gt;
                  &lt;Text&gt;{data[i].responsetext}&lt;/Text&gt;
              &lt;/View&gt;
          &lt;/View&gt;
      })
  }
  
  render(
      &lt;View style={styles.maincontainer}&gt;
          {this.state.reponseData}
      &lt;/View&gt;
  )
  
  //Make sure that I have written the above code just for an understanding.
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>--------------------------
  Test Title 1
  Click to view more -
  
      View 0
      this is request
      this is response
  
  --------------------------
  Test Title 2
  Click to view more +
  --------------------------
  Test Title 3
  Click to view more +
  --------------------------
  </code></pre>
  
  <p>Here if I have data length is 3, I am creating 3 views and rendering it. Now my requirement is how can I show or set height auto (as there is no any display none property available in react native) that particular view which I am clicking to view more</p>
  
  <p>Is there anything like id or class for reference to that particular view to set style ?</p>
  
  <p>I have tried <code>refs</code> <a href="https://zhenyong.github.io/react/docs/more-about-refs.html" rel="nofollow noreferrer">Refs to Components</a> but its giving me error something like parent view node etc., and actually I dont know how to use it. </p>
  
  <p>Also setting state is also not possible as this is dynamic.</p>
  
  <p>Please let me know if you are not getting my point, or suggest me anything to accomplish this. Thanks!</p>