Skip to content

Commit ac8c74f

Browse files
author
Valery Buchinsky
committed
Move on* methods right after lifecycle methods 🎨
1 parent c308dd9 commit ac8c74f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/libraries/ViewPager/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ export default class ViewPager extends PureComponent {
132132
}
133133
}
134134

135+
onPageChanged (page) {
136+
if (this.currentPage !== page) {
137+
this.currentPage = page;
138+
this.props.onPageSelected && this.props.onPageSelected(page);
139+
}
140+
}
141+
142+
onPageScrollStateChanged (state) {
143+
this.props.onPageScrollStateChanged && this.props.onPageScrollStateChanged(state);
144+
}
145+
135146
settlePage (vx) {
136147
if (vx < -MIN_FLING_VELOCITY) {
137148
if (this.currentPage < this.props.pageDataArray.length - 1) {
@@ -192,17 +203,6 @@ export default class ViewPager extends PureComponent {
192203
}
193204
}
194205

195-
onPageChanged (page) {
196-
if (this.currentPage !== page) {
197-
this.currentPage = page;
198-
this.props.onPageSelected && this.props.onPageSelected(page);
199-
}
200-
}
201-
202-
onPageScrollStateChanged (state) {
203-
this.props.onPageScrollStateChanged && this.props.onPageScrollStateChanged(state);
204-
}
205-
206206
scrollByOffset (dx) {
207207
this.scroller.startScroll(this.scroller.getCurrX(), 0, -dx, 0, 0);
208208
}

0 commit comments

Comments
 (0)