tailwind-react-native-classnames icon indicating copy to clipboard operation
tailwind-react-native-classnames copied to clipboard

twrnc not accounting for user configured tailwind prefix

Open dumptyd opened this issue 11 months ago • 3 comments

tailwind.config.js (https://v3.tailwindcss.com/docs/configuration#prefix)

/** @type {import('tailwindcss').Config} */
module.exports = {
  prefix: 'tw-',
}
import tw from 'twrnc';
const styles = tw`tw-border`; // λ  WARN  `tw-border` unknown or invalid utility 

Though it does work if I use the un-prefixed classes (with the prefix still enabled in the config) but that breaks intellisense.

dumptyd avatar Feb 03 '25 00:02 dumptyd

https://github.com/jaredh159/tailwind-react-native-classnames?tab=readme-ov-file#customization

Should've read the docs more carefully, my bad.

Though when I use that I'm running into tailwindcss plugin function argument object prop "web" not implemented. I'm not using any plugins.

dumptyd avatar Feb 03 '25 00:02 dumptyd

Ah I believe it's because of the presets. When I get rid of it the error goes away but the prefixed classes still don't work.

/** @type {import('tailwindcss').Config} */
module.exports = {
  prefix: 'tw-',
  presets: [require('nativewind/preset')],// <---- this
  // ...
};

dumptyd avatar Feb 03 '25 01:02 dumptyd

yeah, i'm not sure you should try to combine nativewind and twrnc, they're both doing somewhat similar things, i think you should choose one of the other.

regarding prefixes, i don't believe i've ever actually implemented this (and there are other parts of the tailwind api that are also not implemented). because this library is specifically focused on RN Native and not RN Web, the necessity for a prefix to disambiguate seems pretty small, and no one has ever asked for it before, that i can recall. are you doing a RN Web project perhaps? if so, this might not be the right library for you.

jaredh159 avatar Feb 03 '25 15:02 jaredh159