File tree 2 files changed +37
-23
lines changed
Filter options
packages/coreui-react/src/components
2 files changed +37
-23
lines changed
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
96
96
} ,
97
97
ref ,
98
98
) => {
99
- const popoverRef = useRef ( null )
99
+ const popoverRef = useRef < HTMLDivElement > ( null )
100
100
const togglerRef = useRef ( null )
101
101
const forkedRef = useForkedRef ( ref , popoverRef )
102
102
const uID = useRef ( `popover${ Math . floor ( Math . random ( ) * 1_000_000 ) } ` )
@@ -134,16 +134,6 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
134
134
setVisible ( visible )
135
135
} , [ visible ] )
136
136
137
- useEffect ( ( ) => {
138
- if ( _visible && togglerRef . current && popoverRef . current ) {
139
- initPopper ( togglerRef . current , popoverRef . current , popperConfig )
140
- }
141
-
142
- return ( ) => {
143
- destroyPopper ( )
144
- }
145
- } , [ _visible ] )
146
-
147
137
const toggleVisible = ( visible : boolean ) => {
148
138
if ( visible ) {
149
139
setTimeout ( ( ) => setVisible ( true ) , _delay . show )
@@ -177,8 +167,22 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
177
167
in = { _visible }
178
168
mountOnEnter
179
169
nodeRef = { popoverRef }
180
- onEnter = { onShow }
170
+ onEnter = { ( ) => {
171
+ if ( togglerRef . current && popoverRef . current ) {
172
+ initPopper ( togglerRef . current , popoverRef . current , popperConfig )
173
+ }
174
+
175
+ onShow
176
+ } }
177
+ onEntering = { ( ) => {
178
+ if ( togglerRef . current && popoverRef . current ) {
179
+ popoverRef . current . style . display = 'initial'
180
+ }
181
+ } }
181
182
onExit = { onHide }
183
+ onExited = { ( ) => {
184
+ destroyPopper ( )
185
+ } }
182
186
timeout = { {
183
187
enter : 0 ,
184
188
exit : popoverRef . current
@@ -201,6 +205,9 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
201
205
id = { uID . current }
202
206
ref = { forkedRef }
203
207
role = "tooltip"
208
+ style = { {
209
+ display : 'none' ,
210
+ } }
204
211
{ ...rest }
205
212
>
206
213
< div className = "popover-arrow" > </ div >
Original file line number Diff line number Diff line change @@ -128,16 +128,6 @@ export const CTooltip = forwardRef<HTMLDivElement, CTooltipProps>(
128
128
setVisible ( visible )
129
129
} , [ visible ] )
130
130
131
- useEffect ( ( ) => {
132
- if ( _visible && togglerRef . current && tooltipRef . current ) {
133
- initPopper ( togglerRef . current , tooltipRef . current , popperConfig )
134
- }
135
-
136
- return ( ) => {
137
- destroyPopper ( )
138
- }
139
- } , [ _visible ] )
140
-
141
131
const toggleVisible = ( visible : boolean ) => {
142
132
if ( visible ) {
143
133
setTimeout ( ( ) => setVisible ( true ) , _delay . show )
@@ -171,8 +161,22 @@ export const CTooltip = forwardRef<HTMLDivElement, CTooltipProps>(
171
161
in = { _visible }
172
162
mountOnEnter
173
163
nodeRef = { tooltipRef }
174
- onEnter = { onShow }
164
+ onEnter = { ( ) => {
165
+ if ( togglerRef . current && tooltipRef . current ) {
166
+ initPopper ( togglerRef . current , tooltipRef . current , popperConfig )
167
+ }
168
+
169
+ onShow
170
+ } }
171
+ onEntering = { ( ) => {
172
+ if ( togglerRef . current && tooltipRef . current ) {
173
+ tooltipRef . current . style . display = 'initial'
174
+ }
175
+ } }
175
176
onExit = { onHide }
177
+ onExited = { ( ) => {
178
+ destroyPopper ( )
179
+ } }
176
180
timeout = { {
177
181
enter : 0 ,
178
182
exit : tooltipRef . current
@@ -195,6 +199,9 @@ export const CTooltip = forwardRef<HTMLDivElement, CTooltipProps>(
195
199
id = { uID . current }
196
200
ref = { forkedRef }
197
201
role = "tooltip"
202
+ style = { {
203
+ display : 'none' ,
204
+ } }
198
205
{ ...rest }
199
206
>
200
207
< div className = "tooltip-arrow" > </ div >
You can’t perform that action at this time.
0 commit comments