mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
EditText turn off hardware acc. for Oreo
Summary: Research into this error led us to this: https://issuetracker.google.com/issues/67102093 which refers to a very similar stack trace as our error: * Both errors have a bad access in `android.text.DynamicLayout.getBlockIndex` due to a negative array index * The report mentions it only affecting Oreo devices, this aligns with our [LogView](https://our.intern.facebook.com/intern/logview/details/facebook_android_crashes/80ce327664e6696ef03f951a9268ac29/?trace_key=cc916846a500b6efb5c68ae1a2e6b5c3) where ~99% of affected device os versions are Oreo. As a workaround mentioned in discussion, this diff turns off hardware acceleration for Oreo devices in `ReactEditText` Reviewed By: mdvacca Differential Revision: D14291369 fbshipit-source-id: 797d3123bcb240abd2401ca0d7d3a5a3ef8e22e3
This commit is contained in:
committed by
Facebook Github Bot
parent
f43f48fce1
commit
cba75cf12d
@@ -109,6 +109,13 @@ public class ReactEditText extends EditText {
|
||||
mTextAttributes = new TextAttributes();
|
||||
|
||||
applyTextAttributes();
|
||||
|
||||
// Turn off hardware acceleration for Oreo (T40484798)
|
||||
// see https://issuetracker.google.com/issues/67102093
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.O_MR1) {
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
}
|
||||
|
||||
// After the text changes inside an EditText, TextView checks if a layout() has been requested.
|
||||
|
||||
Reference in New Issue
Block a user