[bugfix] AdvancedSettings: OSC Port: Add the validation that the entry component is only allowed numeric.

This commit is contained in:
Sakamoto Shiina
2025-04-19 23:51:47 +09:00
parent 9d98f8c4f2
commit 4eca60d495

View File

@@ -32,10 +32,10 @@ export const AdvancedSettings = () => {
const OscIpAddressContainer = () => { const OscIpAddressContainer = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { currentOscIpAddress, setOscIpAddress } = useOscIpAddress(); const { currentOscIpAddress, setOscIpAddress } = useOscIpAddress();
const [input_value, seInputValue] = useState(currentOscIpAddress.data); const [input_value, setInputValue] = useState(currentOscIpAddress.data);
const onChangeFunction = (value) => { const onChangeFunction = (value) => {
seInputValue(value); setInputValue(value);
}; };
const saveFunction = () => { const saveFunction = () => {
@@ -43,7 +43,7 @@ const OscIpAddressContainer = () => {
}; };
useEffect(()=> { useEffect(()=> {
seInputValue(currentOscIpAddress.data); setInputValue(currentOscIpAddress.data);
}, [currentOscIpAddress]); }, [currentOscIpAddress]);
return ( return (
@@ -61,10 +61,11 @@ const OscIpAddressContainer = () => {
const OscPortContainer = () => { const OscPortContainer = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { currentOscPort, setOscPort } = useOscPort(); const { currentOscPort, setOscPort } = useOscPort();
const [input_value, seInputValue] = useState(currentOscPort.data); const [input_value, setInputValue] = useState(currentOscPort.data);
const onChangeFunction = (value) => { const onChangeFunction = (value) => {
seInputValue(value); value = value.replace(/[^0-9]/g, "");
setInputValue(value);
}; };
const saveFunction = () => { const saveFunction = () => {
@@ -72,7 +73,7 @@ const OscPortContainer = () => {
}; };
useEffect(()=> { useEffect(()=> {
seInputValue(currentOscPort.data); setInputValue(currentOscPort.data);
}, [currentOscPort]); }, [currentOscPort]);
return ( return (