We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I get the error TS2339: Property 'isValid' does not exist on type 'TextInputMask'. when defining the following component:
TS2339: Property 'isValid' does not exist on type 'TextInputMask'.
import React, { useRef, useState } from "react" import { TextInputMask } from "react-native-masked-text" import { DateTime } from "luxon" interface DateTextFieldProps { onChangeDate: (date: Date) => void } export const DateTextField = ({ onChangeDate }: DateTextFieldProps) => { const [value, setValue] = useState<string>("") const ref = useRef<TextInputMask>(null) return ( <TextInputMask type={"datetime"} options={{ format: "DD/MM/YYYY", }} value={value} onChangeText={(newValue) => { setValue(newValue) if (ref.current?.isValid && ref.current?.isValid()) { // <===== Here happens the typescript error onChangeDate(DateTime.fromFormat(newValue, "dd/MM/yyyy").toJSDate()) } }} keyboardType={"numeric"} ref={ref} /> ) }
I can see isValid() in TextInputMaskMethods, but it seems not to be related to
export class TextInputMask extends React.Component<TextInputMaskProps> {}
// TextInputMaskMethods export class TextInputMaskMethods { getElement(): TextInput getRawValue(): string isValid(): boolean } // TextInputMasked export type TextInputMasked = TextInputMaskMethods | null
The text was updated successfully, but these errors were encountered:
I was able to fix it like this:
type InputMask = TextInputMask & TextInputMaskMethods const inputRef = useRef<InputMask>(null)
Sorry, something went wrong.
No branches or pull requests
I get the error
TS2339: Property 'isValid' does not exist on type 'TextInputMask'.
when defining the following component:I can see isValid() in TextInputMaskMethods, but it seems not to be related to
The text was updated successfully, but these errors were encountered: