@@ -18,13 +18,11 @@ import type {
1818import typeof * as TStyleX from '@stylexjs/stylex' ;
1919
2020import * as React from 'react' ;
21- import { useMemo } from 'react' ;
2221import * as compat from './compat' ;
2322import * as html from './html' ;
2423import * as stylex from './stylex' ;
2524import { ProvideCustomProperties } from './modules/ContextCustomProperties' ;
2625import { ProvideViewportScale } from './modules/ContextViewportScale' ;
27- import * as ReactNative from './react-native' ;
2826
2927type StyleTheme < V , T > = Theme < V , T > ;
3028type StyleVars < T > = VarGroup < T > ;
@@ -38,11 +36,6 @@ type ProviderProps = $ReadOnly<{
3836 customProperties : ProviderValue
3937} > ;
4038
41- type ViewportProviderProps = $ReadOnly < {
42- children : React . Node ,
43- viewportWidth : number
44- } > ;
45-
4639export type { StaticStyles , StyleTheme , StyleVars , Styles , StylesWithout } ;
4740
4841function ThemeProvider ( props : ProviderProps ) : React . Node {
@@ -55,29 +48,9 @@ function ThemeProvider(props: ProviderProps): React.Node {
5548 ) ;
5649}
5750
58- function ViewportProvider ( {
59- viewportWidth : logicalViewportWidth ,
60- children
61- } : ViewportProviderProps ) : React . Node {
62- const { width : viewportWidth } = ReactNative . useWindowDimensions ( ) ;
63-
64- const viewportScale = useMemo (
65- ( ) => ( {
66- scale : viewportWidth / logicalViewportWidth
67- } ) ,
68- [ logicalViewportWidth , viewportWidth ]
69- ) ;
70-
71- return (
72- < ProvideViewportScale value = { viewportScale } >
73- { children }
74- </ ProvideViewportScale >
75- ) ;
76- }
77-
7851const contexts = {
7952 ThemeProvider : ThemeProvider as typeof ThemeProvider ,
80- ViewportProvider : ViewportProvider as typeof ViewportProvider
53+ ViewportProvider : ProvideViewportScale as typeof ProvideViewportScale
8154} ;
8255
8356// Export using StyleX types as the shim has divergent types internally.
0 commit comments