Skip to content

Commit

Permalink
Fix #5172: Ripple forwardRef issue (#5175)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Oct 27, 2023
1 parent 3307133 commit fdfc75f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/lib/ripple/Ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DomHandler, classNames, mergeProps } from '../utils/Utils';
import { RippleBase } from './RippleBase';

export const Ripple = React.memo(
React.forwardRef((inProps) => {
React.forwardRef((inProps, ref) => {
const inkRef = React.useRef(null);
const targetRef = React.useRef(null);
const context = React.useContext(PrimeReactContext);
Expand Down Expand Up @@ -72,6 +72,12 @@ export const Ripple = React.memo(
}
};

React.useImperativeHandle(ref, () => ({
props,
getInk: () => inkRef.current,
getTarget: () => targetRef.current
}));

useMountEffect(() => {
if (inkRef.current) {
targetRef.current = getTarget();
Expand Down

0 comments on commit fdfc75f

Please sign in to comment.