Skip to content

Commit 34c57f7

Browse files
committed
feat: update ChatScreen and ScreenWrapper for improved layout and add lucide-react-native dependency
1 parent 8de84c0 commit 34c57f7

3 files changed

Lines changed: 199 additions & 9 deletions

File tree

app/(tabs)/chat.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import AppHeader from "@/components/AppHeader";
21
import ScreenWrapper from "@/components/ScreenWrapper";
32
import { sendChatMessage } from "@/services/aiService";
43
import { Ionicons } from "@expo/vector-icons";
@@ -80,9 +79,7 @@ export default function ChatScreen() {
8079
const isUser = item.sender === "user";
8180

8281
return (
83-
<View
84-
className={`mb-3 px-1 ${isUser ? "items-end" : "items-start"}`}
85-
>
82+
<View className={`mb-3 px-1 ${isUser ? "items-end" : "items-start"}`}>
8683
<View
8784
className={`rounded-2xl px-4 py-3 max-w-[80%] ${
8885
isUser ? "bg-green-600" : "bg-gray-100"
@@ -106,7 +103,7 @@ export default function ChatScreen() {
106103
};
107104

108105
return (
109-
<ScreenWrapper>
106+
<ScreenWrapper scrollable={false}>
110107
<KeyboardAvoidingView
111108
className="flex-1"
112109
behavior={Platform.OS === "ios" ? "padding" : undefined}

components/ScreenWrapper.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,35 @@ type ScreenWrapperProps = {
66
children: ReactNode;
77
header?: ReactNode;
88
scrollRef?: RefObject<ScrollView | null>;
9+
scrollable?: boolean;
910
};
1011

1112
export default function ScreenWrapper({
1213
children,
1314
header,
1415
scrollRef,
16+
scrollable = true,
1517
}: ScreenWrapperProps) {
18+
const content = (
19+
<>
20+
<StatusBar barStyle="dark-content" />
21+
<View style={{ flex: 1 }} className="px-8">
22+
{children}
23+
</View>
24+
</>
25+
);
26+
1627
return (
1728
<SafeAreaView
1829
edges={["top", "left", "right"]}
1930
style={{ flex: 1, backgroundColor: "#fcf7f9" }}
2031
>
2132
{header ? <View style={{ zIndex: 10 }}>{header}</View> : null}
22-
<ScrollView ref={scrollRef} className="px-8">
23-
<StatusBar barStyle="dark-content" />
24-
<View style={{ flex: 1 }}>{children}</View>
25-
</ScrollView>
33+
{scrollable ? (
34+
<ScrollView ref={scrollRef}>{content}</ScrollView>
35+
) : (
36+
<View style={{ flex: 1 }}>{content}</View>
37+
)}
2638
</SafeAreaView>
2739
);
2840
}

package-lock.json

Lines changed: 181 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)