Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.HorizontalScrollView;
import android.widget.OverScroller;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.R;
import com.facebook.react.animated.NativeAnimatedModule;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.common.ReactConstants;
Expand Down Expand Up @@ -143,6 +145,20 @@ public ReactHorizontalScrollView(Context context, @Nullable FpsListener fpsListe
setClipChildren(false);
}

@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);

// Expose the testID prop as the resource-id name of the view. Black-box E2E/UI testing
// frameworks, which interact with the UI through the accessibility framework, do not have
// access to view tags. This allows developers/testers to avoid polluting the
// content-description with test identifiers.
final String testId = (String) this.getTag(R.id.react_test_id);
if (testId != null) {
info.setViewIdResourceName(testId);
}
}

public boolean getScrollEnabled() {
return mScrollEnabled;
}
Expand Down
Loading