Skip to main content

Overview

The TouchableHighlight component provides visual feedback by underlaying a color when pressed. Uniwind provides className prop support for styling this component.

Styling Convention

For style props: Use regular Tailwind classes directly (e.g., className="p-4").For non-style props (like underlayColor): Use the accent- prefix (e.g., underlayColorClassName="accent-bg-gray-200").

Uniwind Bindings

className
string
Maps to the style prop. Use any Tailwind utility classes.
underlayColorClassName
string
Maps to the underlayColor prop. Requires accent- prefix for color values.

Usage Example

import { TouchableHighlight, Text } from 'react-native'

<TouchableHighlight
  className="bg-blue-500 px-6 py-3 rounded-lg"
  underlayColorClassName="accent-bg-blue-600 dark:accent-bg-blue-700"
  onPress={() => console.log('Pressed')}
>
  <Text className="text-white text-center font-semibold">Press me</Text>
</TouchableHighlight>
I