diff --git a/fixtures/view-transition/src/components/Page.css b/fixtures/view-transition/src/components/Page.css index 06100a53e8c..63ae718e740 100644 --- a/fixtures/view-transition/src/components/Page.css +++ b/fixtures/view-transition/src/components/Page.css @@ -1,12 +1,3 @@ -.roboto-font { - font-family: "Roboto", serif; - font-optical-sizing: auto; - font-weight: 100; - font-style: normal; - font-variation-settings: - "wdth" 100; -} - .swipe-recognizer { width: 300px; background: #eee; diff --git a/fixtures/view-transition/src/components/Page.js b/fixtures/view-transition/src/components/Page.js index 6227e9ebc5f..f7ad38f4388 100644 --- a/fixtures/view-transition/src/components/Page.js +++ b/fixtures/view-transition/src/components/Page.js @@ -4,6 +4,7 @@ import React, { Activity, useLayoutEffect, useEffect, + useInsertionEffect, useState, useId, useOptimistic, @@ -41,6 +42,26 @@ const b = ( ); function Component() { + // Test inserting fonts with style tags using useInsertionEffect. This is not recommended but + // used to test that gestures etc works with useInsertionEffect so that stylesheet based + // libraries can be properly supported. + useInsertionEffect(() => { + const style = document.createElement('style'); + style.textContent = ` + .roboto-font { + font-family: "Roboto", serif; + font-optical-sizing: auto; + font-weight: 100; + font-style: normal; + font-variation-settings: + "wdth" 100; + } + `; + document.head.appendChild(style); + return () => { + document.head.removeChild(style); + }; + }, []); return (