reza add forcePersian

master
RezaAshrafi77 3 years ago
parent 1ac115e6d6
commit 94e8caa1ee
  1. 5
      src/views/Auth/Profile/Input/index.js
  2. 75
      src/views/Auth/Profile/index.js

@ -18,7 +18,7 @@ export default function FormPropsTextFields(props) {
})); }));
const classes = useStyles(); const classes = useStyles();
const { parent, defaultValue, maxLength, inputMode } = props; const { parent, defaultValue, maxLength, inputMode, onInput } = props;
return ( return (
<form className={classes.root} noValidate autoComplete="off"> <form className={classes.root} noValidate autoComplete="off">
<div> <div>
@ -30,9 +30,10 @@ export default function FormPropsTextFields(props) {
onChange={(e) => parent.onChange(e.target.name, e.target.value)} onChange={(e) => parent.onChange(e.target.name, e.target.value)}
defaultValue={defaultValue[props.name]} defaultValue={defaultValue[props.name]}
maxLength={maxLength} maxLength={maxLength}
inputMode={inputMode} onInput={(e) => (e.target.value = onInput(e.target.value))}
/> />
</div> </div>
+
</form> </form>
); );
} }

@ -117,6 +117,80 @@ class Profile extends Component {
await setProfile(data); await setProfile(data);
}; };
forcePersian = (txt) => {
let yas = txt;
yas = yas.replace(/`/g, "");
yas = yas.replace(/0/g, "");
yas = yas.replace(/1/g, "");
yas = yas.replace(/2/g, "");
yas = yas.replace(/3/g, "");
yas = yas.replace(/4/g, "");
yas = yas.replace(/5/g, "");
yas = yas.replace(/6/g, "");
yas = yas.replace(/7/g, "");
yas = yas.replace(/8/g, "");
yas = yas.replace(/9/g, "");
yas = yas.replace(/0/g, "");
yas = yas.replace(/q/g, "");
yas = yas.replace(/w/g, "");
yas = yas.replace(/e/g, "");
yas = yas.replace(/r/g, "");
yas = yas.replace(/t/g, "");
yas = yas.replace(/y/g, "");
yas = yas.replace(/u/g, "");
yas = yas.replace(/i/g, "");
yas = yas.replace(/o/g, "");
yas = yas.replace(/p/g, "");
yas = yas.replace(/\[/g, "");
yas = yas.replace(/\]/g, "");
yas = yas.replace(/a/g, "");
yas = yas.replace(/s/g, "");
yas = yas.replace(/d/g, "");
yas = yas.replace(/f/g, "");
yas = yas.replace(/g/g, "");
yas = yas.replace(/h/g, "");
yas = yas.replace(/j/g, "");
yas = yas.replace(/k/g, "");
yas = yas.replace(/l/g, "");
yas = yas.replace(/\;/g, "");
yas = yas.replace(/\'/g, "");
yas = yas.replace(/z/g, "");
yas = yas.replace(/x/g, "");
yas = yas.replace(/c/g, "");
yas = yas.replace(/v/g, "");
yas = yas.replace(/b/g, "");
yas = yas.replace(/n/g, "");
yas = yas.replace(/m/g, "");
yas = yas.replace(/\,/g, "");
yas = yas.replace(/\./g, "");
yas = yas.replace(/\//g, "");
yas = yas.replace(/~/g, " ");
yas = yas.replace(/Q/g, "");
yas = yas.replace(/W/g, "");
yas = yas.replace(/E/g, "");
yas = yas.replace(/R/g, "");
yas = yas.replace(/T/g, "");
yas = yas.replace(/Y/g, "");
yas = yas.replace(/U/g, "");
yas = yas.replace(/I/g, "");
yas = yas.replace(/O/g, "");
yas = yas.replace(/P/g, "");
yas = yas.replace(/A/g, "");
yas = yas.replace(/S/g, "");
yas = yas.replace(/G/g, "");
yas = yas.replace(/H/g, "");
yas = yas.replace(/J/g, "");
yas = yas.replace(/K/g, "");
yas = yas.replace(/L/g, "");
yas = yas.replace(/Z/g, "");
yas = yas.replace(/X/g, "");
yas = yas.replace(/B/g, "");
yas = yas.replace(/N/g, "");
yas = yas.replace(/M/g, "");
yas = yas.replace(/\?/g, "");
return yas;
};
render() { render() {
const { user, profile } = this.props; const { user, profile } = this.props;
return ( return (
@ -342,6 +416,7 @@ class Profile extends Component {
label="نام" label="نام"
parent={this} parent={this}
defaultValue={profile} defaultValue={profile}
onInput={this.forcePersian}
/> />
<Input <Input
name="lastName" name="lastName"

Loading…
Cancel
Save