INNER CODE UNIT · JavaScript
ratio
phil-r/react-native-looped-carousel · index.js:325
const ratio = this.offset / width;
const page = direction === 'right' ? Math.ceil(ratio) : Math.floor(ratio);
return this._normalizePageNumber(page);
}
_renderPageInfo = (pageLength) =>
(<View style={[styles.pageInfoBottomContainer, this.props.pageInfoBottomContainerStyle]} pointerEvents="none">
<View style={styles.pageInfoContainer}>
<View
style={[styles.pageInfoPill, { backgroundColor: this.props.pageInfoBackgroundColor }]}
>
<Text
style={[styles.pageInfoText, this.props.pageInfoTextStyle]}
>
{`${this.state.currentPage + 1}${this.props.pageInfoTextSeparator}${pageLength}`}
</Text>
</View>
</View>