Skip to content

Instantly share code, notes, and snippets.

@rutvikbhatt9
Last active May 28, 2019 05:00
Show Gist options
  • Save rutvikbhatt9/a1982f50bbce1070cd3f6668e0f0d0fc to your computer and use it in GitHub Desktop.
Save rutvikbhatt9/a1982f50bbce1070cd3f6668e0f0d0fc to your computer and use it in GitHub Desktop.
Get Interpolation value for artist profile image top, height and width
//artist profile image position from top
_getImageTopPosition = () => {
const {scrollY} = this.state;
return scrollY.interpolate({
inputRange: [0, 140],
outputRange: [ThemeUtils.relativeHeight(20), Platform.OS === 'ios' ? 8 : 10],
extrapolate: 'clamp',
useNativeDriver: true
});
};
//artist profile image width
_getImageWidth = () => {
const {scrollY} = this.state;
return scrollY.interpolate({
inputRange: [0, 140],
outputRange: [ThemeUtils.relativeWidth(40), ThemeUtils.APPBAR_HEIGHT - 20],
extrapolate: 'clamp',
useNativeDriver: true
});
};
//artist profile image height
_getImageHeight = () => {
const {scrollY} = this.state;
return scrollY.interpolate({
inputRange: [0, 140],
outputRange: [ThemeUtils.relativeWidth(40), ThemeUtils.APPBAR_HEIGHT - 20],
extrapolate: 'clamp',
useNativeDriver: true
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment