Skip to content

OutlineStyle crashes on Android but not on iOS #4769

@mannby

Description

@mannby

Current behaviour

In updating my project to Expo 53 (RN 0.79.5, RNP 5.14.5), I got crashes on Android, but not on iOS. With Expo dev tools it became clear that AndroidTextInput was receiving a ReadableNativeMap that it couldn't cast to a String (in Java). According to RNP:src:components:TextInput:TextInput.tsx:Props:outlineStyle, it's supposed to be a StyleProp, which works fine on iOS. But, on Android, it crashes. Since the type definitions don't allow for the newer (I think) outlineWidth property, I've worked around the problem thus:

const workaround = isAndroid
? { outlineWidth: 1 }
: { outlineStyle: { borderWidth: 1 } }

return <TextInput {...workaround} />

and this seems to work fine.

I don't know where the discrepancy comes it, but maybe someone working on this project knows, FWIW.

Expected behaviour

No crash, and getting a border of width 1.

How to reproduce?

Build a project with a Paper TextInput and set outlineStyle to { borderWidth: 1} on Android.

Preview

https://photos.app.goo.gl/mxwqP1HV19R3tCif9

What have you tried so far?

I have a workaround; see above

Your Environment

software version
ios x
android 14
react-native 0.79.5
react-native-paper 5.14.5
node 22.14.0
npm or yarn yarn 4.9.2
expo sdk 53.0.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions