Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix scrolling

ammarahm-edf53ca1b7d447
diff --git a/apps/mobile/src/components/list/index.js b/apps/mobile/src/components/list/index.js
index 0ed2c11a1..1cef1e31a 100644
--- a/apps/mobile/src/components/list/index.js
+++ b/apps/mobile/src/components/list/index.js
@@ -15,6 +15,7 @@ import { Empty } from './empty';
import { Footer } from '../list-items/footer';
import { Header } from '../list-items/headers/header';
import { SectionHeader } from '../list-items/headers/section-header';
+import { tabBarRef } from '../../utils/global-refs';
const renderItems = {
note: NoteWrapper,
@@ -135,6 +136,9 @@ const List = ({
data={_loading ? listData.slice(0, 9) : listData}
renderItem={renderItem}
onScroll={_onScroll}
+ onMomentumScrollEnd={() => {
+ tabBarRef.current?.unlock();
+ }}
initialNumToRender={10}
maxToRenderPerBatch={10}
keyboardShouldPersistTaps="always"
diff --git a/apps/mobile/src/components/tabs/index.js b/apps/mobile/src/components/tabs/index.js
index 2891949ec..d69de56d7 100644
--- a/apps/mobile/src/components/tabs/index.js
+++ b/apps/mobile/src/components/tabs/index.js
@@ -26,6 +26,7 @@ export default class Tabs extends Component {
renderItem = ({ item, index }) => this.props.items[index];
onMoveShouldSetResponder = event => {
+ console.log(this.locked);
if (this.locked) return false;
if (this.responderAllowedScroll) return false;
this.lastOffset = this.scrollOffset;
@@ -36,17 +37,22 @@ export default class Tabs extends Component {
let aOffset = this.props.offsets.a.toFixed(0);
let page0Width = pOffset - aOffset;
+ console.log(this.page, this.currentDrawerState);
if (
(this.page === 0 && !this.currentDrawerState && x > 80 && x < page0Width - 80) ||
- DDS.isLargeTablet() ||
- cOffset > pOffset - 50 ||
- DDS.isSmallTab
+ DDS.isLargeTablet()
) {
this.responderAllowedScroll = false;
this.setScrollEnabled(false);
return false;
}
+ if (cOffset > pOffset - 50 || DDS.isSmallTab) {
+ this.responderAllowedScroll = false;
+ this.setScrollEnabled(false);
+ return false;
+ }
+
this.setScrollEnabled(true);
this.responderAllowedScroll = true;
return false;
@@ -119,6 +125,10 @@ export default class Tabs extends Component {
});
};
+ unlock = () => {
+ this.locked = false;
+ };
+
onTouchEnd = () => {
this.locked = false;
this.responderAllowedScroll = false;
@@ -173,6 +183,7 @@ export default class Tabs extends Component {
scrollEndTimeout = null;
onScrollEnd = () => {
+ console.log('scroll end', this.scrollOffset);
if (this.scrollEndTimeout) {
clearTimeout(this.scrollEndTimeout);
this.scrollEndTimeout = null;