INNER CODE UNIT · JavaScript
delta
jfilter/react-native-onboarding-swiper · src/index.js:120
const delta = currentX - this._dragStartOffset;
const currentPage = this.props.pages[this.state.currentPage];
const isRTLiOS = I18nManager.isRTL && Platform.OS === 'ios';
// In RTL on iOS, scrolling left (negative delta) means forward
const isForwardDrag = isRTLiOS ? delta < 0 : delta > 0;
if (isForwardDrag && currentPage.canSwipeForward === false) {
this.flatList.scrollToIndex({ index: this.state.currentPage, animated: false });
} else if (!isForwardDrag && delta !== 0 && currentPage.canSwipeBackward === false) {
this.flatList.scrollToIndex({ index: this.state.currentPage, animated: false });
}
};
renderItem = ({ item }) => {
const { image, title, subtitle, backgroundColor, background, isLight: pageLightOverride } = item;
const isLight =
pageLightOverride !== undefined