@shoutem/ui 5.2.0 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -57,17 +57,20 @@ class HorizontalPager extends PureComponent {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
onLayoutContainer(event) {
|
|
60
|
-
const { width
|
|
61
|
-
const {
|
|
60
|
+
const { width, height } = event.nativeEvent.layout;
|
|
61
|
+
const {
|
|
62
|
+
width: currentWidth,
|
|
63
|
+
height: currentHeight,
|
|
64
|
+
scrolledToInitialIndex,
|
|
65
|
+
} = this.state;
|
|
62
66
|
|
|
63
|
-
if (
|
|
67
|
+
if (currentWidth === width && currentHeight === height) {
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
this.setState({ width, height }, () => {
|
|
68
|
-
// By checking has the pager scrolled to initial index, we're avoiding
|
|
69
|
-
//
|
|
70
|
-
// swiping to other index
|
|
72
|
+
// By checking has the pager scrolled to initial index, we're avoiding weird issue
|
|
73
|
+
// where pager would scroll back to initial index after swiping to other index
|
|
71
74
|
if (!scrolledToInitialIndex) {
|
|
72
75
|
requestAnimationFrame(() => this.scrollToInitialPage());
|
|
73
76
|
}
|