From 9023ab1e79f94a915ed9c507d4e96ce513c33e58 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Sun, 19 Jan 2020 21:31:26 +0500 Subject: [PATCH] minor fixes --- .../src/components/ActionSheetComponent/index.js | 2 +- apps/mobile/src/components/AddTopicDialog/index.js | 14 ++------------ apps/mobile/src/components/DialogManager/index.js | 5 +++++ apps/mobile/src/components/NotesList/index.js | 5 ++++- apps/mobile/src/views/Home/index.js | 5 +++-- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js index c3e988f1f..78d64e026 100644 --- a/apps/mobile/src/components/ActionSheetComponent/index.js +++ b/apps/mobile/src/components/ActionSheetComponent/index.js @@ -216,7 +216,7 @@ export const ActionSheetComponent = ({ func: () => { db.restoreItem(item.dateCreated); ToastEvent.show( - item.type == 'note' ? 'Note restored' : 'Notebook restored', + item.type === 'note' ? 'Note restored' : 'Notebook restored', 'success', 1000, () => {}, diff --git a/apps/mobile/src/components/AddTopicDialog/index.js b/apps/mobile/src/components/AddTopicDialog/index.js index 54cc86bf4..9f1365859 100644 --- a/apps/mobile/src/components/AddTopicDialog/index.js +++ b/apps/mobile/src/components/AddTopicDialog/index.js @@ -3,7 +3,7 @@ import {Modal, Text, TouchableOpacity, View} from 'react-native'; import {TextInput} from 'react-native-gesture-handler'; import Icon from 'react-native-vector-icons/Feather'; import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common'; -import {useTracked} from '../../provider'; + import {getElevation, ToastEvent} from '../../utils/utils'; export class AddTopicDialog extends React.Component { @@ -40,7 +40,7 @@ export class AddTopicDialog extends React.Component { } render() { - const {visible} = this.state; + const {visible, titleFocused} = this.state; const {colors, toEdit} = this.props; return ( @@ -184,13 +184,3 @@ export class AddTopicDialog extends React.Component { ); } } - -export const AddTopicDialog = ({ - visible, - close = () => {}, - notebookID, - toEdit = null, -}) => { - const [state, dispatch] = useTracked(); - const {colors} = state; -}; diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js index c936a24e9..c5ca6eb7d 100644 --- a/apps/mobile/src/components/DialogManager/index.js +++ b/apps/mobile/src/components/DialogManager/index.js @@ -246,21 +246,26 @@ export class DialogManager extends Component { switch (this.show) { case 'delete': { this._showSimpleDialog(TEMPLATE_DELETE(this.state.item.type)); + break; } case 'lock': { this._showVaultDialog(); + break; } case 'unlock': { this.setState({ isPerm: true, }); this._showVaultDialog(); + break; } case 'notebook': { this.showAddNotebook(); + break; } case 'topic': { this.showAddTOpic(); + break; } } } diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.js index 4baa531b1..afbb20758 100644 --- a/apps/mobile/src/components/NotesList/index.js +++ b/apps/mobile/src/components/NotesList/index.js @@ -7,7 +7,8 @@ import {w} from '../../utils/utils'; import {NotesPlaceHolder} from '../ListPlaceholders'; import NoteItem from '../NoteItem'; import SelectionWrapper from '../SelectionWrapper'; - +import PullToRefresh from '../PullToRefresh'; +let sectionListRef; export const NotesList = ({ onScroll, isSearch = false, @@ -42,6 +43,7 @@ export const NotesList = ({ const _onScroll = event => { if (!event) return; + y = event.nativeEvent.contentOffset.y; onScroll(y); }; @@ -147,6 +149,7 @@ export const NotesList = ({ return isGrouped && !isSearch ? ( (sectionListRef = ref)} sections={notes} keyExtractor={_listKeyExtractor} renderSectionHeader={_renderSectionHeader} diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js index 0949ab2c0..ba901dc48 100755 --- a/apps/mobile/src/views/Home/index.js +++ b/apps/mobile/src/views/Home/index.js @@ -1,5 +1,5 @@ import React, {useEffect, useState} from 'react'; -import {SafeAreaView} from 'react-native'; +import {SafeAreaView, View} from 'react-native'; import * as Animatable from 'react-native-animatable'; import {db} from '../../../App'; import Container from '../../components/Container'; @@ -11,6 +11,7 @@ import {ACTIONS, useTracked} from '../../provider'; import NavigationService from '../../services/NavigationService'; import {SideMenuEvent, ToastEvent} from '../../utils/utils'; import {useIsFocused} from 'react-navigation-hooks'; +import PullToRefresh from '../../components/PullToRefresh'; export const AnimatedSafeAreaView = Animatable.createAnimatableComponent( SafeAreaView, @@ -20,7 +21,7 @@ export const Home = ({navigation}) => { // State const [state, dispatch] = useTracked(); const {colors, selectionMode, notes} = state; - + const [refreshing, setRefreshing] = useState(false); const [text, setText] = useState(''); const [hideHeader, setHideHeader] = useState(false); const [keyword, setKeyword] = useState('');