fix: prevent app to jump to first device after another device name was changed
parent
06c22b6a5e
commit
dce2282e1a
|
@ -1,5 +1,9 @@
|
|||
import { useContext } from "react";
|
||||
import { AppContext, Constants } from "../../../../utils";
|
||||
import {
|
||||
AppContext,
|
||||
AppSelectedUserDevice,
|
||||
Constants,
|
||||
} from "../../../../utils";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { MyTextInputModalContent } from "../../../../Components/Modal";
|
||||
|
||||
|
@ -18,6 +22,11 @@ export default function SettingsChangeDeviceDisplayNameModalContent({
|
|||
|
||||
if (foundIndex !== -1) {
|
||||
newArr[foundIndex].displayName = newDeviceDisplayName;
|
||||
|
||||
AppSelectedUserDevice.current.routeName = newDeviceDisplayName;
|
||||
|
||||
// this timeout is needed as the app will navigate to the first device in appContext.devices without to navigate back to the updated device
|
||||
setTimeout(() => navigation.navigate(newDeviceDisplayName), 50);
|
||||
}
|
||||
|
||||
return newArr;
|
||||
|
|
Loading…
Reference in New Issue