Skip to content
Merged
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 @@ -9,6 +9,7 @@

import Agent from 'react-devtools-shared/src/backend/agent';
import {hideOverlay, showOverlay} from './Highlighter';
import {isReactNativeEnvironment} from 'react-devtools-shared/src/backend/utils';

import type {HostInstance} from 'react-devtools-shared/src/backend/types';
import type {BackendBridge} from 'react-devtools-shared/src/bridge';
Expand Down Expand Up @@ -49,6 +50,11 @@ export default function setupHighlighter(
right: number,
bottom: number,
}) {
if (isReactNativeEnvironment()) {
// Not implemented.
return;
}

if (
left === Math.round(window.scrollX) &&
top === Math.round(window.scrollY)
Expand All @@ -65,6 +71,11 @@ export default function setupHighlighter(

let scrollTimer = null;
function sendScroll() {
if (isReactNativeEnvironment()) {
// Not implemented.
return;
}

if (scrollTimer) {
clearTimeout(scrollTimer);
scrollTimer = null;
Expand All @@ -85,14 +96,17 @@ export default function setupHighlighter(
applyingScroll = false;
}

document.addEventListener('scroll', () => {
if (!scrollTimer) {
// Periodically synchronize the scroll while scrolling.
scrollTimer = setTimeout(sendScroll, 400);
}
});
// $FlowFixMe[method-unbinding]
if (document && typeof document.addEventListener === 'function') {
document.addEventListener('scroll', () => {
if (!scrollTimer) {
// Periodically synchronize the scroll while scrolling.
scrollTimer = setTimeout(sendScroll, 400);
}
});

document.addEventListener('scrollend', scrollEnd);
document.addEventListener('scrollend', scrollEnd);
}

function startInspectingHost(onlySuspenseNodes: boolean) {
inspectOnlySuspenseNodes = onlySuspenseNodes;
Expand Down Expand Up @@ -319,6 +333,11 @@ export default function setupHighlighter(
// with the scrollIntoView option.
hideOverlay(agent);

if (isReactNativeEnvironment()) {
// Not implemented.
return;
}

if (scrollDelayTimer) {
clearTimeout(scrollDelayTimer);
scrollDelayTimer = null;
Expand Down
Loading