diff --git a/apps/mobile/index.js b/apps/mobile/index.js index 7cd4ca176..beffdf625 100644 --- a/apps/mobile/index.js +++ b/apps/mobile/index.js @@ -1,12 +1,11 @@ import "react-native-gesture-handler"; import 'react-native-get-random-values' -import { enableScreens } from 'react-native-screens'; import { AppRegistry } from 'react-native'; import App from './App'; import { name as appName } from './app.json'; import React from 'react'; import { Provider } from './src/provider'; -enableScreens(); + const AppProvider = () => { return ( diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js index 1b7dd34d5..719256c2e 100644 --- a/apps/mobile/src/components/Container/index.js +++ b/apps/mobile/src/components/Container/index.js @@ -47,6 +47,7 @@ export const Container = ({ noSelectionHeader = false, headerColor = null, type = null, + route }) => { // State const [state, dispatch] = useTracked(); @@ -210,6 +211,7 @@ export const Container = ({ countUp = 0; countDown = 0; }} + route={route} headerColor={headerColor} navigation={navigation} colors={colors} diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js index cd568c0f3..84c33f3de 100644 --- a/apps/mobile/src/components/DialogManager/index.js +++ b/apps/mobile/src/components/DialogManager/index.js @@ -12,6 +12,7 @@ import MergeEditor from '../MergeEditor'; import { VaultDialog } from '../VaultDialog'; import { moveNoteEvent } from './recievers'; import { TEMPLATE_DELETE, TEMPLATE_PERMANANT_DELETE } from './templates'; +import MoveNoteDialog from '../MoveNoteDialog'; export class DialogManager extends Component { constructor(props) { @@ -287,11 +288,11 @@ export class DialogManager extends Component { /> -{/* + (this.moveNoteDialog = ref)} colors={colors} - /> */} + /> (this.addTopicsDialog = ref)} diff --git a/apps/mobile/src/components/MoveNoteDialog/index.js b/apps/mobile/src/components/MoveNoteDialog/index.js index 54d74cb6c..fd747259d 100644 --- a/apps/mobile/src/components/MoveNoteDialog/index.js +++ b/apps/mobile/src/components/MoveNoteDialog/index.js @@ -1,8 +1,6 @@ -/* import React from 'react'; +import React, {createRef} from 'react'; import {Modal, TouchableOpacity, View} from 'react-native'; import * as Animatable from 'react-native-animatable'; -import {createAppContainer} from 'react-navigation'; -import {createStackNavigator} from 'react-navigation-stack'; import {ACTIONS} from '../../provider/actions'; import {eSendEvent} from '../../services/eventManager'; import {eMoveNoteDialogNavigateBack} from '../../services/events'; @@ -11,69 +9,45 @@ import Folders from '../../views/Folders'; import Notebook from '../../views/Notebook'; import Notes from '../../views/Notes'; import {updateEvent} from '../DialogManager/recievers'; +import {NavigationContainer} from '@react-navigation/native'; +import {createStackNavigator} from '@react-navigation/stack'; -const fade = props => { - const {position, scene} = props; - - const index = scene.index; - - const translateX = 0; - const translateY = 0; - - const opacity = position.interpolate({ - inputRange: [index - 0.7, index, index + 0.7], - outputRange: [0.3, 1, 0.3], - }); - - return { - opacity, - transform: [{translateX}, {translateY}], - }; +const Stack = createStackNavigator(); +const modalNavigatorRef = createRef(); +const ModalNavigator = () => { + return ( + + + + + + + + ); }; -const ModalNavigator = createStackNavigator( - { - Folders: { - screen: Folders, - }, - Notebook: { - screen: Notebook, - }, - Notes: { - screen: Notes, - }, - }, - { - initialRouteName: 'Folders', - initialRouteParams: { - title: 'Select Notebook', - isMove: true, - hideMore: true, - canGoBack: true, - }, - defaultNavigationOptions: { - gesturesEnabled: false, - headerStyle: { - backgroundColor: 'transparent', - borderBottomWidth: 0, - height: 0, - }, - }, - transitionConfig: () => ({ - screenInterpolator: props => { - return fade(props); - }, - }), - }, -); - -const Navigator = createAppContainer(ModalNavigator); - class MoveNoteDialog extends React.Component { constructor(props) { super(props); this.state = { - visible: false, + visible: true, animated: false, }; this.routeIndex = 0; @@ -161,12 +135,7 @@ class MoveNoteDialog extends React.Component { padding: DDS.isTab ? 8 : 0, zIndex: 10, }}> - (this.navigation = ref)} - onNavigationStateChange={state => { - this.routeIndex = state.index; - }} - /> + @@ -175,4 +144,3 @@ class MoveNoteDialog extends React.Component { } export default MoveNoteDialog; - */ \ No newline at end of file diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.js index 7f7253d03..a4a948ef0 100644 --- a/apps/mobile/src/components/header/index.js +++ b/apps/mobile/src/components/header/index.js @@ -32,6 +32,7 @@ export const Header = ({ navigation = null, isLoginNavigator, headerColor, + route, }) => { const [state, dispatch] = useTracked(); const {colors, syncing} = state; @@ -94,13 +95,13 @@ export const Header = ({ hitSlop={{top: 20, bottom: 20, left: 50, right: 40}} onPress={() => { if (navigation && preventDefaultMargins) { - if (navigation.state.routeName === 'Folders') { + if (route.name === 'Folders') { moveNoteHideEvent(); } else { navigation.goBack(); } } else if (navigation && isLoginNavigator) { - if (navigation.state.routeName === 'Login') { + if (route.name === 'Login') { eSendEvent(eCloseLoginDialog); } else { navigation.goBack(); diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.js index 1b69ffa72..3f9701784 100644 --- a/apps/mobile/src/views/Folders/index.js +++ b/apps/mobile/src/views/Folders/index.js @@ -35,6 +35,7 @@ export const Folders = ({route, navigation}) => { }; useEffect(() => { + if (isFocused) { dispatch({type: ACTIONS.PINNED}); dispatch({type: ACTIONS.NOTEBOOKS}); @@ -68,6 +69,7 @@ export const Folders = ({route, navigation}) => { { return (