rename methods

This commit is contained in:
ammarahm-ed
2020-12-29 17:19:32 +05:00
parent a5b20792b0
commit ce21da0e2a
4 changed files with 46 additions and 43 deletions

View File

@@ -1,12 +1,9 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import {Keyboard} from 'react-native';
import {ScrollView} from 'react-native';
import { import {
ActivityIndicator, ActivityIndicator,
Clipboard, Clipboard,
Dimensions, Dimensions, Keyboard, ScrollView, TouchableOpacity,
TouchableOpacity, View
View,
} from 'react-native'; } from 'react-native';
import Share from 'react-native-share'; import Share from 'react-native-share';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
@@ -18,7 +15,7 @@ import {
eSendEvent, eSendEvent,
openVault, openVault,
sendNoteEditedEvent, sendNoteEditedEvent,
ToastEvent, ToastEvent
} from '../../services/EventManager'; } from '../../services/EventManager';
import PremiumService from '../../services/PremiumService'; import PremiumService from '../../services/PremiumService';
import Sync from '../../services/Sync'; import Sync from '../../services/Sync';
@@ -28,19 +25,19 @@ import {
COLOR_SCHEME, COLOR_SCHEME,
COLOR_SCHEME_DARK, COLOR_SCHEME_DARK,
COLOR_SCHEME_LIGHT, COLOR_SCHEME_LIGHT,
setColorScheme, setColorScheme
} from '../../utils/Colors'; } from '../../utils/Colors';
import { db } from '../../utils/DB'; import { db } from '../../utils/DB';
import { import {
eOnNewTopicAdded, eOnNewTopicAdded,
eOpenLoginDialog,
eOpenMoveNoteDialog, eOpenMoveNoteDialog,
eShowGetPremium,
refreshNotesPage, refreshNotesPage
} from '../../utils/Events'; } from '../../utils/Events';
import { deleteItems } from '../../utils/functions'; import { deleteItems } from '../../utils/functions';
import { MMKV } from '../../utils/mmkv'; import { MMKV } from '../../utils/mmkv';
import {opacity, ph, pv, SIZE} from '../../utils/SizeUtils'; import { opacity, pv, SIZE } from '../../utils/SizeUtils';
import { timeConverter } from '../../utils/TimeUtils'; import { timeConverter } from '../../utils/TimeUtils';
import { PremiumTag } from '../Premium/PremiumTag'; import { PremiumTag } from '../Premium/PremiumTag';
import { PressableButton } from '../PressableButton'; import { PressableButton } from '../PressableButton';
@@ -489,7 +486,8 @@ export const ActionSheetComponent = ({
}; };
const onScrollEnd = () => { const onScrollEnd = () => {
getRef().current?.childScrollHandler();
getRef().current?.handleChildScrollEnd();
}; };
return ( return (
@@ -697,10 +695,10 @@ export const ActionSheetComponent = ({
) : null} ) : null}
{editing.actionAfterFirstSave.type === 'topic' && {editing.actionAfterFirstSave.type === 'topic' &&
note.notebooks && note.notebooks?.length > 0 &&
note.notebooks.findIndex( note?.notebooks?.findIndex(
(o) => o.id === editing.actionAfterFirstSave.id, (o) => o.topics.indexOf(editing.actionAfterFirstSave.id) > -1,
) ? ( ) > -1 ? (
<PressableButton <PressableButton
type="accent" type="accent"
accentColor="red" accentColor="red"

View File

@@ -9,6 +9,7 @@ import {
eSendEvent, eSendEvent,
eSubscribeEvent, eSubscribeEvent,
eUnSubscribeEvent, eUnSubscribeEvent,
sendNoteEditedEvent,
ToastEvent, ToastEvent,
} from '../../services/EventManager'; } from '../../services/EventManager';
import {db} from '../../utils/DB'; import {db} from '../../utils/DB';
@@ -125,8 +126,10 @@ const MoveNoteComponent = ({close, note, setNote}) => {
if (note && note.id) { if (note && note.id) {
setNote({...db.notes.note(note.id).data}); setNote({...db.notes.note(note.id).data});
sendNoteEditedEvent(note.id);
} }
dispatch({type: Actions.NOTEBOOKS}); dispatch({type: Actions.NOTEBOOKS});
return; return;
} }
@@ -142,6 +145,8 @@ const MoveNoteComponent = ({close, note, setNote}) => {
); );
if (note && note.id) { if (note && note.id) {
setNote({...db.notes.note(note.id).data}); setNote({...db.notes.note(note.id).data});
sendNoteEditedEvent(note.id);
} }
dispatch({type: Actions.NOTEBOOKS}); dispatch({type: Actions.NOTEBOOKS});
}; };
@@ -174,13 +179,13 @@ const MoveNoteComponent = ({close, note, setNote}) => {
<FlatList <FlatList
nestedScrollEnabled={true} nestedScrollEnabled={true}
onScrollEndDrag={() => { onScrollEndDrag={() => {
actionSheetRef.current?.childScrollHandler(); actionSheetRef.current?.handleChildScrollEnd();
}} }}
onMomentumScrollEnd={() => { onMomentumScrollEnd={() => {
actionSheetRef.current?.childScrollHandler(); actionSheetRef.current?.handleChildScrollEnd();
}} }}
onScrollAnimationEnd={() => { onScrollAnimationEnd={() => {
actionSheetRef.current?.childScrollHandler(); actionSheetRef.current?.handleChildScrollEnd();
}} }}
keyboardShouldPersistTaps="always" keyboardShouldPersistTaps="always"
keyboardDismissMode="none" keyboardDismissMode="none"
@@ -315,13 +320,13 @@ const MoveNoteComponent = ({close, note, setNote}) => {
keyboardShouldPersistTaps="always" keyboardShouldPersistTaps="always"
keyboardDismissMode="none" keyboardDismissMode="none"
onScrollEndDrag={() => { onScrollEndDrag={() => {
actionSheetRef.current?.childScrollHandler(); actionSheetRef.current?.handleChildScrollEnd();
}} }}
onMomentumScrollEnd={() => { onMomentumScrollEnd={() => {
actionSheetRef.current?.childScrollHandler(); actionSheetRef.current?.handleChildScrollEnd();
}} }}
onScrollAnimationEnd={() => { onScrollAnimationEnd={() => {
actionSheetRef.current?.childScrollHandler(); actionSheetRef.current?.handleChildScrollEnd();
}} }}
style={{ style={{
width: '90%', width: '90%',

View File

@@ -100,12 +100,12 @@ class PremiumDialog extends React.Component {
<ScrollView <ScrollView
nestedScrollEnabled={true} nestedScrollEnabled={true}
onScrollEndDrag={this.actionSheetRef.current?.childScrollHandler} onScrollEndDrag={this.actionSheetRef.current?.handleChildScrollEnd}
onScrollAnimationEnd={ onScrollAnimationEnd={
this.actionSheetRef.current?.childScrollHandler this.actionSheetRef.current?.handleChildScrollEnd
} }
onMomentumScrollEnd={ onMomentumScrollEnd={
this.actionSheetRef.current?.childScrollHandler this.actionSheetRef.current?.handleChildScrollEnd
} }
style={{ style={{
width: '100%', width: '100%',

View File

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