fix Overlay lag effect
This commit is contained in:
1 parent
30f1274405
commit
bdde0f79c1
2 files changed
+5
-2
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
|
||||||
export interface ITransitionProps {
|
export interface ITransitionProps {
|
||||||
|
extraStyle?: React.CSSProperties
|
||||||
show: boolean
|
show: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ export const Transition: React.FC<ITransitionProps> = props => {
|
|||||||
return mounted && (
|
return mounted && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
...props.extraStyle,
|
||||||
opacity,
|
opacity,
|
||||||
transition: 'all 250ms',
|
transition: 'all 250ms',
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -15,12 +15,14 @@ export const Overlay: React.FC<IOverlayProps> = props => {
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
document.body.classList.toggle('noscroll', props.show)
|
document.body.classList.toggle('noscroll', props.show)
|
||||||
|
|
||||||
}, [props.show])
|
}, [props.show])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition
|
<Transition
|
||||||
show={props.show}
|
show={props.show}
|
||||||
|
extraStyle={{
|
||||||
|
zIndex: 1000000,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
@@ -32,7 +34,6 @@ export const Overlay: React.FC<IOverlayProps> = props => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 1000000;
|
|
||||||
|
|
||||||
background-color: rgb(255, 255, 255);
|
background-color: rgb(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user