grapp-dev / stacks

A set of components for building layouts in React Native. Powered by React Native Unistyles.
https://stacks.grapp.dev
MIT License
985 stars 24 forks source link

`align` prop has no effect when used in combination with `horizontal` prop on Stack component #18

Closed garrettjoecox closed 3 years ago

garrettjoecox commented 3 years ago

Given the example stack

<Stack space={4}>
  <Box style={{ backgroundColor: 'red', height: 30, width: 30 }} />
  <Box style={{ backgroundColor: 'red', height: 50, width: 50 }} />
  <Box style={{ backgroundColor: 'red', height: 20, width: 20 }} />
  <Box style={{ backgroundColor: 'red', height: 60, width: 60 }} />
</Stack>

Applying align="center" has the same effect as adding style={{ alignItems: 'center' }}, this is expected. However when you add horizontal, the align prop no longer seems to have an effect.

I would expect it to either have the same effect as adding style={{ justifiyContent: 'center' }}, or have a separate alignX & alignY props similar to the other components.

mobily commented 3 years ago

@garrettjoecox 👋 thanks for pointing that out! you're right, it was missing in the Stack implementation :) fixed in v1.1.2, please see the docs https://mobily.github.io/stacks/docs/components/stack (there's a new example)