@@ -11,9 +11,7 @@ import type { ReactNativeProps } from '../../types/renderer.native';
1111import type { StrictProps as StrictPropsOriginal } from '../../types/StrictProps' ;
1212
1313import * as React from 'react' ;
14- import { Animated , Pressable } from 'react-native' ;
15- import { experimental_LayoutConformance as LayoutConformance } from 'react-native' ;
16- import { ViewNativeComponent , TextAncestorContext } from '../react-native' ;
14+ import * as ReactNative from '../react-native' ;
1715
1816import { ProvideCustomProperties } from './ContextCustomProperties' ;
1917import { ProvideDisplayInside , useDisplayInside } from './ContextDisplayInside' ;
@@ -29,10 +27,10 @@ type StrictProps = $ReadOnly<{
2927 children ?: React . Node | ( ( ReactNativeProps ) => React . Node )
3028} > ;
3129
32- const AnimatedPressable = Animated . createAnimatedComponent <
33- React . ElementConfig < typeof Pressable > ,
34- typeof Pressable
35- > ( Pressable ) ;
30+ const AnimatedPressable = ReactNative . Animated . createAnimatedComponent <
31+ React . ElementConfig < typeof ReactNative . Pressable > ,
32+ typeof ReactNative . Pressable
33+ > ( ReactNative . Pressable ) ;
3634
3735export function createStrictDOMComponent < T , P : StrictProps > (
3836 tagName : string ,
@@ -41,9 +39,11 @@ export function createStrictDOMComponent<T, P: StrictProps>(
4139 const component : React . AbstractComponent < P , T > = React . forwardRef (
4240 function ( props , forwardedRef ) {
4341 let NativeComponent =
44- tagName === 'button' ? Pressable : ViewNativeComponent ;
42+ tagName === 'button'
43+ ? ReactNative . Pressable
44+ : ReactNative . ViewNativeComponent ;
4545 const elementRef = useStrictDOMElement < T > ( { tagName } ) ;
46- const hasTextAncestor = React . useContext ( TextAncestorContext ) ;
46+ const hasTextAncestor = React . useContext ( ReactNative . TextAncestorContext ) ;
4747
4848 /**
4949 * Resolve global HTML and style props
@@ -59,9 +59,9 @@ export function createStrictDOMComponent<T, P: StrictProps>(
5959
6060 if (
6161 nativeProps . onPress != null &&
62- NativeComponent === ViewNativeComponent
62+ NativeComponent === ReactNative . ViewNativeComponent
6363 ) {
64- NativeComponent = Pressable ;
64+ NativeComponent = ReactNative . Pressable ;
6565 }
6666
6767 // Tag-specific props
@@ -78,7 +78,7 @@ export function createStrictDOMComponent<T, P: StrictProps>(
7878
7979 // Component-specific props
8080
81- if ( NativeComponent === Pressable ) {
81+ if ( NativeComponent === ReactNative . Pressable ) {
8282 if ( props . disabled === true ) {
8383 nativeProps . disabled = true ;
8484 nativeProps . focusable = false ;
@@ -142,10 +142,10 @@ export function createStrictDOMComponent<T, P: StrictProps>(
142142
143143 // Use Animated components if necessary
144144 if ( nativeProps . animated === true ) {
145- if ( NativeComponent === ViewNativeComponent ) {
146- NativeComponent = Animated . View ;
145+ if ( NativeComponent === ReactNative . ViewNativeComponent ) {
146+ NativeComponent = ReactNative . Animated . View ;
147147 }
148- if ( NativeComponent === Pressable ) {
148+ if ( NativeComponent === ReactNative . Pressable ) {
149149 NativeComponent = AnimatedPressable ;
150150 }
151151 }
@@ -164,7 +164,9 @@ export function createStrictDOMComponent<T, P: StrictProps>(
164164
165165 // Enable W3C layout support
166166 if ( props [ 'data-layoutconformance' ] === 'strict' ) {
167- element = < LayoutConformance children = { element } mode = "strict" /> ;
167+ element = (
168+ < ReactNative . LayoutConformance children = { element } mode = "strict" />
169+ ) ;
168170 }
169171
170172 if (
@@ -200,9 +202,9 @@ export function createStrictDOMComponent<T, P: StrictProps>(
200202
201203 if ( hasTextAncestor ) {
202204 return (
203- < TextAncestorContext . Provider value = { false } >
205+ < ReactNative . TextAncestorContext . Provider value = { false } >
204206 { element }
205- </ TextAncestorContext . Provider >
207+ </ ReactNative . TextAncestorContext . Provider >
206208 ) ;
207209 }
208210
0 commit comments