File tree 1 file changed +16
-2
lines changed
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
- import { FC , useContext , ComponentProps , ComponentType } from 'react' ;
1
+ import {
2
+ FC ,
3
+ useContext ,
4
+ useState ,
5
+ useEffect ,
6
+ ComponentProps ,
7
+ ComponentType ,
8
+ } from 'react' ;
2
9
import ReactSelect , {
3
10
components ,
4
11
OptionsType ,
@@ -82,6 +89,13 @@ export const Select: FC<SelectProps> = ({
82
89
...props
83
90
} ) => {
84
91
const currentTheme = useContext ( ThemeContext ) ;
92
+ const [ menuPortalTarget , setMenuPortalTarget ] = useState <
93
+ HTMLElement | undefined
94
+ > ( ) ;
95
+
96
+ useEffect ( ( ) => {
97
+ setMenuPortalTarget ( document . body ) ;
98
+ } , [ ] ) ;
85
99
86
100
// @TODO : properly type this function
87
101
const handleChange = ( e ?: any ) => {
@@ -124,7 +138,7 @@ export const Select: FC<SelectProps> = ({
124
138
onChange = { handleChange }
125
139
noIcon = { noIcon }
126
140
menuPlacement = "auto"
127
- menuPortalTarget = { document . body }
141
+ menuPortalTarget = { menuPortalTarget }
128
142
backspaceRemovesValue = { false }
129
143
{ ...props }
130
144
/>
You can’t perform that action at this time.
0 commit comments