MCPcopy Index your code
hub / github.com/callstack/react-native-pager-view / render

Method render

example/src/PaperExample.tsx:100–163  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98 }
99
100 render() {
101 const { page, pages, animationsAreEnabled } = this.state;
102 return (
103 <SafeAreaView style={styles.container}>
104 <PagerView
105 style={styles.viewPager}
106 initialPage={0}
107 scrollEnabled={this.state.scrollEnabled}
108 onPageScroll={this.onPageScroll}
109 onPageSelected={this.onPageSelected}
110 onPageScrollStateChanged={this.onPageScrollStateChanged}
111 pageMargin={10}
112 orientation="horizontal"
113 ref={this.viewPager}
114 >
115 {pages.map((p) => this.renderPage(p))}
116 </PagerView>
117 <View style={styles.buttons}>
118 <Button
119 text={
120 this.state.scrollEnabled ? 'Scroll Enabled' : 'Scroll Disabled'
121 }
122 onPress={() =>
123 this.setState({ scrollEnabled: !this.state.scrollEnabled })
124 }
125 />
126 <Button text="Add new page" onPress={this.addPage} />
127 <Button text="Remove last page" onPress={this.removeLastPage} />
128 </View>
129 <View style={styles.buttons}>
130 {animationsAreEnabled ? (
131 <Button
132 text="Turn off animations"
133 onPress={() => this.setState({ animationsAreEnabled: false })}
134 />
135 ) : (
136 <Button
137 text="Turn animations back on"
138 onPress={() => this.setState({ animationsAreEnabled: true })}
139 />
140 )}
141 <Text style={styles.scrollStateText}>
142 ScrollState[ {this.state.scrollState} ]
143 </Text>
144 </View>
145 <View style={styles.buttons}>
146 <Button text="Start" onPress={() => this.go(0)} />
147 <Button text="Prev" onPress={() => this.move(-1)} />
148 <Button text="Next" onPress={() => this.move(1)} />
149 <Button text="Last" onPress={() => this.go(pages.length - 1)} />
150 </View>
151 <View style={styles.progress}>
152 <Text style={styles.buttonText}>
153 {' '}
154 Page {page + 1} / {pages.length}{' '}
155 </Text>
156 <ProgressBar
157 numberOfPages={pages.length}

Callers

nothing calls this directly

Calls 1

renderPageMethod · 0.95

Tested by

no test coverage detected