Skip to content
This repository was archived by the owner on Mar 11, 2021. It is now read-only.

Commit 1960fb5

Browse files
committed
overscroll fix + bug fix for children in VueComponentClass
1 parent 44e22a3 commit 1960fb5

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

src/Framework7.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ export declare class Framework7 {
132132

133133
sizeNavbars(): void;
134134

135-
openPanel(side: string): void;
135+
openPanel(animate: boolean): void;
136136

137-
closePanel(side: string): void;
137+
closePanel(animate: boolean): void;
138138

139139
initPageScrollToolbars(pageContainer: HTMLElement | string): void;
140140

src/utils/OverscrollFix.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,29 @@
2828
scrollMap = {}
2929

3030
scrollMap.left = conditionParentUntilTrue(touchTarget, (element: HTMLElement) => {
31-
return element.scrollLeft > 0;
31+
return element.scrollLeft > 0 &&
32+
(window.getComputedStyle(element).overflow !== "hidden") &&
33+
(window.getComputedStyle(element).overflowX !== "hidden");
3234
});
3335

3436
scrollMap.top = conditionParentUntilTrue(touchTarget, (element: HTMLElement) => {
35-
return element.scrollTop > 0;
37+
return element.scrollTop > 0 &&
38+
(window.getComputedStyle(element).overflow !== "hidden") &&
39+
(window.getComputedStyle(element).overflowY !== "hidden");
3640
});
3741

3842
scrollMap.right = conditionParentUntilTrue(touchTarget, (element: HTMLElement) => {
3943
return element.scrollWidth > element.clientWidth &&
40-
element.scrollWidth - element.clientWidth > element.scrollLeft;
44+
element.scrollWidth - element.clientWidth > element.scrollLeft &&
45+
(window.getComputedStyle(element).overflow !== "hidden") &&
46+
(window.getComputedStyle(element).overflowX !== "hidden");
4147
});
4248

4349
scrollMap.bottom = conditionParentUntilTrue(touchTarget, (element: HTMLElement) => {
4450
return element.scrollHeight > element.clientHeight &&
45-
element.scrollHeight - element.clientHeight > element.scrollTop;
51+
element.scrollHeight - element.clientHeight > element.scrollTop &&
52+
(window.getComputedStyle(element).overflow !== "hidden") &&
53+
(window.getComputedStyle(element).overflowY !== "hidden");
4654
});
4755

4856
touchScreenX = e.targetTouches[0].screenX;
@@ -67,7 +75,7 @@
6775
moveScreenX > touchScreenX && scrollMap.left ||
6876
moveScreenY < touchScreenY && scrollMap.bottom ||
6977
moveScreenX < touchScreenX && scrollMap.right ||
70-
moveScreenY > touchScreenY && scrollMap.top
78+
moveScreenY > touchScreenY && scrollMap.top
7179
) {
7280
// You are scrolling either the element or its parent.
7381
// This will not affect document.body scroll.

src/utils/reactify-vue/react-class-creation-and-runtime/VueComponentClass.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as React from 'react';
2+
13
import {camelCase} from 'change-case';
24

35
const handleStateSet = (stateObject, key, value, vueComponent, self) => {
@@ -65,7 +67,7 @@ export const convertVueComponentToClass = (vueComponentObject) => {
6567
Object.defineProperty(vueComponentClass.prototype, '$children', {
6668
get: function () {
6769
const parentElement = this.$el;
68-
return this.children.map((element, index) => {
70+
return React.Children.toArray(this.children).map((element: any, index) => {
6971
return {...element, $el: parentElement.children[index]};
7072
});
7173
},

0 commit comments

Comments
 (0)