79676531

Date: 2025-06-23 17:10:31
Score: 3.5
Natty:
Report link

The answer was too easy for me to see it right before my eyes. I needed to add:

    width: '100%',

to the TouchableHighlight's style.

Check out the new Snack

<https://snack.expo.dev/@rjapenga/touchablehighlight-fixed>

I was under the mistaken impression that "flex: 1" meant that the item would grow to the size of the available container both vertically and horizontally and thus I never tried width. For the life of me, I cannot find where the React Native documentation tells me that:

"Flexbox works the same way in React Native as it does in CSS on the web, with a few exceptions."

<https://reactnative.dev/docs/flexbox>

Their example seems to imply that I don't need to say width: '100%' and I cannot find where the explain this particular exception.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Blacklisted phrase (1.5): I cannot find
  • Blacklisted phrase (0.5): I cannot
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: rjapenga