I have a nested component structured as follows:
const Child = ({ onChange, value }) => {
const [localValue, setLocalValue] = useState("");
useEffect(() => {
setLocalValue(value);
}, [value]);
return <input onChange={onChange} value={localValue} />;
};
const Parent = () => {
const [value, setValue] = useState("");
const handleChange = (e) => setValue(e.target.value);
return <Child onChange={handleChange} value={value} />;
};
Basically, the child is a controlled input that stores the value in a state before rendering it in the input.
This input works correctly on desktop chrome, as in the typed string is displayed as is in the input. However, when typing using Android GBoard, the string is doubled when the character "@" is inputted. For example, typing "test" doesn't show any problem, but "test@" immediately changes the inputted string into "testtest@", sometimes "test@test@". This only happens after inputting "@", and doesn't occur on other android keyboards.
Can anyone else reproduce this? Any idea why this is happening?
Video of the bug: https://i.stack.imgur.com/8P2FS.jpg
Reproducible codesandbox: https://zd829w.csb.app/
GBoard version: 12.2.05.469624536-release-arm64-v8