fix(core): fix viewtransition and css property missing (#7377)

This commit is contained in:
EYHN
2024-06-28 18:03:43 +08:00
committed by GitHub
parent fbf676002f
commit 824be0d4c1
2 changed files with 13 additions and 5 deletions

View File

@@ -13,7 +13,11 @@ import {
borderAngle3,
} from './styles.css';
if (typeof window !== 'undefined' && window.CSS) {
if (
typeof window !== 'undefined' &&
window.CSS &&
window.CSS.registerProperty
) {
const getName = (nameWithVar: string) => nameWithVar.slice(4, -1);
const registerAngle = (varName: string, initialValue: number) => {
window.CSS.registerProperty({

View File

@@ -103,11 +103,15 @@ export const PeekViewModalContainer = forwardRef<
) {
const [vtOpen, setVtOpen] = useState(open);
useEffect(() => {
document.startViewTransition(() => {
flushSync(() => {
setVtOpen(open);
if (document.startViewTransition) {
document.startViewTransition(() => {
flushSync(() => {
setVtOpen(open);
});
});
});
} else {
setVtOpen(open);
}
}, [open]);
useEffect(() => {