From 2ccde4060e0ce414c3b4b9c584abc64f9bf28cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Mon, 3 Jul 2023 15:34:34 -0700 Subject: [PATCH] Small cleanups for IntersectionObserver (#38099) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38099 A couple of small cleanups after the bulk of the work for `IntersectionObserver` was already merged. Changelog: [internal] Reviewed By: NickGerleman Differential Revision: D47056943 fbshipit-source-id: 2a6f9062d91da458f8b980f3abcdc9a4ac86389b --- .../__mocks__/NativeIntersectionObserver.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js b/packages/react-native/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js index 7bd88d6e1a9..e66a5e12159 100644 --- a/packages/react-native/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +++ b/packages/react-native/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js @@ -97,8 +97,12 @@ const NativeIntersectionObserverMock = { ); observations.splice(observationIndex, 1); }, - connect: (notifyIntersectionObserversCallback?: () => void): void => { + connect: (notifyIntersectionObserversCallback: () => void): void => { invariant(callback == null, 'unexpected call to connect'); + invariant( + notifyIntersectionObserversCallback != null, + 'unexpected null notify intersection observers callback', + ); callback = notifyIntersectionObserversCallback; }, disconnect: (): void => {