-
Notifications
You must be signed in to change notification settings - Fork 23
[MOO-2463] : Background image native not rendering fix 11-6-x #633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mx/11.6.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,8 +33,14 @@ export function BackgroundImage(props: BackgroundImageProps<BackgroundImageStyle | |
| { opacity, resizeMode } | ||
| ] as StyleProp<SvgImageStyle>; | ||
|
|
||
| // When there's no content, allow container to grow to fill available space | ||
| // When there's content, size container to content | ||
| const containerStyle = props.content | ||
| ? styles.container | ||
| : [styles.container, { flexGrow: 1, flexShrink: 1, flexBasis: "auto" as const }]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's consider switching the order of the styles in the array here, because now, if the user passes the same style props, they will be overwritten by our hard-coded ones. And for extra points, we can create a const for the hard-coded style for better readability e.g. |
||
|
|
||
| return ( | ||
| <View style={styles.container} testID={name}> | ||
| <View style={containerStyle} testID={name}> | ||
| <Image source={image.value} style={imageStyle} color={styles.image.svgColor} testID={`${name}$image`} /> | ||
| {props.content} | ||
| </View> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,7 +121,16 @@ exports[`BackgroundImage renders with default styles 1`] = ` | |
|
|
||
| exports[`BackgroundImage renders without content 1`] = ` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we can also add a snapshot test to address this scenario e.g. it("renders with visible dimensions without content", or it("fills available space when content is empty"... |
||
| <View | ||
| style={{}} | ||
| style={ | ||
| [ | ||
| {}, | ||
| { | ||
| "flexBasis": "auto", | ||
| "flexGrow": 1, | ||
| "flexShrink": 1, | ||
| }, | ||
| ] | ||
| } | ||
| testID="backgroundImageTest" | ||
| > | ||
| <Image | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also add here that the widget was not visible under specific scenario.