fix(striker-ui): allow set initial value in InputWithRef

main
Tsu-ba-me 2 years ago
parent 5ce3277a6e
commit 3bebe05a88
  1. 2
      striker-ui/components/InputWithRef.tsx

@ -59,7 +59,7 @@ const InputWithRef = forwardRef(
ref: ForwardedRef<InputForwardedRefContent<TypeName>>, ref: ForwardedRef<InputForwardedRefContent<TypeName>>,
) => { ) => {
const [value, setValue] = useState<MapToType[TypeName]>( const [value, setValue] = useState<MapToType[TypeName]>(
MAP_TO_INITIAL_VALUE[valueType] as MapToType[TypeName], input.props.value ?? MAP_TO_INITIAL_VALUE[valueType],
) as [MapToType[TypeName], MapToStateSetter[TypeName]]; ) as [MapToType[TypeName], MapToStateSetter[TypeName]];
const [isChangedByUser, setIsChangedByUser] = useState<boolean>(false); const [isChangedByUser, setIsChangedByUser] = useState<boolean>(false);

Loading…
Cancel
Save