I'm getting this error when I try to use the ref inside a wrapped TextInput:
TypeError: inputRef.current.clear is not a function. (In 'inputRef.current.clear()', 'inputRef.current.clear' is undefined)
My code:
const generateTestHook = useCavy(); const TestableTextInput = wrap(TextInput);
<TestableTextInput
returnKeyType={"search"}
returnKeyLabel={"search"}
ref={generateTestHook("HomeScreen.SearchQuery", inputRef)}
style={styles.input}
maxLength={25}
placeholder="¿Qué buscas?"
placeholderTextColor={"#808080"}
onChangeText={(text) => {
setCurrentQuery(text);
setOnSearch(true);
setOnTextInput(true);
}}
onSubmitEditing={() => {
if (currentQuery.replace(/\s/g, "").length) {
setQuery(currentQuery);
} else {
setCurrentQuery("");
setQuery("");
setOnSearch(false);
}
setOnTextInput(false);
}}
value={currentQuery}
onFocus={() => {
setOnSearch(true);
setOnTextInput(true);
//sheetRef.current.snapTo(2);
}}
onBlur={() => {
setOnTextInput(false);
}}
/>
I'm getting this error when I try to use the ref inside a wrapped TextInput:
TypeError: inputRef.current.clear is not a function. (In 'inputRef.current.clear()', 'inputRef.current.clear' is undefined)My code:
const generateTestHook = useCavy(); const TestableTextInput = wrap(TextInput);