GeekyAnts / NativeBase

Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web.
https://nativebase.io/
MIT License
20.19k stars 2.39k forks source link

Can ListItem use TouchableOpacity instead of TouchableHighlight? #3154

Closed Aryk closed 4 years ago

Aryk commented 4 years ago

I looked through the documentation and cheatsheets.

If I want ListItems to have that TouchableOpacity effect instead of TouchableHighlight, how can that be customized?

That seems it would have to switch what the ListItem is wrapped with.

Is this just something we can't customize?

arochedy commented 4 years ago

I think you can't customize, you can only update the ListItem component to use TouchableOpacity instead of TouchableHighlight

hanykumar commented 4 years ago

Hi @Aryk, yes, you cannot customize. For Android, it is TouchableNativeFeedback and for iOS & web, it is TouchableHighlight by default. But you can make changes manually in node_nodules/native-base/src/basic/ListItem.js from TouchableHighlight to TouchableOpacity.

Aryk commented 4 years ago

@hanykumar You can but how would I make those changes carry over into production? Or when I re-install node modules?

Really... there should be an ability to pass a way to overwrite the component with your own TouchableHighlight / TouchableNativeFeedback.

For example...if I want it to use TouchableHighlight from react-native-gesture-handler library...how can I do that without something super hacky?

shivrajkumar commented 4 years ago

@Aryk There isn't any way to do this in NativeBase. But to achieve this, you can just wrap a ListItem of NativeBase with TouchableOpacity, that should do the trick.

Closing this for now, let us know if you need further clarification/help on this.