This logic comes from the NativeWind jsx-runtime.ts file, where each JSX element is passed through the wrapJsx HOC. It wraps all the React Native component types with the cssInterop wrapper, which adds context and other required logic for NativeWind to work.
But this also effects normal div or html which is rsc supported.
Solution
We need to separate client and server files.
We need to add use-client for the client file, which has a Component Instance or hook and is used during jsx-runtime.
This map is used wrap-jsx. since we converted api.ts file to client file we can't import map from client file to server rsc file wrap-jsx so we have to separate this file from api.ts.
Problem
Why isn't RSC working with NativeWind?
Solution
File Changes
components.ts.
use client
react native web doesn't work rsc.api.ts.
use client
Component Instance imported from react is classComponent which is not supported in rsc.interopComponentsMap.ts.
wrap-jsx
. since we convertedapi.ts
file to client file we can't import map from client file to server rsc filewrap-jsx
so we have to separate this file fromapi.ts
.useColorScheme.ts.
api.ts
rsc compatible.