YGNode zero size when combine flex-direction: column and flex-direction: row on a fifth block
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18.9k
- Forks
- 1.6k
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Report
- I have searched existing issues and this is not a duplicate
Issues and Steps to Reproduce
Trying to launch the next layout in react-native app. Published in this repository and in expo shack
import { Text, View, StyleSheet } from 'react-native';
import { TextInput } from 'react-native-paper';
export const WithBaseline = ({
style,
children,
}) => (
<View style={[styles.withBaselineRoot, style]}>
<View style={styles.withBaseline}>
{children}
</View>
<View style={styles.adjust} />
</View>
);
const NoBaseline = ({
style,
children,
}) => (
<View style={[styles.noBaselineRoot, style]}>
{children}
</View>
);
const FieldWrapper = ({
style,
children,
}) => (
<View style={[styles.fieldWrapperRoot, style]}>
{children}
</View>
);
export default function App() {
return (
<NoBaseline style={{ flexGrow: 1 }}>
<FieldWrapper style={{ width: '100%', height: 125, justifyContent: 'center' }}>
<Text>Group 1</Text>
</FieldWrapper>
<WithBaseline style={{ width: '100%' }}>
<FieldWrapper style={{ width: '25%' }}>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
</FieldWrapper>
<FieldWrapper style={{ width: '25%' }}>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
</FieldWrapper>
<FieldWrapper style={{ width: '25%' }}>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
</FieldWrapper>
<FieldWrapper style={{ width: '25%' }}>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
</FieldWrapper>
</WithBaseline>
<FieldWrapper style={{ width: '100%', height: 125, justifyContent: 'center' }}>
<Text>Group 2</Text>
</FieldWrapper>
<WithBaseline style={{ width: '100%' }}>
<FieldWrapper style={{ width: '33%' }}>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
</FieldWrapper>
<FieldWrapper style={{ width: '33%' }}>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
</FieldWrapper>
<FieldWrapper style={{ width: '33%' }}>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
<TextInput
label="Email"
/>
</FieldWrapper>
</WithBaseline>
</NoBaseline>
);
}
const styles = StyleSheet.create({
withBaselineRoot: {
flexDirection: 'column',
},
noBaselineRoot: {
alignItems: 'flex-start',
flexDirection: 'row',
flexWrap: 'wrap',
},
fieldWrapperRoot: {
flexDirection: 'column',
},
withBaseline: {
alignItems: 'flex-end',
flexDirection: 'row',
flexWrap: 'wrap',
},
adjust: {
width: '100%',
flex: 1,
},
});
Expected Behavior
When testing with react-native-web I am receiving the correct layout
Actual Behavior
But on iOS and Android both the Group 2 is not shown. That means this is not a platform specific problem. Affected all platforms, both of them use Yoga Layout engine
Changing all <WithBaseline /> to <NoBaseline/> temporary solves the problem.
Link to Code
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked bug reproducer and compare its layout with the React Native Web result, focusing on the fifth block and the nested row/column flex containers. Reproduce the missing Group 2 on iOS and Android; done means the same layout renders Group 2 on both native platforms without replacing WithBaseline with NoBaseline.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, react-native
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100