Skip to content

Commit 4776ebd

Browse files
sherginfacebook-github-bot
authored andcommitted
Fabric: A demo in RNTester for display: none
Summary: An interactive demo that stress-tests the `display: none` feature. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D22336304 fbshipit-source-id: 43855e979d45b4bdfdcf82f6b805a4f4af868368
1 parent 3c69a9e commit 4776ebd

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

RNTester/js/examples/View/ViewExample.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,79 @@ exports.examples = [
441441
return <ZIndexExample />;
442442
},
443443
},
444+
{
445+
title: '`display: none` style',
446+
render(): React.Node {
447+
type Props = $ReadOnly<{||}>;
448+
type State = {|
449+
index: number,
450+
|};
451+
452+
class DisplayNoneStyle extends React.Component<Props, State> {
453+
state = {
454+
index: 0,
455+
};
456+
457+
render() {
458+
return (
459+
<TouchableWithoutFeedback onPress={this._handlePress}>
460+
<View>
461+
<Text style={{paddingBottom: 10}}>
462+
Press to toggle `display: none`
463+
</Text>
464+
<View
465+
style={{
466+
height: 50,
467+
width: 50,
468+
backgroundColor: 'red',
469+
display: this.state.index % 2 === 0 ? 'none' : 'flex',
470+
}}
471+
/>
472+
<View
473+
style={{
474+
height: 50,
475+
width: 50,
476+
backgroundColor: 'blue',
477+
display: this.state.index % 3 === 0 ? 'none' : 'flex',
478+
}}
479+
/>
480+
<View
481+
style={{
482+
height: 50,
483+
width: 50,
484+
backgroundColor: 'yellow',
485+
display: this.state.index % 5 === 0 ? 'none' : 'flex',
486+
}}>
487+
<View
488+
style={{
489+
height: 30,
490+
width: 30,
491+
backgroundColor: 'salmon',
492+
display: this.state.index % 11 === 0 ? 'none' : 'flex',
493+
}}
494+
/>
495+
</View>
496+
<View
497+
style={{
498+
height: 50,
499+
width: 50,
500+
backgroundColor: 'magenta',
501+
display: this.state.index % 7 === 0 ? 'none' : 'flex',
502+
}}
503+
/>
504+
</View>
505+
</TouchableWithoutFeedback>
506+
);
507+
}
508+
509+
_handlePress = () => {
510+
this.setState({index: this.state.index + 1});
511+
};
512+
}
513+
514+
return <DisplayNoneStyle />;
515+
},
516+
},
444517
{
445518
title: 'BackfaceVisibility',
446519
render: function(): React.Node {

0 commit comments

Comments
 (0)