Skip to content

[V5] - TextInput crashes when using "text-center" or "text-right" or "text-left" in NativeWind v5 (react-native-css: path.split is undefined) #232

@MohammedAbidNafi

Description

@MohammedAbidNafi

Describe the bug
When adding the text-center, text-left, text-right class to a React Native TextInput, the app crashes with Render Error the following is the error:

path.split is not a function (it is undefined)

Image

The error originates in react-native-css at src/native/styles/index.ts in line 250

It appears path is undefined (or non-string) during runtime parsing of the class path. This crash happens when text-center, text-left, text-right is applied to a TextInput. Other components appear unaffected

Reproduction
I reproduced using the recommended template and then upgrading to NativeWind v5:

npx rn-new@latest --nativewind --expo-router

Migrated to NativeWind v5

And added this minimal component:

`
import { TextInput } from 'react-native';

export default function Home() {
return (
<"TextInput"
placeholder="Type here..."
className="mb-4 rounded-md border border-gray-300 p-2 text-center"
/>
);
}
`

Expected behavior
Applying text-center or text-left or text-right to TextInput should center the input text without throwing an exception.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions