lukeed/clsxPublic

A tiny (239B) utility for constructing `className` strings conditionally.

clsx returns only the first element of the array in React Native CLI

ME

Medkhat opened 路

### Hi there! ### I wanted to use this package with `NativeWind` in `React Native`. But, `clsx` function returns only the first item of the array. It doesn't merge classes.

### Here example: <img width="662" alt="image" src="https://github.com/lukeed/clsx/assets/42961493/c503adc4-830d-4738-bc06-d07b46854450">

<img width="467" alt="image" src="https://github.com/lukeed/clsx/assets/42961493/b476c259-0d63-4a81-a4e9-cc8d5053e2e8">

### Output <img width="370" alt="image" src="https://github.com/lukeed/clsx/assets/42961493/18656878-0645-4556-922e-991a25e396db">

  1. Medkhatclosed2 years ago on GitHub

  2. NI

    Hey. How did you fix this issue? Facing the same

  3. ME
    Author

    @nishanthbhat07 Hi! When you provide a className to the custom component, you need to use a different name instead of "className".

    Example:

    `function MyCustomView({ customViewCn }) { return <View className={cn("p-3", customViewCn)}> {* Children *} </View> }`

  4. nishanthbhat07mentioned2 years ago on GitHub

  5. nishanthbhat07subscribed2 years ago on GitHub