Commit e239a097 by G

KeyboardAwareScrollView made good work of raising the form inside the curved…

KeyboardAwareScrollView made good work of raising the form inside the curved container when focused. Also added an offset so that the input field is always a little above the keyboard
parent 7fe5d5af
...@@ -13,10 +13,11 @@ import { containers } from "@styles/Commons"; ...@@ -13,10 +13,11 @@ import { containers } from "@styles/Commons";
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import type { AxiosError } from "axios"; import type { AxiosError } from "axios";
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
import { KeyboardAvoidingView, Platform, TouchableOpacity, View } from "react-native"; import { TouchableOpacity, View } from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useSafeAreaInsets } from "react-native-safe-area-context";
import { LOG } from "@logger"; import { LOG } from "@logger";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
const log = LOG.extend("UserLoginScreen"); const log = LOG.extend("UserLoginScreen");
const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ navigation }) => { const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ navigation }) => {
...@@ -77,10 +78,6 @@ const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ nav ...@@ -77,10 +78,6 @@ const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ nav
return ( return (
<BackgroundDefault> <BackgroundDefault>
<View style={[containers.containerFull, { paddingTop: insets.top }]}> <View style={[containers.containerFull, { paddingTop: insets.top }]}>
<KeyboardAvoidingView
behavior={Platform.OS === "ios" ? "padding" : "height"}
style={{ flex: 1 }}
>
<Box style={{ height: "20%" }} px={"l"}> <Box style={{ height: "20%" }} px={"l"}>
<Box <Box
px={"m"} px={"m"}
...@@ -98,6 +95,7 @@ const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ nav ...@@ -98,6 +95,7 @@ const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ nav
</Box> </Box>
</Box> </Box>
<ContainerBorderTopCurved> <ContainerBorderTopCurved>
<KeyboardAwareScrollView extraScrollHeight={50}>
<Box p={"l"} paddingTop={"x100"} mb={"s"}> <Box p={"l"} paddingTop={"x100"} mb={"s"}>
<Box mb={"l"}> <Box mb={"l"}>
<Text fontSize={40} fontWeight={"bold"} variant={"black"}> <Text fontSize={40} fontWeight={"bold"} variant={"black"}>
...@@ -146,8 +144,8 @@ const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ nav ...@@ -146,8 +144,8 @@ const UserLoginScreen: MainStackScreenComponentProps<"userLoginScreen"> = ({ nav
onPress={() => {}} onPress={() => {}}
/> />
</Box> </Box>
</KeyboardAwareScrollView>
</ContainerBorderTopCurved> </ContainerBorderTopCurved>
</KeyboardAvoidingView>
</View> </View>
</BackgroundDefault> </BackgroundDefault>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment