Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix navigation

Ammar Ahmed5429161f914f
diff --git a/apps/mobile/app/components/dialogs/vault/index.js b/apps/mobile/app/components/dialogs/vault/index.js
index e372382fb..64d408501 100644
--- a/apps/mobile/app/components/dialogs/vault/index.js
+++ b/apps/mobile/app/components/dialogs/vault/index.js
@@ -27,14 +27,12 @@ import { editorController } from "../../../screens/editor/tiptap/utils";
import BiometricService from "../../../services/biometrics";
import { DDS } from "../../../services/device-detection";
import {
+ ToastManager,
eSendEvent,
eSubscribeEvent,
- eUnSubscribeEvent,
- ToastManager
+ eUnSubscribeEvent
} from "../../../services/event-manager";
import Navigation from "../../../services/navigation";
-import SearchService from "../../../services/search";
-import { convertNoteToText } from "../../../utils/note-to-text";
import { getElevationStyle } from "../../../utils/elevation";
import {
eClearEditor,
@@ -45,6 +43,7 @@ import {
} from "../../../utils/events";
import { deleteItems } from "../../../utils/functions";
import { tabBarRef } from "../../../utils/global-refs";
+import { convertNoteToText } from "../../../utils/note-to-text";
import { sleep } from "../../../utils/time";
import BaseDialog from "../../dialog/base-dialog";
import DialogButtons from "../../dialog/dialog-buttons";
@@ -55,10 +54,6 @@ import Input from "../../ui/input";
import Seperator from "../../ui/seperator";
import Paragraph from "../../ui/typography/paragraph";
-let Keychain;
-const passInputRef = createRef();
-const confirmPassRef = createRef();
-const changePassInputRef = createRef();
export class VaultDialog extends Component {
constructor(props) {
super(props);
@@ -88,6 +83,11 @@ export class VaultDialog extends Component {
deleteVault: false,
deleteAll: false
};
+
+ this.passInputRef = createRef();
+ this.confirmPassRef = createRef();
+ this.changePassInputRef = createRef();
+
this.password = null;
this.confirmPassword = null;
this.newPassword = null;
@@ -148,9 +148,6 @@ export class VaultDialog extends Component {
* @param {import('../../../services/event-manager').vaultType} data
*/
open = async (data) => {
- if (!Keychain) {
- Keychain = require("react-native-keychain");
- }
let biometry = await BiometricService.isBiometryAvailable();
let available = false;
let fingerprint = await BiometricService.hasInternetCredentials("nn_vault");
@@ -668,7 +665,8 @@ export class VaultDialog extends Component {
<BaseDialog
onShow={async () => {
await sleep(100);
- passInputRef.current?.focus();
+
+ this.passInputRef.current?.focus();
}}
statusBarTranslucent={false}
onRequestClose={this.close}
@@ -703,7 +701,7 @@ export class VaultDialog extends Component {
!this.state.revokeFingerprintAccess ? (
<>
<Input
- fwdRef={passInputRef}
+ fwdRef={this.passInputRef}
editable={!loading}
autoCapitalize="none"
testID={notesnook.ids.dialogs.vault.pwd}
@@ -720,7 +718,7 @@ export class VaultDialog extends Component {
}
onSubmit={() => {
changePassword
- ? changePassInputRef.current?.focus()
+ ? this.confirmPassRef.current?.focus()
: this.onPress;
}}
autoComplete="password"
@@ -772,7 +770,7 @@ export class VaultDialog extends Component {
<>
<Seperator half />
<Input
- ref={changePassInputRef}
+ ref={this.confirmPassRef}
editable={!loading}
testID={notesnook.ids.dialogs.vault.changePwd}
autoCapitalize="none"
@@ -792,7 +790,7 @@ export class VaultDialog extends Component {
{!novault ? (
<View>
<Input
- fwdRef={passInputRef}
+ fwdRef={this.passInputRef}
autoCapitalize="none"
testID={notesnook.ids.dialogs.vault.pwd}
onChangeText={(value) => {
@@ -803,13 +801,13 @@ export class VaultDialog extends Component {
returnKeyType="next"
secureTextEntry
onSubmit={() => {
- confirmPassRef.current?.focus();
+ this.confirmPassRef.current?.focus();
}}
placeholder="Password"
/>
<Input
- fwdRef={confirmPassRef}
+ fwdRef={this.confirmPassRef}
autoCapitalize="none"
testID={notesnook.ids.dialogs.vault.pwdAlt}
secureTextEntry
diff --git a/apps/mobile/app/components/intro/welcome.js b/apps/mobile/app/components/intro/welcome.js
index fbedd4f42..3ba7622b8 100644
--- a/apps/mobile/app/components/intro/welcome.js
+++ b/apps/mobile/app/components/intro/welcome.js
@@ -77,14 +77,9 @@ export const WelcomeNotice = () => {
SettingsService.set({
introCompleted: true
});
- Navigation.replace(
- {
- name: "Notes"
- },
- {
- canGoBack: false
- }
- );
+ Navigation.replace("Notes", {
+ canGoBack: false
+ });
}, 1000);
}}
style={{
@@ -106,14 +101,9 @@ export const WelcomeNotice = () => {
SettingsService.set({
introCompleted: true
});
- Navigation.replace(
- {
- name: "Notes"
- },
- {
- canGoBack: false
- }
- );
+ Navigation.replace("Notes", {
+ canGoBack: false
+ });
await sleep(1000);
eSendEvent(eCloseLoading);
}}
diff --git a/apps/mobile/app/components/side-menu/index.js b/apps/mobile/app/components/side-menu/index.js
index 0a38dce2b..bdf212e93 100644
--- a/apps/mobile/app/components/side-menu/index.js
+++ b/apps/mobile/app/components/side-menu/index.js
@@ -65,10 +65,7 @@ export const SideMenu = React.memo(
icon: "cog-outline",
close: true,
func: () => {
- Navigation.navigate({
- name: "Settings",
- title: "Settings"
- });
+ Navigation.navigate("Settings");
}
}
];
diff --git a/apps/mobile/app/screens/settings/app-lock.js b/apps/mobile/app/screens/settings/app-lock.js
index 3b080e8b5..3401f59e5 100644
--- a/apps/mobile/app/screens/settings/app-lock.js
+++ b/apps/mobile/app/screens/settings/app-lock.js
@@ -274,14 +274,9 @@ const AppLock = ({ route }) => {
SettingsService.set({
introCompleted: true
});
- Navigation.replace(
- {
- name: "Notes"
- },
- {
- canGoBack: false
- }
- );
+ Navigation.replace("Notes", {
+ canGoBack: false
+ });
}, 1000);
}}
style={{