fixed the new useNavigation hook usage
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user