I encountered a few times issues with margins when layouting views using flexbox.
I managed to reproduce the issue with a small code snippet:
Here is a custom component:
class MyView extends Component {
render() {
return (
<View style={
{
backgroundColor: 'green',
width: 50,
height: 50
}
}/>
);
}
}
and here is how I use it:
<View style={{ flexDirection: 'column' }}>
<MyView />
<MyView style={{ marginTop: 12 }}/>
</View>
So I am expecting to see 2 green squares on top of each other, separated by 12px (due to the marginTop). Instead here is what I see:
The two squares touch each other. I have no idea why the margin is not taken into account.
I tried debugging the bottom view with the inspector tool, here is what's getting displayed:
You can actually see the margin on this image (light orange). Any idea why the margin is not taken into account?

