NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Stack doesn't skip space with custom component return a fragment

Open TVGSOFT opened this issue 2 years ago • 7 comments

Description

Stack doesn't skip space with custom component return a fragment

CodeSandbox/Snack link

https://snack.expo.dev/@giaptran/biased-cookie

Steps to reproduce

const CustomBox = (props: CustomBoxPops) => { const { visible, title, ...rest } = props;

if (!visible) { return <React.Fragment />; }

return <Center {...rest}>{title}</Center>; };

In case a custom component returns a fragment then Stack can not skip space Group

NativeBase Version

3.4.13

Platform

  • [ ] Android
  • [ ] CRA
  • [X] Expo
  • [ ] iOS
  • [ ] Next

Other Platform

No response

Additional Information

No response

TVGSOFT avatar Aug 25 '22 02:08 TVGSOFT

Hey @TVGSoft, Thanks for reporting the issue. We'll fix it.

ankit-tailor avatar Aug 25 '22 06:08 ankit-tailor

Hey, Instead of the fragment you can return null if you are not returning anything. This is recommended by react.

ankit-tailor avatar Aug 26 '22 12:08 ankit-tailor

Hi @ankit-tailor,

Thank you for your recommendation. But even return null, it doesn't fix this issue. I think have to update in react flatten children to skip spacing

TVGSOFT avatar Aug 26 '22 13:08 TVGSOFT

Hey @TVGSoft, We'll fix this issue.

ankit-tailor avatar Aug 29 '22 13:08 ankit-tailor

Hey ! Any news on this issue ?

mdeoliveira-hw avatar Dec 22 '22 07:12 mdeoliveira-hw

Hi! any updates on this issue ?

MatiGimenez avatar Jul 06 '23 20:07 MatiGimenez

+1 We are also hoping for this fix to come true 🤞

dmrqx avatar Aug 01 '23 19:08 dmrqx