Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throwing multiple exceptions when opening View on Android #72

Open
monotv opened this issue Nov 15, 2017 · 9 comments
Open

Throwing multiple exceptions when opening View on Android #72

monotv opened this issue Nov 15, 2017 · 9 comments

Comments

@monotv
Copy link

monotv commented Nov 15, 2017

Versions:
Android 7

"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-textinput-effects": "^0.4.1"

First exception:

Exception in native call
com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'backgroundColor' in shadow node of type: AndroidTextInput

Then:

Error while updating prop backgroundColor
com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `int64', but had type `string'

This finally crashes the app:

FATAL EXCEPTION: main
Process: com.xxx, PID: 30962
com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag: 94
detail: View tag:100
children(0): [
],
viewsToAdd(1): [
[0,94],
]

Android expects colors as int yet somewhow it is passed as a string it seems.

Looks like there is an issue with Animations in Android:
facebook/react-native#13984

@halilb
Copy link
Owner

halilb commented Nov 19, 2017

Thanks for reporting @monotv.

I just tested this on a Android 7 device using the Example project. All text inputs are working fine.

Could you also test it with the Example project so we can make sure this is related with the library. The project is using react-native version 0.50.0 btw.

@csotiriou
Copy link

same here. Android 5.0, React Native 0.55.

@Dantalion
Copy link

Also crashing with unknown view tag exception for me.
Android 7.0
RN 0.55

@vinceprofeta
Copy link

@Dantalion & @csotiriou Still an issue?

@winadiw
Copy link

winadiw commented Dec 20, 2018

crashing in RN 0.56

@halilb
Copy link
Owner

halilb commented Feb 8, 2019

What's the output of crash @winadiw?

@wizebin
Copy link

wizebin commented Feb 10, 2019

I encountered this same issue and did some troubleshooting

Primarily it seems to be a user error, in my case I was passing the backgroundColor prop to a hoshi component which does not use the backgroundColor prop, this is because I was trying several different components before settling on the hoshi

Passing the prop backgroundColor to the TextInput react native component causes a crash on android.

Changing the library code fixes this, but is not necessary, like so:

const {
  label,
  style: containerStyle,
  inputStyle,
  labelStyle,
  maskColor,
  borderColor,
  borderHeight,
  inputPadding,
  height: inputHeight,
  backgroundColor,
  ...restOfProps,
} = this.props;
const { width, focusedAnim, value } = this.state;
const flatStyles = StyleSheet.flatten(containerStyle) || {};
const containerWidth = flatStyles.width || width;

return (
  <View
    style={[
      styles.container,
      containerStyle,
      {
        height: inputHeight + inputPadding,
        width: containerWidth,
      },
    ]}
    onLayout={this._onLayout}
  >
    <TextInput
      ref={this.input}
      {...restOfProps}

This adds backgroundColor and ...restOfProps to the initial retrieval of props, then spreads that into the TextInput component instead of ...this.props

I can submit a PR to fix this if you'd like, but it seems likely that the user could simply stop passing backgroundColor in

@halilb
Copy link
Owner

halilb commented Feb 11, 2019

Thanks for finding out the problem @wizebin. I'd like to merge that patch if you could create a PR. I agree that it sounds like a user error but I'd like to eliminate it as people keep experiencing that.

@AfanasievN
Copy link

Any progress on that? )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants