{"record":{"id":"4fbe1b6c4f9b2f34","repo":"necolas/react-native-web","slug":"scrollto-y-x-animated-is-deprecated-use-scr","errorCode":null,"errorMessage":"`scrollTo(y, x, animated)` is deprecated. Use `scrollTo({x: 5, y: 5, animated: true})` instead.","messagePattern":"`scrollTo\\(y, x, animated\\)` is deprecated\\. Use `scrollTo\\((.+?)\\)` instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/react-native-web/src/exports/ScrollView/index.js","lineNumber":516,"sourceCode":"  };\n\n  /**\n   * Scrolls to a given x, y offset, either immediately or with a smooth animation.\n   * Syntax:\n   *\n   * scrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})\n   *\n   * Note: The weird argument signature is due to the fact that, for historical reasons,\n   * the function also accepts separate arguments as as alternative to the options object.\n   * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.\n   */\n  scrollTo = (\n    y?: number | { x?: number, y?: number, animated?: boolean },\n    x?: number,\n    animated?: boolean\n  ) => {\n    if (typeof y === 'number') {\n      console.warn(\n        '`scrollTo(y, x, animated)` is deprecated. Use `scrollTo({x: 5, y: 5, animated: true})` instead.'\n      );\n    } else {\n      ({ x, y, animated } = y || emptyObject);\n    }\n\n    this.scrollResponderScrollTo({\n      x: x || 0,\n      y: y || 0,\n      animated: animated !== false\n    });\n  };\n\n  /**\n   * If this is a vertical ScrollView scrolls to the bottom.\n   * If this is a horizontal ScrollView scrolls to the right.\n   *\n   * Use `scrollToEnd({ animated: true })` for smooth animated scrolling,","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/necolas/react-native-web/blob/a9de220ba9e65bdea540fb5322ffb1da2b0bf442/packages/react-native-web/src/exports/ScrollView/index.js#L498-L534","documentation":"ScrollView.scrollTo used to take positional (y, x, animated) arguments; it now expects a single {x, y, animated} object. Passing a number as the first argument logs this deprecation console.warn. Functionality still works but the legacy signature is deprecated.","triggerScenarios":"Calling ref.scrollTo(0, 500, true) with numeric positional arguments.","commonSituations":"Legacy RN snippets where the argument order was (y, x, animated); older third-party scroll helpers; pre-codemod codebases.","solutions":["Use the object form: ref.scrollTo({ x: 0, y: 500, animated: true }).","Search codebase for scrollTo( with numeric first arg and migrate all call sites.","Note the historical parameter order was (y, x) — double-check any converted values were not swapped."],"exampleFix":"// before\nref.scrollTo(500, 0, true);\n// after\nref.scrollTo({ x: 0, y: 500, animated: true });","handlingStrategy":"validation","validationCode":"function safeScrollTo(ref, opts) {\n  if (typeof opts === 'number') throw new TypeError('Use scrollTo({x, y, animated}), not legacy (y, x, animated)');\n  ref.scrollTo(opts);\n}","typeGuard":"const isScrollToOptions = (a) => a != null && typeof a === 'object' && ('x' in a || 'y' in a || 'animated' in a);","tryCatchPattern":"console.warn = ((orig) => (...a) => { if (/scrollTo\\(y, x, animated\\).*deprecated/.test(a[0])) throw new Error(a[0]); orig(...a); })(console.warn);","preventionTips":["Use the options-object form everywhere","Remember legacy order was (y, x, animated) — watch for swapped values when migrating","Run RN upgrade codemods on ScrollView call sites"],"tags":["react-native-web","scrollview","deprecation","api-change"],"backgroundTag":"deprecated-positional-argument","analyzedSha":"a9de220ba9e65bdea540fb5322ffb1da2b0bf442","analyzedAt":"2026-09-01T10:01:09.883Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}