aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-03-15 00:42:22 +0000
committerMohamedBassem <me@mbassem.com>2024-03-15 00:42:22 +0000
commitcd10200c64572ab09112ddda55fc1057bac233ab (patch)
tree26678955e83be805853e122aa0155b76e95b0c1c /apps/mobile
parente2dcf1b06f79c8e0284a009700b00efcfbc0e83f (diff)
downloadkarakeep-cd10200c64572ab09112ddda55fc1057bac233ab.tar.zst
mobile: Fix keyboard interactions in search and signin form
Diffstat (limited to 'apps/mobile')
-rw-r--r--apps/mobile/app/signin.tsx111
-rw-r--r--apps/mobile/components/bookmarks/BookmarkList.tsx3
2 files changed, 64 insertions, 50 deletions
diff --git a/apps/mobile/app/signin.tsx b/apps/mobile/app/signin.tsx
index 63e48f22..da7e2fea 100644
--- a/apps/mobile/app/signin.tsx
+++ b/apps/mobile/app/signin.tsx
@@ -1,5 +1,12 @@
import { useEffect, useState } from "react";
-import { Text, View } from "react-native";
+import {
+ Keyboard,
+ KeyboardAvoidingView,
+ Platform,
+ Text,
+ TouchableWithoutFeedback,
+ View,
+} from "react-native";
import { useRouter } from "expo-router";
import Logo from "@/components/Logo";
import { Button } from "@/components/ui/Button";
@@ -48,53 +55,59 @@ export default function Signin() {
};
return (
- <View className="flex h-full flex-col justify-center gap-2 px-4">
- <View className="items-center">
- <Logo />
- </View>
- {error && (
- <Text className="w-full text-center text-red-500">{error}</Text>
- )}
- <View className="gap-2">
- <Text className="font-bold">Server Address</Text>
- <Input
- className="w-full"
- placeholder="Server Address"
- value={settings.address}
- autoCapitalize="none"
- keyboardType="url"
- onEndEditing={(e) =>
- setSettings({ ...settings, address: e.nativeEvent.text })
- }
- />
- </View>
- <View className="gap-2">
- <Text className="font-bold">Email</Text>
- <Input
- className="w-full"
- placeholder="Email"
- keyboardType="email-address"
- autoCapitalize="none"
- value={formData.email}
- onChangeText={(e) => setFormData((s) => ({ ...s, email: e }))}
- />
- </View>
- <View className="gap-2">
- <Text className="font-bold">Password</Text>
- <Input
- className="w-full"
- placeholder="Password"
- secureTextEntry
- value={formData.password}
- onChangeText={(e) => setFormData((s) => ({ ...s, password: e }))}
- />
- </View>
- <Button
- className="w-full"
- label="Sign In"
- onPress={onSignin}
- disabled={isPending}
- />
- </View>
+ <KeyboardAvoidingView
+ behavior={Platform.OS === "ios" ? "padding" : "height"}
+ >
+ <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
+ <View className="flex h-full flex-col justify-center gap-2 px-4">
+ <View className="items-center">
+ <Logo />
+ </View>
+ {error && (
+ <Text className="w-full text-center text-red-500">{error}</Text>
+ )}
+ <View className="gap-2">
+ <Text className="font-bold">Server Address</Text>
+ <Input
+ className="w-full"
+ placeholder="Server Address"
+ value={settings.address}
+ autoCapitalize="none"
+ keyboardType="url"
+ onEndEditing={(e) =>
+ setSettings({ ...settings, address: e.nativeEvent.text })
+ }
+ />
+ </View>
+ <View className="gap-2">
+ <Text className="font-bold">Email</Text>
+ <Input
+ className="w-full"
+ placeholder="Email"
+ keyboardType="email-address"
+ autoCapitalize="none"
+ value={formData.email}
+ onChangeText={(e) => setFormData((s) => ({ ...s, email: e }))}
+ />
+ </View>
+ <View className="gap-2">
+ <Text className="font-bold">Password</Text>
+ <Input
+ className="w-full"
+ placeholder="Password"
+ secureTextEntry
+ value={formData.password}
+ onChangeText={(e) => setFormData((s) => ({ ...s, password: e }))}
+ />
+ </View>
+ <Button
+ className="w-full"
+ label="Sign In"
+ onPress={onSignin}
+ disabled={isPending}
+ />
+ </View>
+ </TouchableWithoutFeedback>
+ </KeyboardAvoidingView>
);
}
diff --git a/apps/mobile/components/bookmarks/BookmarkList.tsx b/apps/mobile/components/bookmarks/BookmarkList.tsx
index 0c8ddb3c..e3c2bdb1 100644
--- a/apps/mobile/components/bookmarks/BookmarkList.tsx
+++ b/apps/mobile/components/bookmarks/BookmarkList.tsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
-import { Text, View } from "react-native";
+import { Text, View, Keyboard } from "react-native";
import Animated, { LinearTransition } from "react-native-reanimated";
import { api } from "@/lib/trpc";
@@ -53,6 +53,7 @@ export default function BookmarkList({
data={data.bookmarks}
refreshing={refreshing}
onRefresh={onRefresh}
+ onScrollBeginDrag={Keyboard.dismiss}
keyExtractor={(b) => b.id}
/>
);