Skip to content

Commit

Permalink
fix: Sending on return key (#1239)
Browse files Browse the repository at this point in the history
Add platform check for return key
  • Loading branch information
alexrisch authored Nov 22, 2024
1 parent 35a93d8 commit 8ffb714
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/Chat/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ const getSendButtonType = (input: string): "DEFAULT" | "HIGHER" => {
return "DEFAULT";
};

interface ChatInputProps {
type ChatInputProps = {
inputHeight: SharedValue<number>;
}
};

export default function ChatInput({ inputHeight }: ChatInputProps) {
const conversation = useConversationContext("conversation");
Expand Down Expand Up @@ -410,14 +410,16 @@ export default function ChatInput({ inputHeight }: ChatInputProps) {
<TextInput
style={styles.chatInputField}
value={inputValue}
onSubmitEditing={() => {
onValidate();
}}
onSubmitEditing={onValidate}
onChangeText={(t: string) => {
inputIsFocused.current = true;
setInputValue(t);
}}
onKeyPress={(event: any) => {
// Maybe want a better check here, but web/tablet is not the focus right now
if (Platform.OS !== "web") {
return;
}
if (
event.nativeEvent.key === "Enter" &&
!event.altKey &&
Expand Down

0 comments on commit 8ffb714

Please sign in to comment.