Skip to content

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

lock list in selection mode

ammarahm-ed9983312f66e8
diff --git a/apps/mobile/src/components/Container/ContainerBottomButton.js b/apps/mobile/src/components/Container/ContainerBottomButton.js
index 02abcdb9a..6d2081505 100644
--- a/apps/mobile/src/components/Container/ContainerBottomButton.js
+++ b/apps/mobile/src/components/Container/ContainerBottomButton.js
@@ -1,10 +1,10 @@
import React, { useEffect } from 'react';
import { Keyboard, Platform, View } from 'react-native';
-import Animated, { Easing, sub } from 'react-native-reanimated';
+import Animated, { Easing } from 'react-native-reanimated';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { notesnook } from '../../../e2e/test.ids';
-import { useSettingStore } from '../../provider/stores';
+import { useSelectionStore, useSettingStore } from '../../provider/stores';
import { editing, getElevation, showTooltip, TOOLTIP_POSITIONS } from '../../utils';
import { normalize, SIZE } from '../../utils/SizeUtils';
import { PressableButton } from '../PressableButton';
@@ -13,6 +13,11 @@ const translateY = new Animated.Value(0);
export const ContainerBottomButton = ({ title, onPress, color = 'accent', shouldShow = false }) => {
const insets = useSafeAreaInsets();
const deviceMode = useSettingStore(state => state.deviceMode);
+ const selectionMode = useSelectionStore(state => state.selectionMode);
+
+ useEffect(() => {
+ animate(selectionMode ? 150 : 0);
+ }, [selectionMode]);
function animate(translate) {
Animated.timing(translateY, {
diff --git a/apps/mobile/src/components/CustomTabs/index.js b/apps/mobile/src/components/CustomTabs/index.js
index 3667a0ec2..8b3c83dd1 100644
--- a/apps/mobile/src/components/CustomTabs/index.js
+++ b/apps/mobile/src/components/CustomTabs/index.js
@@ -20,11 +20,13 @@ export default class CustomTabs extends Component {
this.responderAllowedScroll = false;
this.moved = false;
this.lastOffset = this.props.offsets.a;
+ this.locked = false;
}
renderItem = ({ item, index }) => this.props.items[index];
onMoveShouldSetResponder = event => {
+ if (this.locked) return;
if (this.responderAllowedScroll) return;
this.lastOffset = this.scrollOffset;
// let x = event.nativeEvent.pageX;
@@ -120,12 +122,14 @@ export default class CustomTabs extends Component {
setScrollEnabled = enabled => {
this.scrollEnabled = enabled;
+ this.locked = !enabled;
this.listRef.current?.getNativeScrollRef().setNativeProps({
scrollEnabled: enabled
});
};
onTouchEnd = () => {
+ if (this.locked) return;
this.responderAllowedScroll = false;
this.setScrollEnabled(true);
};
@@ -210,6 +214,7 @@ export default class CustomTabs extends Component {
};
onListTouchEnd = event => {
+ if (this.locked) return;
if (this.lastOffset < 30 && event) {
let width = this.props.dimensions.width;
let px = event.nativeEvent.pageX;
@@ -255,7 +260,7 @@ export default class CustomTabs extends Component {
overScrollMode="never"
maxToRenderPerBatch={100}
keyboardDismissMode="none"
- removeClippedSubviews={Platform.OS === 'android'}
+ removeClippedSubviews={false}
keyboardShouldPersistTaps="always"
showsHorizontalScrollIndicator={false}
disableIntervalMomentum={true}
diff --git a/apps/mobile/src/components/SelectionHeader/index.js b/apps/mobile/src/components/SelectionHeader/index.js
index ffa26c7cd..7715eb955 100644
--- a/apps/mobile/src/components/SelectionHeader/index.js
+++ b/apps/mobile/src/components/SelectionHeader/index.js
@@ -10,6 +10,7 @@ import { db } from '../../utils/database';
import { eOpenMoveNoteDialog, refreshNotesPage } from '../../utils/Events';
import { deleteItems } from '../../utils/functions';
import layoutmanager from '../../utils/layout-manager';
+import { tabBarRef } from '../../utils/Refs';
import { SIZE } from '../../utils/SizeUtils';
import { sleep } from '../../utils/TimeUtils';
import { ActionIcon } from '../ActionIcon';
@@ -27,6 +28,10 @@ export const SelectionHeader = React.memo(({ screen, type, extras }) => {
const insets = useSafeAreaInsets();
+ useEffect(() => {
+ tabBarRef.current?.setScrollEnabled(!selectionMode);
+ }, [selectionMode]);
+
const addToFavorite = async () => {
if (selectedItemsList.length > 0) {
selectedItemsList.forEach(item => {