necolas/react-native-web · warning
`scrollResponderScrollTo(x, y, animated)` is deprecated. Use
Error message
`scrollResponderScrollTo(x, y, animated)` is deprecated. Use `scrollResponderScrollTo({x: 5, y: 5, animated: true})` instead. What it means
scrollResponderScrollTo historically accepted positional (x, y, animated) arguments; the modern signature takes a single object {x, y, animated}. Passing a number as the first argument triggers a deprecation console.warn telling you to switch to the object form. The old call still works, but is deprecated.
Source
Thrown at packages/react-native-web/src/exports/ScrollView/index.js:302
/**
* A helper function to scroll to a specific point in the scrollview.
* This is currently used to help focus on child textviews, but can also
* be used to quickly scroll to any element we want to focus. Syntax:
*
* scrollResponderScrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})
*
* Note: The weird argument signature is due to the fact that, for historical reasons,
* the function also accepts separate arguments as as alternative to the options object.
* This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
*/
scrollResponderScrollTo = (
x?: number | { x?: number, y?: number, animated?: boolean },
y?: number,
animated?: boolean
) => {
if (typeof x === 'number') {
console.warn(
'`scrollResponderScrollTo(x, y, animated)` is deprecated. Use `scrollResponderScrollTo({x: 5, y: 5, animated: true})` instead.'
);
} else {
({ x, y, animated } = x || emptyObject);
}
const node = this.getScrollableNode();
const left = x || 0;
const top = y || 0;
if (node != null) {
if (typeof node.scroll === 'function') {
node.scroll({ top, left, behavior: !animated ? 'auto' : 'smooth' });
} else {
node.scrollLeft = left;
node.scrollTop = top;
}
}
};
View on GitHub (pinned to a9de220ba9)
Solutions
- Change the call to the object form: scrollTo({ x, y, animated }).
- Update RN-deprecated positional call sites via codemod or search-and-replace.
- Silence only if intentional — but prefer migrating since the positional form may be removed.
Example fix
// before
ref.scrollResponderScrollTo(0, 500, true);
// after
ref.scrollResponderScrollTo({ x: 0, y: 500, animated: true }); Defensive patterns
Strategy: validation
Validate before calling
function safeScrollTo(ref, opts) {
if (typeof opts === 'number') throw new TypeError('Use scrollTo({x, y, animated}), not positional args');
ref.scrollResponderScrollTo(opts);
} Type guard
const isScrollToOptions = (a) => a != null && typeof a === 'object' && !Array.isArray(a);
Try / catch
// Deprecation uses console.warn; hook it in dev to fail fast:
const origWarn = console.warn;
console.warn = (...a) => { if (/scrollResponderScrollTo.*deprecated/.test(a[0])) throw new Error(a[0]); origWarn(...a); }; Prevention
- Always call scrollTo with an options object
- Search for scrollTo( numeric call sites during RN->web upgrades
- Enable the RN deprecation codemods when upgrading
When it happens
Trigger: Calling scrollResponderScrollTo(0, 500, true) with positional numeric arguments.
Common situations: Older RN codebases migrated to web; following deprecated RN ScrollView docs; codemods not applied.
Related errors
- `scrollTo(y, x, animated)` is deprecated. Use `scrollTo({x:
- Image: asset with ID "${source}" could not be found. Please
- The <Image> component cannot contain children. If you want t
- Invalid CSS keyframes type: ${typeof keyframesValue}
- StyleSheet.compose() only accepts 2 arguments, received ${le
AI-assisted analysis of necolas/react-native-web@a9de220ba9 (2026-09-01).
Data as JSON: /api/errors/ce7500ff101ea4a2.
Report an issue: GitHub.