Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

twrnc not accounting for user configured tailwind prefix #335

Open
dumptyd opened this issue Feb 3, 2025 · 3 comments
Open

twrnc not accounting for user configured tailwind prefix #335

dumptyd opened this issue Feb 3, 2025 · 3 comments

Comments

@dumptyd
Copy link

dumptyd commented Feb 3, 2025

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
Copy link
Author

dumptyd commented Feb 3, 2025

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
Copy link
Author

dumptyd commented Feb 3, 2025

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
  // ...
};

@jaredh159
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants