Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: note icon registers clicks #3298

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions app/components/note-input/note-input.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { View, TextInput, StyleProp, ViewStyle } from "react-native"
import React, { useRef } from "react"
import { View, TextInput, StyleProp, ViewStyle, TouchableOpacity } from "react-native"

import { useI18nContext } from "@app/i18n/i18n-react"
import { testProps } from "@app/utils/testProps"
Expand Down Expand Up @@ -29,7 +29,13 @@ export const NoteInput: React.FC<NoteInputProps> = ({
const {
theme: { colors },
} = useTheme()
const textInputRef = useRef<TextInput>(null)

const focusTextInput = () => {
if (textInputRef.current) {
textInputRef.current.focus()
}
}
return (
<View style={[styles.fieldBackground, style]}>
<View style={styles.noteContainer}>
Expand All @@ -44,10 +50,11 @@ export const NoteInput: React.FC<NoteInputProps> = ({
editable={editable}
selectTextOnFocus
maxLength={500}
ref={textInputRef}
/>
<View style={styles.noteIconContainer}>
<TouchableOpacity style={styles.noteIconContainer} onPress={focusTextInput}>
<GaloyIcon name={"note"} size={18} color={colors.primary} />
</View>
</TouchableOpacity>
</View>
</View>
)
Expand Down
Loading