react-native-ui-lib icon indicating copy to clipboard operation
react-native-ui-lib copied to clipboard

Bug fixed TextField style error: right operand of 'in' is not an object

Open legend-oe opened this issue 1 year ago • 1 comments

Description

If you use rn-ui-lib with NativeWind (Tailwind CSS), TextField not work with error:

ERROR  TypeError: right operand of 'in' is not an object

This error is located at:
    in CssInteropComponent (created by Incubator.TextField)
    in Incubator.TextField (created by TextField)
    in RCTView (created by View)
    in View
    in View (created by TextField)

I found and fixed 2 bugs.

  1. Problem with style Platform.OS === 'web
  2. Problem with style hasValue and centred.

Changelog

Fixed TextField + NativeWind style error

Additional info

legend-oe avatar May 01 '24 11:05 legend-oe

Could someone please explain why does this fix work? Even if short-circuiting is used, it would return a false instead of undefined (after the solution). But Does react-native not accept false as a value in style array? Why would it fail?

gyanbhartip avatar May 21 '24 13:05 gyanbhartip