From 6a402afa3f16b8cc00a939b72250b5aaabaf5b7d Mon Sep 17 00:00:00 2001 From: Haishan Date: Sun, 5 Jun 2022 23:40:25 +0800 Subject: Fix theme switcher button shape on iOS --- src/components/Config.tsx | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src/components/Config.tsx') diff --git a/src/components/Config.tsx b/src/components/Config.tsx index 34bb20a..6107789 100644 --- a/src/components/Config.tsx +++ b/src/components/Config.tsx @@ -6,11 +6,7 @@ import Select from 'src/components/shared/Select'; import { ClashGeneralConfig, DispatchFn, State } from 'src/store/types'; import { ClashAPIConfig } from 'src/types'; -import { - getClashAPIConfig, - getLatencyTestUrl, - getSelectedChartStyleIndex, -} from '../store/app'; +import { getClashAPIConfig, getLatencyTestUrl, getSelectedChartStyleIndex } from '../store/app'; import { fetchConfigs, getConfigs, updateConfigs } from '../store/configs'; import { openModal } from '../store/modals'; import Button from './Button'; @@ -103,7 +99,7 @@ function ConfigImpl({ }, [dispatch]); const setConfigState = useCallback( - (name, val) => { + (name: keyof ClashGeneralConfig, val: ClashGeneralConfig[keyof ClashGeneralConfig]) => { setConfigStateInternal({ ...configState, [name]: val }); }, [configState] @@ -147,14 +143,14 @@ function ConfigImpl({ [apiConfig, dispatch, setConfigState] ); - const handleInputOnChange = useCallback( + const handleInputOnChange = useCallback>( (e) => handleChangeValue(e.target), [handleChangeValue] ); const { selectChartStyleIndex, updateAppConfig } = useStoreActions(); - const handleInputOnBlur = useCallback( + const handleInputOnBlur = useCallback>( (e) => { const target = e.target; const { name, value } = target; @@ -198,7 +194,6 @@ function ConfigImpl({ name={f.key} value={configState[f.key]} onChange={handleInputOnChange} - // @ts-expect-error ts-migrate(2322) FIXME: Type '{ name: string; value: any; onChange: (e: an... Remove this comment to see the full error message onBlur={handleInputOnBlur} /> @@ -210,9 +205,7 @@ function ConfigImpl({ - handleChangeValue({ name: 'log-level', value: e.target.value }) - } + onChange={(e) => handleChangeValue({ name: 'log-level', value: e.target.value })} /> -- cgit v1.3.1