Skip to content

Commit

Permalink
Fix some cases where contents of padding overflowed bottom.
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswilddev committed Nov 24, 2021
1 parent 0da7cc6 commit ecdcf95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
2 changes: 2 additions & 0 deletions components/createPaddingComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const globalStyles = StyleSheet.create({
containerFillingView: {
width: `100%`,
height: `100%`,
flex: 1,
},
});

Expand Down Expand Up @@ -80,6 +81,7 @@ export const createPaddingComponent = (
contentFittingView,
containerFillingView: {
...contentFittingView,
flex: 1,
width: `100%`,
height: `100%`,
},
Expand Down
31 changes: 21 additions & 10 deletions components/createPaddingComponent/unit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ test(`renders container-filling with one zero`, () => {
);

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View style={{ width: `100%`, height: `100%` }} pointerEvents="box-none">
<View
style={{ width: `100%`, height: `100%`, flex: 1 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
</View>
);
Expand All @@ -233,7 +236,7 @@ test(`renders container-filling with one non-zero`, () => {

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View
style={{ width: `100%`, height: `100%`, padding: 30 }}
style={{ width: `100%`, height: `100%`, flex: 1, padding: 30 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
Expand All @@ -251,7 +254,10 @@ test(`renders container-filling with two zeroes`, () => {
);

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View style={{ width: `100%`, height: `100%` }} pointerEvents="box-none">
<View
style={{ width: `100%`, height: `100%`, flex: 1 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
</View>
);
Expand All @@ -268,7 +274,7 @@ test(`renders container-filling with one non-zero and one zero`, () => {

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View
style={{ width: `100%`, height: `100%`, paddingVertical: 30 }}
style={{ width: `100%`, height: `100%`, flex: 1, paddingVertical: 30 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
Expand All @@ -287,7 +293,7 @@ test(`renders container-filling with one zero and one non-zero`, () => {

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View
style={{ width: `100%`, height: `100%`, paddingHorizontal: 30 }}
style={{ width: `100%`, height: `100%`, flex: 1, paddingHorizontal: 30 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
Expand All @@ -309,6 +315,7 @@ test(`renders container-filling with two non-zeroes`, () => {
style={{
width: `100%`,
height: `100%`,
flex: 1,
paddingVertical: 30,
paddingHorizontal: 50,
}}
Expand All @@ -329,7 +336,10 @@ test(`renders container-filling with four zeroes`, () => {
);

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View style={{ width: `100%`, height: `100%` }} pointerEvents="box-none">
<View
style={{ width: `100%`, height: `100%`, flex: 1 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
</View>
);
Expand All @@ -346,7 +356,7 @@ test(`renders container-filling with non-zero top`, () => {

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View
style={{ width: `100%`, height: `100%`, paddingTop: 30 }}
style={{ width: `100%`, height: `100%`, flex: 1, paddingTop: 30 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
Expand All @@ -365,7 +375,7 @@ test(`renders container-filling with non-zero right`, () => {

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View
style={{ width: `100%`, height: `100%`, paddingRight: 30 }}
style={{ width: `100%`, height: `100%`, flex: 1, paddingRight: 30 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
Expand All @@ -384,7 +394,7 @@ test(`renders container-filling with non-zero bottom`, () => {

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View
style={{ width: `100%`, height: `100%`, paddingBottom: 30 }}
style={{ width: `100%`, height: `100%`, flex: 1, paddingBottom: 30 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
Expand All @@ -403,7 +413,7 @@ test(`renders container-filling with non-zero left`, () => {

expect(unwrapRenderedFunctionComponent(rendered)).toEqual(
<View
style={{ width: `100%`, height: `100%`, paddingLeft: 30 }}
style={{ width: `100%`, height: `100%`, flex: 1, paddingLeft: 30 }}
pointerEvents="box-none"
>
<Text>Test Content</Text>
Expand All @@ -425,6 +435,7 @@ test(`renders container-filling with four non-zeroes`, () => {
style={{
width: `100%`,
height: `100%`,
flex: 1,
paddingTop: 30,
paddingRight: 50,
paddingBottom: 27,
Expand Down

0 comments on commit ecdcf95

Please sign in to comment.