File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
components/TooltipController Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,14 @@ const TooltipController = ({
168
168
setTooltipPositionStrategy ( positionStrategy )
169
169
} , [ positionStrategy ] )
170
170
171
+ useEffect ( ( ) => {
172
+ if ( typeof window !== 'undefined' ) {
173
+ // here we can do validations related to the props before inject the styles,
174
+ // we can also send something into the 'detail' to the inject style function
175
+ window . dispatchEvent ( new CustomEvent ( 'rt_inject_styles' , { detail : { } } ) )
176
+ }
177
+ } , [ ] )
178
+
171
179
useEffect ( ( ) => {
172
180
const elementRefs = new Set ( anchorRefs )
173
181
Original file line number Diff line number Diff line change @@ -20,8 +20,12 @@ import type { ITooltipWrapper } from './components/TooltipProvider/TooltipProvid
20
20
const TooltipCoreStyles = 'react-tooltip-core-css-placeholder'
21
21
const TooltipStyles = 'react-tooltip-css-placeholder'
22
22
23
- injectStyle ( { css : TooltipCoreStyles , type : 'core' } )
24
- injectStyle ( { css : TooltipStyles } )
23
+ if ( typeof window !== 'undefined' ) {
24
+ window . addEventListener ( 'rt_inject_styles' , ( ) => {
25
+ injectStyle ( { css : TooltipCoreStyles , type : 'core' } )
26
+ injectStyle ( { css : TooltipStyles } )
27
+ } )
28
+ }
25
29
26
30
export { TooltipController as Tooltip } from './components/TooltipController'
27
31
export { TooltipProvider , TooltipWrapper } from './components/TooltipProvider'
You can’t perform that action at this time.
0 commit comments