mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
fix: crash due to missing import
This commit is contained in:
@@ -27,6 +27,7 @@ import ActionSheet from '../../components/ActionSheet';
|
||||
import {ActionSheetComponent} from '../../components/ActionSheetComponent';
|
||||
import {VaultDialog} from '../../components/VaultDialog';
|
||||
import NavigationService from '../../services/NavigationService';
|
||||
import {useIsFocused} from 'react-navigation-hooks';
|
||||
const w = Dimensions.get('window').width;
|
||||
const h = Dimensions.get('window').height;
|
||||
|
||||
@@ -39,10 +40,6 @@ let timer = null;
|
||||
let note = {};
|
||||
|
||||
const Editor = ({navigation}) => {
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
// Global State
|
||||
const {colors} = useAppContext();
|
||||
|
||||
@@ -68,6 +65,7 @@ const Editor = ({navigation}) => {
|
||||
let customNote = null;
|
||||
let actionSheet;
|
||||
let show;
|
||||
const isFocused = useIsFocused();
|
||||
// FUNCTIONS
|
||||
|
||||
const post = value => EditorWebView.postMessage(value);
|
||||
@@ -324,6 +322,10 @@ const Editor = ({navigation}) => {
|
||||
EditorWebView.reload();
|
||||
}, [colors]);
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
return DDS.isTab ? (
|
||||
<View
|
||||
style={{
|
||||
|
||||
@@ -9,6 +9,7 @@ import NoteItem from '../../components/NoteItem';
|
||||
import {NotebookItem} from '../../components/NotebookItem';
|
||||
import {FavoritesPlaceHolder} from '../../components/ListPlaceholders';
|
||||
import Container from '../../components/Container';
|
||||
import {useIsFocused} from 'react-navigation-hooks';
|
||||
|
||||
export const Favorites = ({navigation}) => {
|
||||
// Global State
|
||||
@@ -29,10 +30,6 @@ export const Favorites = ({navigation}) => {
|
||||
// Variables
|
||||
let isFocused = useIsFocused();
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
let offsetY = 0;
|
||||
let countUp = 1;
|
||||
let countDown = 0;
|
||||
@@ -58,7 +55,10 @@ export const Favorites = ({navigation}) => {
|
||||
offsetY = y;
|
||||
};
|
||||
// Render
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
return (
|
||||
<Container noBottomButton={true}>
|
||||
<Animatable.View
|
||||
|
||||
@@ -13,6 +13,7 @@ import Container from '../../components/Container';
|
||||
import SelectionHeader from '../../components/SelectionHeader';
|
||||
import SelectionWrapper from '../../components/SelectionWrapper';
|
||||
import {w} from '../../utils/utils';
|
||||
import {useIsFocused} from 'react-navigation-hooks';
|
||||
|
||||
export const Folders = ({navigation}) => {
|
||||
const {
|
||||
@@ -29,10 +30,6 @@ export const Folders = ({navigation}) => {
|
||||
|
||||
let isFocused = useIsFocused();
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
const params = navigation.state.params;
|
||||
let offsetY = 0;
|
||||
let countUp = 0;
|
||||
@@ -55,7 +52,11 @@ export const Folders = ({navigation}) => {
|
||||
}
|
||||
offsetY = y;
|
||||
};
|
||||
console.log('rerendering folders');
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
return (
|
||||
<Container
|
||||
bottomButtonText="Add a new notebook"
|
||||
|
||||
@@ -26,10 +26,6 @@ export const Home = ({navigation}) => {
|
||||
// Variables
|
||||
let isFocused = useIsFocused();
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
let offsetY = 0;
|
||||
let countUp = 1;
|
||||
let countDown = 0;
|
||||
@@ -56,13 +52,7 @@ export const Home = ({navigation}) => {
|
||||
if (searchResult && searchResult.length > 0) {
|
||||
setSearchResults([...searchResult]);
|
||||
} else {
|
||||
ToastEvent.show(
|
||||
'No search results found',
|
||||
'error',
|
||||
3000,
|
||||
() => {},
|
||||
'',
|
||||
);
|
||||
ToastEvent.show('No search results found', 'error', 3000, () => {}, '');
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -99,6 +89,10 @@ export const Home = ({navigation}) => {
|
||||
offsetY = y;
|
||||
};
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
// Render
|
||||
console.log('rerendering home');
|
||||
return (
|
||||
|
||||
@@ -19,10 +19,6 @@ export const Notebook = ({navigation}) => {
|
||||
|
||||
let isFocused = useIsFocused();
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
// State
|
||||
|
||||
// Variables
|
||||
@@ -34,6 +30,10 @@ export const Notebook = ({navigation}) => {
|
||||
|
||||
// Functions
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
// Render
|
||||
return (
|
||||
<Container
|
||||
|
||||
@@ -1,30 +1,12 @@
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
Dimensions,
|
||||
KeyboardAvoidingView,
|
||||
} from 'react-native';
|
||||
import {
|
||||
SIZE,
|
||||
ph,
|
||||
pv,
|
||||
opacity,
|
||||
WEIGHT,
|
||||
onThemeUpdate,
|
||||
clearThemeUpdateListener,
|
||||
} from '../../common/common';
|
||||
import Icon from 'react-native-vector-icons/Feather';
|
||||
import {Header} from '../../components/header';
|
||||
import {Search} from '../../components/SearchInput';
|
||||
import {useForceUpdate} from '../ListsEditor';
|
||||
import {NotesList} from '../../components/NotesList';
|
||||
import {AnimatedSafeAreaView} from '../Home';
|
||||
import {db} from '../../../App';
|
||||
import * as Animatable from 'react-native-animatable';
|
||||
import {useAppContext} from '../../provider/useAppContext';
|
||||
import {w} from '../../utils/utils';
|
||||
import Container from '../../components/Container';
|
||||
import {useIsFocused} from 'react-navigation-hooks';
|
||||
|
||||
export const Notes = ({navigation}) => {
|
||||
const {colors} = useAppContext();
|
||||
@@ -32,14 +14,9 @@ export const Notes = ({navigation}) => {
|
||||
const [margin, setMargin] = useState(200);
|
||||
const [buttonHide, setButtonHide] = useState(false);
|
||||
const [notes, setNotes] = useState([]);
|
||||
const forceUpdate = useForceUpdate();
|
||||
|
||||
let isFocused = useIsFocused();
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
let params = navigation.state ? navigation.state.params : null;
|
||||
let offsetY = 0;
|
||||
let countUp = 0;
|
||||
@@ -47,16 +24,6 @@ export const Notes = ({navigation}) => {
|
||||
let headerHeight = 0;
|
||||
let searchHeight = 0;
|
||||
let marginSet = false;
|
||||
useEffect(() => {
|
||||
onThemeUpdate(() => {
|
||||
forceUpdate();
|
||||
});
|
||||
return () => {
|
||||
clearThemeUpdateListener(() => {
|
||||
forceUpdate();
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!params) {
|
||||
@@ -72,7 +39,10 @@ export const Notes = ({navigation}) => {
|
||||
setNotes(allNotes);
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (!isFocused) {
|
||||
console.log('block rerender');
|
||||
return <></>;
|
||||
} else {
|
||||
return (
|
||||
<Container
|
||||
bottomButtonText="Create a new note"
|
||||
|
||||
@@ -19,7 +19,6 @@ import Icon from 'react-native-vector-icons/Feather';
|
||||
import {Header} from '../../components/header';
|
||||
import {FlatList} from 'react-native-gesture-handler';
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import {AnimatedSafeAreaView} from '../Home';
|
||||
import {useAppContext} from '../../provider/useAppContext';
|
||||
import {useIsFocused} from 'react-navigation-hooks';
|
||||
import Container from '../../components/Container';
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
SafeAreaView,
|
||||
FlatList,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import {SIZE, ph, pv, opacity, WEIGHT} from '../../common/common';
|
||||
import {Text, FlatList, View} from 'react-native';
|
||||
import {SIZE, WEIGHT} from '../../common/common';
|
||||
import Icon from 'react-native-vector-icons/Feather';
|
||||
import {Header} from '../../components/header';
|
||||
import NoteItem from '../../components/NoteItem';
|
||||
@@ -18,6 +12,7 @@ import {ToastEvent, w} from '../../utils/utils';
|
||||
import {TrashPlaceHolder} from '../../components/ListPlaceholders';
|
||||
import Container from '../../components/Container';
|
||||
import SelectionHeader from '../../components/SelectionHeader';
|
||||
import {useIsFocused} from 'react-navigation-hooks';
|
||||
|
||||
export const Trash = ({navigation}) => {
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user