1- import React , { forwardRef , useRef , useImperativeHandle } from 'react' ;
1+ import React , { useRef } from 'react' ;
22import { classNames , getExtraAttrs , getSlots , emit } from '../shared/utils.js' ;
33import { colorClasses } from '../shared/mixins.js' ;
44import { f7 } from '../shared/f7.js' ;
5+ import { setRef } from '../shared/set-ref.js' ;
56
67/* dts-props
78 id: string | number;
@@ -15,21 +16,15 @@ import { f7 } from '../shared/f7.js';
1516 COLOR_PROPS
1617*/
1718
18- const ComponentName = forwardRef ( ( props , ref ) => {
19- const { className, id, style, strong, close = true } = props ;
19+ const ComponentName = ( props ) => {
20+ const { className, id, style, strong, close = true , ref } = props ;
2021 const extraAttrs = getExtraAttrs ( props ) ;
2122
2223 const elRef = useRef ( null ) ;
23- useImperativeHandle ( ref , ( ) => ( {
24- el : elRef . current ,
25- } ) ) ;
2624
2725 const classes = classNames (
2826 className ,
29- {
30- 'actions-button' : true ,
31- 'actions-button-strong' : strong ,
32- } ,
27+ { 'actions-button' : true , 'actions-button-strong' : strong } ,
3328 colorClasses ( props ) ,
3429 ) ;
3530
@@ -49,12 +44,22 @@ const ComponentName = forwardRef((props, ref) => {
4944 } ;
5045
5146 return (
52- < div id = { id } style = { style } className = { classes } ref = { elRef } { ...extraAttrs } onClick = { onClick } >
47+ < div
48+ id = { id }
49+ style = { style }
50+ className = { classes }
51+ ref = { ( el ) => {
52+ elRef . current = el ;
53+ setRef ( ref , el ) ;
54+ } }
55+ { ...extraAttrs }
56+ onClick = { onClick }
57+ >
5358 { mediaEl }
5459 < div className = "actions-button-text" > { slots . default } </ div >
5560 </ div >
5661 ) ;
57- } ) ;
62+ } ;
5863
5964ComponentName . displayName = 'f7-actions-button' ;
6065
0 commit comments