scroll fix

This commit is contained in:
ammarahm-ed
2020-12-19 14:26:44 +05:00
parent f3d5ac4808
commit f52de3fa42
5 changed files with 35 additions and 19 deletions

View File

@@ -17,12 +17,12 @@ const ActionSheetWrapper = ({
const [state] = useTracked(); const [state] = useTracked();
const {colors} = state; const {colors} = state;
const largeTablet = DDS.isLargeTablet(); const largeTablet = DDS.isLargeTablet();
const smallTablet = DDS.isTab;
const style = React.useMemo(() => { const style = React.useMemo(() => {
return { return {
width: largeTablet ? 500 : '100%', width: largeTablet || smallTablet ? 500 : '100%',
minHeight: largeTablet ? 100 : null, maxHeight: largeTablet ? 500 : '100%',
maxHeight: largeTablet ? 500 : '90%',
borderTopRightRadius: 10, borderTopRightRadius: 10,
borderTopLeftRadius: 10, borderTopLeftRadius: 10,
backgroundColor: colors.bg, backgroundColor: colors.bg,

View File

@@ -57,6 +57,7 @@ export const ActionSheetComponent = ({
hasTags = false, hasTags = false,
rowItems = [], rowItems = [],
columnItems = [], columnItems = [],
getRef,
}) => { }) => {
const [state, dispatch] = useTracked(); const [state, dispatch] = useTracked();
const {colors, premiumUser, user} = state; const {colors, premiumUser, user} = state;
@@ -511,8 +512,16 @@ export const ActionSheetComponent = ({
} }
}; };
const onScrollEnd = () => {
getRef().current?.childScrollHandler();
};
return ( return (
<ScrollView <ScrollView
nestedScrollEnabled
onScrollEndDrag={onScrollEnd}
onScrollAnimationEnd={onScrollEnd}
onMomentumScrollEnd={onScrollEnd}
onLayout={() => { onLayout={() => {
if (!item.dateDeleted) { if (!item.dateDeleted) {
localRefresh(item.type, true); localRefresh(item.type, true);
@@ -523,7 +532,7 @@ export const ActionSheetComponent = ({
backgroundColor: colors.bg, backgroundColor: colors.bg,
paddingHorizontal: 0, paddingHorizontal: 0,
borderBottomRightRadius: DDS.isLargeTablet() ? 10 : 1, borderBottomRightRadius: DDS.isLargeTablet() ? 10 : 1,
borderBottomLeftRadius:DDS.isLargeTablet()? 10 : 1 borderBottomLeftRadius: DDS.isLargeTablet() ? 10 : 1,
}}> }}>
<TouchableOpacity <TouchableOpacity
style={{ style={{

View File

@@ -301,7 +301,6 @@ export class DialogManager extends Component {
render() { render() {
let {colors} = this.props; let {colors} = this.props;
let {actionSheetData, item, simpleDialog} = this.state; let {actionSheetData, item, simpleDialog} = this.state;
console.log(DDS.isLargeTablet())
return ( return (
<> <>
{!this.state.actionSheetVisible ? null : ( {!this.state.actionSheetVisible ? null : (
@@ -319,6 +318,7 @@ export class DialogManager extends Component {
setWillRefresh={(value) => { setWillRefresh={(value) => {
this.willRefresh = true; this.willRefresh = true;
}} }}
getRef={() => this.actionSheet}
hasColors={actionSheetData.colors} hasColors={actionSheetData.colors}
hasTags={actionSheetData.colors} hasTags={actionSheetData.colors}
overlayColor={ overlayColor={

View File

@@ -5,27 +5,25 @@ import {
ScrollView, ScrollView,
TextInput, TextInput,
TouchableOpacity, TouchableOpacity,
View, View
} from 'react-native'; } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { notesnook } from '../../../e2e/test.ids'; import { notesnook } from '../../../e2e/test.ids';
import { useTracked } from '../../provider'; import { useTracked } from '../../provider';
import { Actions } from '../../provider/Actions'; import { Actions } from '../../provider/Actions';
import {DDS} from '../../services/DeviceDetection';
import { import {
eSendEvent, eSendEvent,
eSubscribeEvent, eSubscribeEvent,
eUnSubscribeEvent, eUnSubscribeEvent,
ToastEvent, ToastEvent
} from '../../services/EventManager'; } from '../../services/EventManager';
import { db } from '../../utils/DB'; import { db } from '../../utils/DB';
import { import {
eOnNewTopicAdded, eOnNewTopicAdded,
eOpenMoveNoteDialog, eOpenMoveNoteDialog,
refreshNotesPage, refreshNotesPage
} from '../../utils/Events'; } from '../../utils/Events';
import { pv, SIZE, WEIGHT } from '../../utils/SizeUtils'; import { pv, SIZE, WEIGHT } from '../../utils/SizeUtils';
import ActionSheet from '../ActionSheet';
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
import DialogHeader from '../Dialog/dialog-header'; import DialogHeader from '../Dialog/dialog-header';
import { PressableButton } from '../PressableButton'; import { PressableButton } from '../PressableButton';

View File

@@ -206,6 +206,15 @@ const RestoreDataComponent = ({close, setRestoring, restoring}) => {
<ScrollView <ScrollView
nestedScrollEnabled nestedScrollEnabled
onScrollEndDrag={() => {
actionSheetRef.current?.childScrollHandler();
}}
onMomentumScrollEnd={() => {
actionSheetRef.current?.childScrollHandler();
}}
onScrollAnimationEnd={() => {
actionSheetRef.current?.childScrollHandler();
}}
style={{ style={{
paddingHorizontal: 12, paddingHorizontal: 12,
}}> }}>