11import { Plus } from '@gravity-ui/icons' ;
22import { Button , Card , Icon } from '@gravity-ui/uikit' ;
3- import React , { useCallback } from 'react' ;
3+ import * as React from 'react' ;
44
55import { ArrayObjectInput , ArrayTextInput , DynamicFormValue } from '../../../../../common/types' ;
66import { removeFromArray , swapArrayItems } from '../../../../utils' ;
@@ -27,15 +27,15 @@ interface ArrayFieldProps {
2727const ArrayDynamicField = ( { title, values, onUpdate, className, blockConfig} : ArrayFieldProps ) => {
2828 const haveItems = values && Array . isArray ( values ) && values . length ;
2929
30- const onAddItem = useCallback ( ( ) => {
30+ const onAddItem = React . useCallback ( ( ) => {
3131 if ( blockConfig . arrayType === 'text' ) {
3232 onUpdate ( '' , haveItems ? [ ...values , '' ] : [ '' ] ) ;
3333 } else if ( blockConfig . arrayType === 'object' ) {
3434 onUpdate ( '' , haveItems ? [ ...values , { } ] : [ { } ] ) ;
3535 }
3636 } , [ blockConfig . arrayType , haveItems , onUpdate , values ] ) ;
3737
38- const onDeleteItem = useCallback (
38+ const onDeleteItem = React . useCallback (
3939 ( index : number ) => {
4040 if ( Array . isArray ( values ) ) {
4141 const newArray = removeFromArray ( values , index ) ;
@@ -45,7 +45,7 @@ const ArrayDynamicField = ({title, values, onUpdate, className, blockConfig}: Ar
4545 [ onUpdate , values ] ,
4646 ) ;
4747
48- const onReorderItem = useCallback (
48+ const onReorderItem = React . useCallback (
4949 ( index : number , placement : 'up' | 'down' ) => {
5050 if ( Array . isArray ( values ) ) {
5151 const newArray = swapArrayItems (
@@ -59,7 +59,7 @@ const ArrayDynamicField = ({title, values, onUpdate, className, blockConfig}: Ar
5959 [ onUpdate , values ] ,
6060 ) ;
6161
62- const renderInput = useCallback (
62+ const renderInput = React . useCallback (
6363 ( value : DynamicFormValue , index : number ) => {
6464 const arrayItemButton = (
6565 < ItemButton
@@ -113,7 +113,7 @@ const ArrayDynamicField = ({title, values, onUpdate, className, blockConfig}: Ar
113113 [ blockConfig , haveItems , onDeleteItem , onReorderItem , onUpdate , values ] ,
114114 ) ;
115115
116- const renderInputs = useCallback ( ( ) => {
116+ const renderInputs = React . useCallback ( ( ) => {
117117 if ( haveItems ) {
118118 const renderItems = values
119119 . map ( renderInput )
0 commit comments