React-native: Android: Text ellipsizeMode="clip" crashes on Android

Created on 20 Mar 2018  路  11Comments  路  Source: facebook/react-native

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 9.0.0
Yarn: 1.3.2
npm: 5.5.1
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: ^0.54.2 => 0.54.2

Steps to Reproduce

  • Use a <Text /> component
  • Set ellipsizeMode to "clip"

Expected Behavior

While the documentation clearly states clip is working only for iOS I assumed this will have no effect on Android.

Actual Behavior

Causes an exception manifesting as a crash inside the app:
RuntimeException com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'ellipsizeMode' of a view managed by: RCTText

com.facebook.react.bridge.ReactContext in handleException at line 313
com.facebook.react.uimanager.GuardedFrameCallback in doFrame at line 33
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher in doFrame at line 136
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1 in doFrame at line 107
android.view.Choreographer$CallbackRecord in run at line 909
android.view.Choreographer in doCallbacks at line 723
android.view.Choreographer in doFrame at line 655
android.view.Choreographer$FrameDisplayEventReceiver in run at line 897
android.os.Handler in handleCallback at line 790
android.os.Handler in dispatchMessage at line 99
android.os.Looper in loop at line 164
android.app.ActivityThread in main at line 6494
java.lang.reflect.Method in invoke
com.android.internal.os.RuntimeInit$MethodAndArgsCaller in run at line 438
com.android.internal.os.ZygoteInit in main at line 807
Help Wanted Android Locked

Most helpful comment

I strongly disagree. This is not a documentation issue.
Setting a property on a component should not crash the app.

All 11 comments

We should make this clearer in the docs. Can you open an issue at https://github.com/facebook/react-native-website instead?

Closing as clip is a iOS-only prop.

I strongly disagree. This is not a documentation issue.
Setting a property on a component should not crash the app.

Let us know if you have a PR that changes this behavior.

Hi there! I just sent a PR with the fix for this issue, hope it helps!

@t4deu maybe just ignoring the property is the more 'expected' behavior.

Hi @borisyankov, the default tail is applied even if the value be ignored, I think the change just made the result more explicit instead of another if else block. But we can change that :wink:.

Is this fixed? I still get error

Environment:
OS: macOS High Sierra 10.13.5
Node: 8.9.4
Yarn: 1.6.0
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.4.1 Build version 9F2000
Android Studio: 3.1 AI-173.4720617

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

@codler it was fixed in master three months ago. You鈥檙e using 0.55 which does not have this fix. Try the 0.56 release.

@hramos When is 0.56 going to be released?

Today 馃憤

@codler 0.56 was released last month. It is scheduled to hit stable today: https://github.com/facebook/react-native/blob/master/Releases.md#release-schedule

Was this page helpful?
0 / 5 - 0 ratings