showing results for - "swap scroll right in react native"
Joshua
21 Jul 2016
1scrollListToStart(contentWidth, contentHeight) {
2    if (I18nManager.isRTL) {
3        this.scrollView.scrollTo({x: contentWidth});
4    }
5}
6
7render() {
8    let containerStyle = I18nManager.isRTL ? styles.RTLContainer : styles.LTRContainer;
9
10    return (
11        <ScrollView
12            ref={ref => this.scrollView = ref}
13            onContentSizeChange={this.scrollListToStart.bind(this)}
14            horizontal={true}
15            style={[styles.buttonsContainer, containerStyle]}>
16            {this.renderButtons()}
17        </ScrollView>
18    )
19}
20
21
22const styles = StyleSheet.create({
23
24    RTLContainer: {
25        flexDirection: 'row-reverse'
26    },
27
28    LTRContainer: {
29        flexDirection: 'row'
30    }
31})
32