@@ -31,7 +31,7 @@ import {
3131 isEnabled as ReactBrowserEventEmitterIsEnabled ,
3232 setEnabled as ReactBrowserEventEmitterSetEnabled ,
3333} from '../events/ReactBrowserEventEmitter' ;
34- import { Namespaces , getChildNamespace } from '../shared/DOMNamespaces' ;
34+ import { getChildNamespace } from '../shared/DOMNamespaces' ;
3535import { addRootEventTypesForComponentInstance } from '../events/DOMEventResponderSystem' ;
3636import {
3737 ELEMENT_NODE ,
@@ -51,8 +51,6 @@ import {
5151 mountEventResponder ,
5252 unmountEventResponder ,
5353} from '../events/DOMEventResponderSystem' ;
54- import { REACT_EVENT_TARGET_TOUCH_HIT } from 'shared/ReactSymbols' ;
55- import { canUseDOM } from 'shared/ExecutionEnvironment' ;
5654
5755export type Type = string ;
5856export type Props = {
@@ -93,7 +91,6 @@ type HostContextDev = {
9391 ancestorInfo : mixed ,
9492 eventData : null | { |
9593 isEventComponent ? : boolean ,
96- isEventTarget ?: boolean ,
9794 | } ,
9895} ;
9996type HostContextProd = string ;
@@ -109,8 +106,6 @@ import {
109106} from 'shared/ReactFeatureFlags' ;
110107import warning from 'shared/warning' ;
111108
112- const { html : HTML_NAMESPACE } = Namespaces ;
113-
114109let SUPPRESS_HYDRATION_WARNING ;
115110if ( __DEV__ ) {
116111 SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning' ;
@@ -196,45 +191,8 @@ export function getChildHostContextForEventComponent(
196191 if ( __DEV__ ) {
197192 const parentHostContextDev = ( ( parentHostContext : any ) : HostContextDev ) ;
198193 const { namespace, ancestorInfo} = parentHostContextDev ;
199- warning (
200- parentHostContextDev . eventData === null ||
201- ! parentHostContextDev . eventData . isEventTarget ,
202- 'validateDOMNesting: React event targets must not have event components as children.' ,
203- ) ;
204194 const eventData = {
205195 isEventComponent : true ,
206- isEventTarget : false ,
207- } ;
208- return { namespace, ancestorInfo, eventData} ;
209- }
210- return parentHostContext ;
211- }
212-
213- export function getChildHostContextForEventTarget (
214- parentHostContext : HostContext ,
215- type : Symbol | number ,
216- ) : HostContext {
217- if ( __DEV__ ) {
218- const parentHostContextDev = ( ( parentHostContext : any ) : HostContextDev ) ;
219- const { namespace, ancestorInfo} = parentHostContextDev ;
220- if ( type === REACT_EVENT_TARGET_TOUCH_HIT ) {
221- warning (
222- parentHostContextDev . eventData === null ||
223- ! parentHostContextDev . eventData . isEventComponent ,
224- 'validateDOMNesting: <TouchHitTarget> cannot not be a direct child of an event component. ' +
225- 'Ensure <TouchHitTarget> is a direct child of a DOM element.' ,
226- ) ;
227- const parentNamespace = parentHostContextDev . namespace ;
228- if ( parentNamespace !== HTML_NAMESPACE ) {
229- throw new Error (
230- '<TouchHitTarget> was used in an unsupported DOM namespace. ' +
231- 'Ensure the <TouchHitTarget> is used in an HTML namespace.' ,
232- ) ;
233- }
234- }
235- const eventData = {
236- isEventComponent : false ,
237- isEventTarget : true ,
238196 } ;
239197 return { namespace, ancestorInfo, eventData} ;
240198 }
@@ -924,85 +882,3 @@ export function unmountEventComponent(
924882 unmountEventResponder ( eventComponentInstance ) ;
925883 }
926884}
927-
928- export function getEventTargetChildElement (
929- type : Symbol | number ,
930- props : Props ,
931- ) : null | EventTargetChildElement {
932- if ( enableEventAPI ) {
933- if ( type === REACT_EVENT_TARGET_TOUCH_HIT ) {
934- const { bottom, left, right, top} = props ;
935-
936- if ( ! bottom && ! left && ! right && ! top ) {
937- return null ;
938- }
939- return {
940- type : 'div' ,
941- props : {
942- style : {
943- position : 'absolute' ,
944- zIndex : - 1 ,
945- pointerEvents : null ,
946- bottom : bottom ? `-${ bottom } px` : '0px' ,
947- left : left ? `-${ left } px` : '0px' ,
948- right : right ? `-${ right } px` : '0px' ,
949- top : top ? `-${ top } px` : '0px' ,
950- } ,
951- hydrateTouchHitTarget : true ,
952- suppressHydrationWarning : true ,
953- } ,
954- } ;
955- }
956- }
957- return null ;
958- }
959-
960- export function handleEventTarget (
961- type : Symbol | number ,
962- props : Props ,
963- rootContainerInstance : Container ,
964- internalInstanceHandle : Object ,
965- ) : boolean {
966- if (
967- __DEV__ &&
968- type === REACT_EVENT_TARGET_TOUCH_HIT &&
969- ( props . left || props . right || props . top || props . bottom )
970- ) {
971- return true ;
972- }
973- return false ;
974- }
975-
976- export function commitEventTarget (
977- type : Symbol | number ,
978- props : Props ,
979- instance : Instance ,
980- parentInstance : Instance ,
981- ) : void {
982- if ( enableEventAPI ) {
983- if ( type === REACT_EVENT_TARGET_TOUCH_HIT ) {
984- if ( __DEV__ && canUseDOM ) {
985- // This is done at DEV time because getComputedStyle will
986- // typically force a style recalculation and force a layout,
987- // reflow -– both of which are sync are expensive.
988- const computedStyles = window . getComputedStyle ( parentInstance ) ;
989- const position = computedStyles . getPropertyValue ( 'position' ) ;
990- warning (
991- position !== '' && position !== 'static' ,
992- '<TouchHitTarget> inserts an empty absolutely positioned <div>. ' +
993- 'This requires its parent DOM node to be positioned too, but the ' +
994- 'parent DOM node was found to have the style "position" set to ' +
995- 'either no value, or a value of "static". Try using a "position" ' +
996- 'value of "relative".' ,
997- ) ;
998- warning (
999- computedStyles . getPropertyValue ( 'z-index' ) !== '' ,
1000- '<TouchHitTarget> inserts an empty <div> with "z-index" of "-1". ' +
1001- 'This requires its parent DOM node to have a "z-index" greater than "-1",' +
1002- 'but the parent DOM node was found to no "z-index" value set.' +
1003- ' Try using a "z-index" value of "0" or greater.' ,
1004- ) ;
1005- }
1006- }
1007- }
1008- }
0 commit comments