question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ListView] renderRow pass state to prop

See original GitHub issue

Hi all, I’m trying to set scrollY prop with a state value updated by the onscroll function. Is this the correct way of doing this? I need to pass the scrollY offset to my component. I’m able to get a value on my component but it doesn’t update as I scroll.

renderRow: function (rowData, sectionID, rowID) {
    return (
        <VideoCard key={rowData.id} data={rowData} rowid={rowID} autoplay={this.state.autoplay} scrollY={this.state.contentOffset} navigator={this.props.navigator}/>
    );
},

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yamillcommented, Aug 20, 2015

@arilitan glad it worked! yeah it definitely does take a performance toll - i ended up writing a debounce function.

Like this:


var SearchBox = React.createClass({

  componentWillMount: function () {
     this.delayedCallback = _.debounce(function (event) {
       // `event.target` is accessible now
     }, 1000);
  },

  onChange: function (event) {
    event.persist();
    this.delayedCallback(event);
  },

  render: function () {
    return (
      <input type="search" onChange={this.onChange} />
    );
  }

});

You can read more about this here - http://stackoverflow.com/questions/23123138/perform-debounce-in-react-js

0reactions
arilitancommented, Aug 20, 2015

will try that, thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ListView renderRow pass state to prop - Stack Overflow
I'm trying to set scrollY prop with a state value updated by the onscroll function. Is this the correct way of doing this?...
Read more >
ListView - React Native
renderRow ​ ... Takes a data entry from the data source and its ids and should return a renderable component to be rendered...
Read more >
ListView | React Native By Example - Packt Subscription
The renderRow function takes data from the dataSource of your ListView and returns a component to render for each row of data in...
Read more >
Display a List Using the FlatList Component in React Native
state.isChanged} prop to re-render a FlatList component by updating the value of isChanged property.
Read more >
React Native ListView Component - GeeksforGeeks
Thus, the ListView Component is an abstraction that optimizes the ScrollView Component. Syntax: <ListView dataSource={} renderRow={} />.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found