diff --git a/packages/semi-ui/form/_story/ArrayField/remountInit.jsx b/packages/semi-ui/form/_story/ArrayField/remountInit.jsx new file mode 100644 index 0000000000..838d5887aa --- /dev/null +++ b/packages/semi-ui/form/_story/ArrayField/remountInit.jsx @@ -0,0 +1,55 @@ +import React, { useState } from 'react'; +import { ArrayField, TextArea, Form, Button, useFormState } from '@douyinfe/semi-ui'; +import { IconPlusCircle, IconMinusCircle } from '@douyinfe/semi-icons'; + +// toggle form input visible +// visible -> invisible -> visible +// initValue will not use in final round now +// The behavior in ArrayField is inconsistent with that in non-ArrayField, which is undefined behavior. Clearer guidance is needed. + +const RemountInit = () => { + const [data, setData] = useState([ + { name: 'arrayfield defualtValue' }, + ]); + const [visible, setVisible] = useState(true); + const ComponentUsingFormState = () => { + const formState = useFormState(); + return ( + + ); + }; + return ( +
+ ); +}; +export default RemountInit; \ No newline at end of file diff --git a/packages/semi-ui/form/_story/form.stories.jsx b/packages/semi-ui/form/_story/form.stories.jsx index b4ad58d248..f5fecd3525 100644 --- a/packages/semi-ui/form/_story/form.stories.jsx +++ b/packages/semi-ui/form/_story/form.stories.jsx @@ -74,6 +74,7 @@ import ChildDidMount from './Debug/childDidMount'; export { default as FormSubmit } from './FormSubmit'; export { default as TabelForm } from './TableDemo'; +export { default as RemountInit } from './ArrayField/remountInit' const { Input,