Skip to content

Instantly share code, notes, and snippets.

@ranveerching
Last active October 14, 2020 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranveerching/63c06caf5880427ddb2cb487a5246f29 to your computer and use it in GitHub Desktop.
Save ranveerching/63c06caf5880427ddb2cb487a5246f29 to your computer and use it in GitHub Desktop.
export const listItems = new Array(100).fill(null).map((_, index) => {
return {
id: index,
title: `Title ${index + 1}`
}
});
export const onTabPress = (navigation, route) => {
if (navigation?.isFocused?.()) {
route?.params?.scrollToTop?.();
}
};
export const scrollToTop = (navigation, ref) => {
navigation.setParams({
scrollToTop: () => ref?.current?.scrollToOffset(0, 0, true)
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment