0

I'm new to React Native and I struggle to understand this design decision. Why do we have separate components to handle these trivial styling changes? Do they somehow behave differently than TouchableWithoutFeedback that we'd apply opacity to either entire element or do the trick to apply opacity to the underlying View?

Why do TouchableHighlight and TouchableOpacity exist?

Robo Robok
  • 21,132
  • 17
  • 68
  • 126
  • @NicholasTower this code is for Touchables in general. I'm aware that touch gestures are not that trivial to handle. But I'm asking precisely about `TouchableHighlight` and `TouchableOpacity`. – Robo Robok Jan 29 '23 at 11:19
  • @NicholasTower after taking a look I still don't quite understand why. Most of the code doesn't seem to have anything to do with these styles. Setting the opacity is just one instruction (preceded by a condition). But it looks like all of these things would be better off as a more generic component that allows to apply styles at certain time. I'm an Apple boy, so maybe that's why I don't see the reason? Does Android use opacity on buttons that often natively? – Robo Robok Jan 29 '23 at 11:25
  • Probably a better question for the RN team than SO, but my feeling is they're convenient for new RN users, not that they were meant to be cornerstones of the framework. You may like the Pressable api better (I do). – Abe Jan 30 '23 at 03:56

0 Answers0