bluesky-social / react-native-uitextview

A UITextView implementation for React Native that allows for full text highlighting/selection, native translations, etc.
MIT License
247 stars 14 forks source link

NativeWind errors 😱 #10

Open aretrace opened 5 months ago

aretrace commented 5 months ago

When using NativeWind className, I get the following error:

This error is located at: in CssInterop.Text (created by UITextView) ... ERROR [ERROR: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.]

Current setup: M1 mac 14.5 node 20.12.2 expo 51.0.8 (default template) nativewind 4.0.36 react-native-uitextview 1.1.7 ios 17.5

No error when only using StyleSheet. Other react native components are functioning with NativeWind.

haileyok commented 5 months ago

huh...I was lazy and put a platform check at the top of a component which does break react rules and could just be move to a parent component, but that's still weird to me. does native wind change the value of Platform.OS for some reason?

can push a fix up for that in a bit, but otherwise there shouldn't be any hook calls.

haileyok commented 5 months ago

@aretrace Okay, I removed that in 1.1.8. Could you try that and see if it's helpful at all?

aretrace commented 5 months ago

🧐

When I add the uiTextView prop or the selectable prop on UITextView by themselves, UITextView renders className styles as expected. BUT, when both uiTextView and selectable props are on UITextView, all NativeWind className styles do not render (they are completely ignored as if no styles exist).

With StyleSheet, when the uiTextView prop or the selectable prop is applied to UITextView by themselves, StyleSheet functions normally. BUT, when both uiTextView and selectable props are on UITextView, fontWeight is not applied. (I suspect other CSS properties could also not be appropriately rendered or applied by UITextView when both props are used)

previous error no longer appears