fixed the new useNavigation hook usage

This commit is contained in:
Clément Le Bihan
2023-04-15 22:12:54 +02:00
parent ae36edfff4
commit 31d3909e80
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -7,6 +7,7 @@ import { Center, Button, Text } from 'native-base';
import SigninForm from "../components/forms/signinform";
import SignupForm from "../components/forms/signupform";
import TextButton from "../components/TextButton";
import { useNavigation } from "../Navigation";
const hanldeSignin = async (username: string, password: string, apiSetter: (accessToken: string) => void): Promise<string> => {
try {
@@ -32,9 +33,14 @@ const handleSignup = async (username: string, password: string, email: string, a
}
};
const AuthenticationView = ({ route, navigation }: any) => {
const AuthenticationView = () => {
const navigation = useNavigation();
const dispatch = useDispatch();
const isSignup = route.params?.isSignup ?? false;
const params = navigation.getState().routes.find((route) => {
// this is not ideal way to check if we are on login page
return route.name === "Login";
}).params ?? {};
const isSignup = params?.isSignup ?? false;
const [mode, setMode] = React.useState<"signin" | "signup">(isSignup ? "signup" : "signin");
return (
+1 -1
View File
@@ -45,7 +45,7 @@ const imgLogo =
"https://chromacase.studio/wp-content/uploads/2023/03/cropped-cropped-splashLogo-280x300.png";
const StartPageView = () => {
const navigate = useNavigation();
const navigation = useNavigation();
const screenSize = useBreakpointValue({ base: "small", md: "big" });
const isSmallScreen = screenSize === "small";
const dispatch = useDispatch();