@@ -95,6 +95,36 @@ class NoneExample extends React.Component<$FlowFixMeProps> {
9595 }
9696}
9797
98+ class NoneStyleExample extends React . Component < $FlowFixMeProps > {
99+ render ( ) : React . Node {
100+ return (
101+ < View
102+ onTouchStart = { ( ) => this . props . onLog ( 'A unspecified touched' ) }
103+ style = { styles . box } >
104+ < DemoText style = { styles . text } > A: unspecified</ DemoText >
105+ < View
106+ onTouchStart = { ( ) => this . props . onLog ( 'B none touched' ) }
107+ style = { [
108+ styles . box ,
109+ styles . boxPassedThrough ,
110+ styles . pointerEventNone ,
111+ ] } >
112+ < DemoText style = { [ styles . text , styles . textPassedThrough ] } >
113+ B: none
114+ </ DemoText >
115+ < View
116+ onTouchStart = { ( ) => this . props . onLog ( 'C unspecified touched' ) }
117+ style = { [ styles . box , styles . boxPassedThrough ] } >
118+ < DemoText style = { [ styles . text , styles . textPassedThrough ] } >
119+ C: unspecified
120+ </ DemoText >
121+ </ View >
122+ </ View >
123+ </ View >
124+ ) ;
125+ }
126+ }
127+
98128/**
99129 * Special demo text that makes itself untouchable so that it doesn't destroy
100130 * the experiment and confuse the output.
@@ -142,6 +172,41 @@ class BoxNoneExample extends React.Component<$FlowFixMeProps> {
142172 }
143173}
144174
175+ class BoxNoneStyleExample extends React . Component < $FlowFixMeProps > {
176+ render ( ) : React . Node {
177+ return (
178+ < View
179+ onTouchStart = { ( ) => this . props . onLog ( 'A unspecified touched' ) }
180+ style = { styles . box } >
181+ < DemoText style = { styles . text } > A: unspecified</ DemoText >
182+ < View
183+ onTouchStart = { ( ) => this . props . onLog ( 'B box-none touched' ) }
184+ style = { [
185+ styles . box ,
186+ styles . boxPassedThrough ,
187+ styles . pointerEventBoxNone ,
188+ ] } >
189+ < DemoText style = { [ styles . text , styles . textPassedThrough ] } >
190+ B: box-none
191+ </ DemoText >
192+ < View
193+ onTouchStart = { ( ) => this . props . onLog ( 'C unspecified touched' ) }
194+ style = { styles . box } >
195+ < DemoText style = { styles . text } > C: unspecified</ DemoText >
196+ </ View >
197+ < View
198+ onTouchStart = { ( ) =>
199+ this . props . onLog ( 'C explicitly unspecified touched' )
200+ }
201+ style = { [ styles . box , styles . pointerEventAuto ] } >
202+ < DemoText style = { [ styles . text ] } > C: explicitly unspecified</ DemoText >
203+ </ View >
204+ </ View >
205+ </ View >
206+ ) ;
207+ }
208+ }
209+
145210class BoxOnlyExample extends React . Component < $FlowFixMeProps > {
146211 render ( ) : React . Node {
147212 return (
@@ -177,6 +242,43 @@ class BoxOnlyExample extends React.Component<$FlowFixMeProps> {
177242 }
178243}
179244
245+ class BoxOnlyStyleExample extends React . Component < $FlowFixMeProps > {
246+ render ( ) : React . Node {
247+ return (
248+ < View
249+ onTouchStart = { ( ) => this . props . onLog ( 'A unspecified touched' ) }
250+ style = { styles . box } >
251+ < DemoText style = { styles . text } > A: unspecified</ DemoText >
252+ < View
253+ onTouchStart = { ( ) => this . props . onLog ( 'B box-only touched' ) }
254+ style = { [ styles . box , styles . pointerEventBoxOnly ] } >
255+ < DemoText style = { styles . text } > B: box-only</ DemoText >
256+ < View
257+ onTouchStart = { ( ) => this . props . onLog ( 'C unspecified touched' ) }
258+ style = { [ styles . box , styles . boxPassedThrough ] } >
259+ < DemoText style = { [ styles . text , styles . textPassedThrough ] } >
260+ C: unspecified
261+ </ DemoText >
262+ </ View >
263+ < View
264+ onTouchStart = { ( ) =>
265+ this . props . onLog ( 'C explicitly unspecified touched' )
266+ }
267+ style = { [
268+ styles . box ,
269+ styles . boxPassedThrough ,
270+ styles . pointerEventAuto ,
271+ ] } >
272+ < DemoText style = { [ styles . text , styles . textPassedThrough ] } >
273+ C: explicitly unspecified
274+ </ DemoText >
275+ </ View >
276+ </ View >
277+ </ View >
278+ ) ;
279+ }
280+ }
281+
180282type OverflowExampleProps = $ReadOnly < { |
181283 overflow : 'hidden' | 'visible' ,
182284 onLog : ( msg : string ) => void ,
@@ -242,18 +344,36 @@ const exampleClasses: Array<ExampleClass> = [
242344 description :
243345 '`none` causes touch events on the container and its child components to pass through to the parent container.' ,
244346 } ,
347+ {
348+ Component : NoneStyleExample ,
349+ title : '`none` style' ,
350+ description :
351+ '`none` causes touch events on the container and its child components to pass through to the parent container.' ,
352+ } ,
245353 {
246354 Component : BoxNoneExample ,
247355 title : '`box-none`' ,
248356 description :
249357 '`box-none` causes touch events on the container to pass through and will only detect touch events on its child components.' ,
250358 } ,
359+ {
360+ Component : BoxNoneStyleExample ,
361+ title : '`box-none` style' ,
362+ description :
363+ '`box-none` causes touch events on the container to pass through and will only detect touch events on its child components.' ,
364+ } ,
251365 {
252366 Component : BoxOnlyExample ,
253367 title : '`box-only`' ,
254368 description :
255369 "`box-only` causes touch events on the container's child components to pass through and will only detect touch events on the container itself." ,
256370 } ,
371+ {
372+ Component : BoxOnlyStyleExample ,
373+ title : '`box-only` style' ,
374+ description :
375+ "`box-only` causes touch events on the container's child components to pass through and will only detect touch events on the container itself." ,
376+ } ,
257377 {
258378 Component : OverflowVisibleExample ,
259379 title : '`overflow: visible`' ,
@@ -326,6 +446,18 @@ const styles = StyleSheet.create({
326446 borderColor : '#f0f0f0' ,
327447 backgroundColor : '#f9f9f9' ,
328448 } ,
449+ pointerEventBoxNone : {
450+ pointerEvents : 'box-none' ,
451+ } ,
452+ pointerEventBoxOnly : {
453+ pointerEvents : 'box-only' ,
454+ } ,
455+ pointerEventNone : {
456+ pointerEvents : 'none' ,
457+ } ,
458+ pointerEventAuto : {
459+ pointerEvents : 'auto' ,
460+ } ,
329461} ) ;
330462
331463exports . framework = 'React' ;
0 commit comments