Skip to content

Commit

Permalink
Add RNTester box sizing example and e2e test round 2
Browse files Browse the repository at this point in the history
Differential Revision: D63844898
  • Loading branch information
joevilches authored and facebook-github-bot committed Oct 3, 2024
1 parent cce69e4 commit 16c9acd
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/rn-tester/js/examples/View/ViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,37 @@ function OutlineExample(): React.Node {
);
}

function BoxSizingExample(): React.Node {
const styles = StyleSheet.create({
boxSizingBox: {
padding: 5,
backgroundColor: 'green',
borderWidth: 5,
margin: 10,
width: 50,
height: 25,
},
boxSizingChild: {
backgroundColor: 'red',
width: '100%',
height: '100%',
},
});

return (
<View testID={'view-test-box-sizing'}>
<Text>Content box 50x25</Text>
<View style={[styles.boxSizingBox, {boxSizing: 'content-box'}]}>
<View style={styles.boxSizingChild} />
</View>
<Text>Border box 50x25</Text>
<View style={[styles.boxSizingBox, {boxSizing: 'border-box'}]}>
<View style={styles.boxSizingChild} />
</View>
</View>
);
}

export default ({
title: 'View',
documentationURL: 'https://reactnative.dev/docs/view',
Expand Down Expand Up @@ -1312,5 +1343,10 @@ export default ({
name: 'outline',
render: OutlineExample,
},
{
title: 'Box Sizing',
name: 'box-sizing',
render: BoxSizingExample,
},
],
}: RNTesterModule);

0 comments on commit 16c9acd

Please sign in to comment.