mobile: fix lint errors

This commit is contained in:
ammarahm-ed
2022-09-01 16:34:26 +05:00
parent bd3fa871b4
commit d155ae7d77
7 changed files with 29 additions and 50 deletions

View File

@@ -11,6 +11,7 @@ resources/
# mobile
apps/mobile/native/
apps/mobile/__tests__/
apps/mobile/e2e/
# web
apps/web/public/an.js

View File

@@ -320,15 +320,7 @@ export const useEditor = (
loadImages();
}
},
[
commands,
editorId,
isDefaultEditor,
loadContent,
overlay,
postMessage,
reset
]
[commands, isDefaultEditor, loadContent, overlay, postMessage, reset]
);
const loadImages = () => {

View File

@@ -21,16 +21,11 @@ import React, { useEffect, useRef, useState } from "react";
import { View } from "react-native";
import { TextInput } from "react-native-gesture-handler";
import { IconButton } from "../../components/ui/icon-button";
import {
eSubscribeEvent,
eUnSubscribeEvent,
ToastEvent
} from "../../services/event-manager";
import { ToastEvent } from "../../services/event-manager";
import Navigation from "../../services/navigation";
import SearchService from "../../services/search";
import { useSearchStore } from "../../stores/use-search-store";
import { useThemeStore } from "../../stores/use-theme-store";
import { eScrollEvent } from "../../utils/events";
import { SIZE } from "../../utils/size";
import { sleep } from "../../utils/time";
export const SearchBar = () => {
@@ -55,14 +50,6 @@ export const SearchBar = () => {
});
}, []);
const onScroll = (event) => {};
useEffect(() => {
eSubscribeEvent(eScrollEvent, onScroll);
return () => {
eUnSubscribeEvent(eScrollEvent, onScroll);
};
}, []);
const onChangeText = (value) => {
setValue(value);
search(value);

View File

@@ -67,13 +67,6 @@ import { SettingSection } from "./types";
import { getTimeLeft } from "./user-section";
import { getVersion } from "react-native-device-info";
const format = (ver: number) => {
const parts = ver.toString().split("");
return `v${parts[0]}.${parts[1]}.${
parts[2]?.startsWith("0") ? "" : parts[2]
}${!parts[3] ? "" : parts[3]} `;
};
export const settingsGroups: SettingSection[] = [
{
id: "account",

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { AppState, Dimensions, NativeModules, Platform } from "react-native";
import { Dimensions, NativeModules, Platform } from "react-native";
import {
beginBackgroundTask,
endBackgroundTask

View File

@@ -48,7 +48,8 @@ export const Search = ({ close, getKeyboardHeight, quicknote }) => {
const insets =
Platform.OS === "android"
? { top: StatusBar.currentHeight }
: useSafeAreaInsets();
: // eslint-disable-next-line react-hooks/rules-of-hooks
useSafeAreaInsets();
const onSelectItem = async (item) => {
if (item.locked) {

View File

@@ -48,6 +48,7 @@ import { getElevation } from "../app/utils";
import { eOnLoadNote } from "../app/utils/events";
import { Search } from "./search";
import { useShareStore } from "./store";
import { useCallback } from "react";
const getLinkPreview = (url) => {
return getPreviewData(url, 5000);
};
@@ -207,7 +208,8 @@ const ShareView = ({ quicknote = false }) => {
const insets =
Platform.OS === "android"
? { top: StatusBar.currentHeight }
: useSafeAreaInsets();
: // eslint-disable-next-line react-hooks/rules-of-hooks
useSafeAreaInsets();
const [showSearch, setShowSearch] = useState(false);
const [kh, setKh] = useState(0);
const editorRef = useRef();
@@ -251,7 +253,7 @@ const ShareView = ({ quicknote = false }) => {
return note;
};
const loadData = async () => {
const loadData = useCallback(async () => {
try {
defaultNote.content.data = null;
setNote({ ...defaultNote });
@@ -282,7 +284,7 @@ const ShareView = ({ quicknote = false }) => {
console.error(e);
}
setLoadingIntent(false);
};
}, [onLoad]);
useEffect(() => {
(async () => {
@@ -291,7 +293,7 @@ const ShareView = ({ quicknote = false }) => {
loadData();
useShareStore.getState().restoreAppendNote();
})();
}, []);
}, [loadData]);
const close = async () => {
setNote({ ...defaultNote });
@@ -304,20 +306,23 @@ const ShareView = ({ quicknote = false }) => {
}
};
const onLoad = (editor) => {
if (editor) {
Storage.write("shareExtensionOpened", "opened");
return loadData();
}
eSendEvent(eOnLoadNote + "shareEditor", {
id: null,
content: {
type: "tiptap",
data: noteContent.current
},
forced: true
});
};
const onLoad = useCallback(
(editor) => {
if (editor) {
Storage.write("shareExtensionOpened", "opened");
return loadData();
}
eSendEvent(eOnLoadNote + "shareEditor", {
id: null,
content: {
type: "tiptap",
data: noteContent.current
},
forced: true
});
},
[loadData]
);
const onPress = async () => {
setLoading(true);