Skip to content

Commit 7abd47e

Browse files
committed
fix indentation
1 parent eddebe6 commit 7abd47e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,15 +1243,17 @@ public ReactSelectionWatcher(ReactEditText editText) {
12431243
public void onSelectionChanged(int start, int end) {
12441244
// Calculate cursor position
12451245
Layout layout = mReactEditText.getLayout();
1246-
if (mReactEditText.getLayout() == null) {
1247-
mReactEditText.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
1248-
@Override
1249-
public void onGlobalLayout() {
1250-
mReactEditText.getViewTreeObserver().removeOnGlobalLayoutListener(this);
1251-
onSelectionChanged(start, end);
1252-
}
1253-
});
1254-
return;
1246+
1247+
// Wait for the TextInput to mount, if needed
1248+
if (layout == null) {
1249+
mReactEditText.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
1250+
@Override
1251+
public void onGlobalLayout() {
1252+
mReactEditText.getViewTreeObserver().removeOnGlobalLayoutListener(this);
1253+
onSelectionChanged(start, end);
1254+
}
1255+
});
1256+
return;
12551257
}
12561258

12571259
int line = layout.getLineForOffset(start);
@@ -1273,8 +1275,8 @@ public void onGlobalLayout() {
12731275
new ReactTextInputSelectionEvent(
12741276
mSurfaceId,
12751277
mReactEditText.getId(),
1276-
realStart,
1277-
realEnd,
1278+
realStart,
1279+
realEnd,
12781280
Math.round(PixelUtil.toDIPFromPixel(cursorPositionX)),
12791281
Math.round(PixelUtil.toDIPFromPixel(cursorPositionY))));
12801282

0 commit comments

Comments
 (0)