numbers in other keyboard's language isn't typed on input
I use this component in my react-hook-form but when I'm typing numbers in Persian (Standard Keyboard) it isn't typed any number.
you can use customNumerals={['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']}
see this section https://github.com/s-yadav/react-number-format#custom-numeral
I set up custom-numeral and still have the issue.
You might consider the fact that iOS users don't have Persian keyboard. So here are all possible options I can think of now.
- Convert any non Persian digit character (e.g. Arabic or Urdu) to Persian (or English) on change event.
const a2p = (s: string | null) => s?.replace(/[٠-٩]/g, (d) => "۰۱۲۳۴۵۶۷۸۹"["٠١٢٣٤٥٦٧٨٩".indexOf(d)]);
const a2e = (s: string | null) => s?.replace(/[٠-٩]/g, (d) => "٠١٢٣٤٥٦٧٨٩".indexOf(d));
- Configure your input to keep iOS user's keyboard consistent with other Users.
https://css-tricks.com/finger-friendly-numerical-inputs-with-inputmode
- Ask your user to change their keyboard politely.
import { object, string } from "yup";
export const Schema = object({
feild: string()
.required("وارد کردن این قسمت الزامی است")
.matches(/[\u06F0-\u06F90-9]+/, "زبان خود را به فارسی یا انگلیسی تغییر دهید")
})
fixed it #874
The custom numeral's can be handled outside the lib, Example: https://s-yadav.github.io/react-number-format/docs/customization/#custom-numeral-example let me know if this is not working with keyboards.
you can use
customNumerals={['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']}see this section https://github.com/s-yadav/react-number-format#custom-numeral
not work , and the component haven't this prop