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