Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,25 @@ export function createStrictDOMComponent<T, P: StrictProps>(
} else if (displayValue === 'block' && displayInsideValue === 'flow') {
// Force the block emulation styles
nextDisplayInsideValue = 'flow';
nativeProps.style.alignItems = 'stretch';
nativeProps.style.display = 'flex';
nativeProps.style.flexBasis = 'auto';
nativeProps.style.flexDirection = 'column';
nativeProps.style.flexShrink = 0;
nativeProps.style.flexWrap = 'nowrap';
nativeProps.style.justifyContent = 'flex-start';
if (nativeProps.style.alignItems != null) {
nativeProps.style.alignItems = 'stretch';
}
if (nativeProps.style.flexBasis != null) {
nativeProps.style.flexBasis = 'auto';
}
if (nativeProps.style.flexDirection != null) {
nativeProps.style.flexDirection = 'column';
}
if (nativeProps.style.flexShrink != null) {
nativeProps.style.flexShrink = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might benefit from a little more logic, because I think flexShrink has an effect if the element is block but also a flex child

}
if (nativeProps.style.flexWrap != null) {
nativeProps.style.flexWrap = 'nowrap';
}
if (nativeProps.style.justifyContent != null) {
nativeProps.style.justifyContent = 'flex-start';
}
}

if (displayInsideValue === 'flex') {
Expand Down
5 changes: 4 additions & 1 deletion packages/react-strict-dom/tests/html-test.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ describe('<html.*>', () => {
test('block layout override of flex layout', () => {
const styles = css.create({
root: {
display: 'block',
flexBasis: '25%',
flexDirection: 'row',
alignItems: 'start',
flexShrink: '1',
display: 'block'
flexWrap: 'wrap',
justifyContent: 'flex-end'
}
});

Expand Down