Add two more version checks for ReactTextView recycling

Summary:
setFocusable(int) was added in Android O, and setHyphenationFreqauency was added in M.

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D37462117

fbshipit-source-id: e59d2de49dbdcddfdba25def6bb39695c65efe89
This commit is contained in:
Joshua Gross
2022-06-27 14:45:40 -07:00
committed by Facebook GitHub Bot
parent 0646551d76
commit cf0a0eff1b
@@ -140,9 +140,13 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
// mViewFlags = SOUND_EFFECTS_ENABLED | HAPTIC_FEEDBACK_ENABLED |
// LAYOUT_DIRECTION_INHERIT;
setEnabled(true);
setFocusable(View.FOCUSABLE_AUTO);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setFocusable(View.FOCUSABLE_AUTO);
}
setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE);
}
updateView(); // call after changing ellipsizeLocation in particular
}