-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
I have a component that looks something like this:
var ScrollTest = React.createClass({
render() {
return (
<ScrollView onScroll={this.onScroll}>
<View style={{ height: 2000 }} />
</ScrollView>
);
},
onScroll: function(e) {
console.log("Scroll", e)
}
});
Right now I'm only seeing the log message when I start a new scroll action. Is there a way to get that onScroll event to fire on every frame? I want the height of another component to depend on the scroll position of this ScrollView component. (trying to duplicate the behavior you see on the iOS Weather app when you scroll down).
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
vjeux commentedon Feb 4, 2015
Hmm this is weird, you should receive an onScroll event every 200ms
https://phabricator.fb.com/diffusion/FBOBJC/browse/master/Libraries/FBReactKit/js/RKJSModules/Libraries/Components/ScrollViewPropTypes.js;ab0173e350a5d5a542bbbb1af82e36cb9e82609e$27
nick commentedon Feb 6, 2015
If I set a value for
throttleScrollCallbackMS
then it works :-)frantic commentedon Feb 6, 2015
@vjeux - the comment in the code is misleading, looks like we don't default to 200ms. @nick you are right, to receive the event continuously, you have to explicitly tell how often it should fire. The design decision here was driven by perf considerations - we don't want to spam the bridge with commands you are not interested in. If you want to animate something when scrolling, set
throttleScrollCallbackMS
to 16ms or less.vjeux commentedon Feb 7, 2015
Just made a diff internally to add a warning. D1833444 (for tracking purposes)
vjeux commentedon Feb 12, 2015
Warning is now in: dd78b09
cleercode commentedon Mar 28, 2015
I set
throttleScrollCallbackMS={16}
and the warning doesn't show but I seem to still only get one event fired. Also only seeing one event logged in the UIExplorer example.ssssssssssss commentedon Apr 21, 2015
Don't work for listview
nicklockwood commentedon Apr 21, 2015
The throttleScrollCallbacksMS property is now called scrollEventThrottle.
nicklockwood commentedon Apr 21, 2015
Looks like the warning wasn't updated when the property name was changed.
JSONKit usage here may cause serious crash hard to debug(I found the …