Skip to content

Instantly share code, notes, and snippets.

@hgale
Created May 25, 2018 21:09
Show Gist options
  • Save hgale/e92e8fff418c92f486bb68ef93e7c6c3 to your computer and use it in GitHub Desktop.
Save hgale/e92e8fff418c92f486bb68ef93e7c6c3 to your computer and use it in GitHub Desktop.
_defaultRenderScrollComponent = props => {
// if (this._isNestedWithSameOrientation()) {
// return <View {...props} />;
// } else
if (props.onRefresh) {
invariant(
typeof props.refreshing === 'boolean',
'`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `' +
JSON.stringify(props.refreshing) +
'`',
);
return (
<ScrollView
{...props}
refreshControl={
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for
* React. To see the error delete this comment and run Flow. */
<RefreshControl
refreshing={props.refreshing}
onRefresh={props.onRefresh}
progressViewOffset={props.progressViewOffset}
/>
}
/>
);
} else {
return <ScrollView {...props} />;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment