Skip to content

Commit

Permalink
Fixed #3181 - Animation of the floating label doesn't work in Chips
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Aug 24, 2022
1 parent 29af075 commit 324dbb7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions components/lib/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const Chips = React.memo(
props.onChange({
originalEvent: event,
value: values,
stopPropagation: () => {},
preventDefault: () => {},
stopPropagation: () => { },
preventDefault: () => { },
target: {
name: props.name,
id: props.id,
Expand Down Expand Up @@ -114,8 +114,8 @@ export const Chips = React.memo(
props.onChange({
originalEvent: event,
value: items,
stopPropagation: () => {},
preventDefault: () => {},
stopPropagation: () => { },
preventDefault: () => { },
target: {
name: props.name,
id: props.id,
Expand Down Expand Up @@ -169,9 +169,8 @@ export const Chips = React.memo(
return props.max && props.value && props.max === props.value.length;
};

const isFilled = React.useMemo(() => {
return (props.value && props.value.length) || (inputRef.current && inputRef.current.value && inputRef.current.value.length);
}, [props.value]);
const currentValue = inputRef.current && inputRef.current.value;
const isFilled = React.useMemo(() => ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(currentValue), [props.value, currentValue]);

const isRemovable = (value, index) => {
return ObjectUtils.getPropValue(props.removable, { value, index, props });
Expand Down

0 comments on commit 324dbb7

Please sign in to comment.