lukeed / clsx

A tiny (239B) utility for constructing `className` strings conditionally.
MIT License
8.08k stars 141 forks source link

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

Closed Medkhat closed 9 months ago

Medkhat commented 9 months ago

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:

image image

Output

image
nishanthbhat07 commented 1 month ago

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

Medkhat commented 1 month ago

@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> }