From 7a3da81478b98c993df7efef2b894ff71ed286cc Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Tue, 22 Apr 2025 08:01:35 -0700 Subject: [PATCH] Remove Learn Core warnings for JS APIs with >3y blame (#50840) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50840 Cleanup of index.js API removal warnings. This should motivate more urgency on the remaining members. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D73429537 fbshipit-source-id: 03faabdf30c2836dd5c61b4a2ce8d2355ad8e1e9 --- packages/react-native/index.js | 287 --------------------------------- 1 file changed, 287 deletions(-) diff --git a/packages/react-native/index.js b/packages/react-native/index.js index 1668f74754e..edca23fe425 100644 --- a/packages/react-native/index.js +++ b/packages/react-native/index.js @@ -320,293 +320,6 @@ module.exports = { } as ReactNativePublicAPI; if (__DEV__) { - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access ART. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access ART. */ - Object.defineProperty(module.exports, 'ART', { - configurable: true, - get() { - invariant( - false, - 'ART has been removed from React Native. ' + - "Please upgrade to use either 'react-native-svg' or a similar package. " + - "If you cannot upgrade to a different library, please install the deprecated '@react-native-community/art' package. " + - 'See https://github.com/react-native-art/art', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access ListView. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access ListView. */ - Object.defineProperty(module.exports, 'ListView', { - configurable: true, - get() { - invariant( - false, - 'ListView has been removed from React Native. ' + - 'See https://fb.me/nolistview for more information or use ' + - '`deprecated-react-native-listview`.', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access SwipeableListView. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access SwipeableListView. */ - Object.defineProperty(module.exports, 'SwipeableListView', { - configurable: true, - get() { - invariant( - false, - 'SwipeableListView has been removed from React Native. ' + - 'See https://fb.me/nolistview for more information or use ' + - '`deprecated-react-native-swipeable-listview`.', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access WebView. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access WebView. */ - Object.defineProperty(module.exports, 'WebView', { - configurable: true, - get() { - invariant( - false, - 'WebView has been removed from React Native. ' + - "It can now be installed and imported from 'react-native-webview' instead of 'react-native'. " + - 'See https://github.com/react-native-webview/react-native-webview', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access NetInfo. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access NetInfo. */ - Object.defineProperty(module.exports, 'NetInfo', { - configurable: true, - get() { - invariant( - false, - 'NetInfo has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. " + - 'See https://github.com/react-native-netinfo/react-native-netinfo', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access CameraRoll. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access CameraRoll. */ - Object.defineProperty(module.exports, 'CameraRoll', { - configurable: true, - get() { - invariant( - false, - 'CameraRoll has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-camera-roll/camera-roll' instead of 'react-native'. " + - 'See https://github.com/react-native-cameraroll/react-native-cameraroll', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access ImageStore. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access ImageStore. */ - Object.defineProperty(module.exports, 'ImageStore', { - configurable: true, - get() { - invariant( - false, - 'ImageStore has been removed from React Native. ' + - 'To get a base64-encoded string from a local image use either of the following third-party libraries:' + - "* expo-file-system: `readAsStringAsync(filepath, 'base64')`" + - "* react-native-fs: `readFile(filepath, 'base64')`", - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access ImageEditor. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access ImageEditor. */ - Object.defineProperty(module.exports, 'ImageEditor', { - configurable: true, - get() { - invariant( - false, - 'ImageEditor has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-community/image-editor' instead of 'react-native'. " + - 'See https://github.com/callstack/react-native-image-editor', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access TimePickerAndroid. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access TimePickerAndroid. */ - Object.defineProperty(module.exports, 'TimePickerAndroid', { - configurable: true, - get() { - invariant( - false, - 'TimePickerAndroid has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " + - 'See https://github.com/react-native-datetimepicker/datetimepicker', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access ToolbarAndroid. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access ToolbarAndroid. */ - Object.defineProperty(module.exports, 'ToolbarAndroid', { - configurable: true, - get() { - invariant( - false, - 'ToolbarAndroid has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-community/toolbar-android' instead of 'react-native'. " + - 'See https://github.com/react-native-toolbar-android/toolbar-android', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access ViewPagerAndroid. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access ViewPagerAndroid. */ - Object.defineProperty(module.exports, 'ViewPagerAndroid', { - configurable: true, - get() { - invariant( - false, - 'ViewPagerAndroid has been removed from React Native. ' + - "It can now be installed and imported from 'react-native-pager-view' instead of 'react-native'. " + - 'See https://github.com/callstack/react-native-pager-view', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access CheckBox. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access CheckBox. */ - Object.defineProperty(module.exports, 'CheckBox', { - configurable: true, - get() { - invariant( - false, - 'CheckBox has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " + - 'See https://github.com/react-native-checkbox/react-native-checkbox', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access SegmentedControlIOS. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access SegmentedControlIOS. */ - Object.defineProperty(module.exports, 'SegmentedControlIOS', { - configurable: true, - get() { - invariant( - false, - 'SegmentedControlIOS has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-segmented-control/segmented-control' instead of 'react-native'." + - 'See https://github.com/react-native-segmented-control/segmented-control', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access StatusBarIOS. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access StatusBarIOS. */ - Object.defineProperty(module.exports, 'StatusBarIOS', { - configurable: true, - get() { - invariant( - false, - 'StatusBarIOS has been removed from React Native. ' + - 'Has been merged with StatusBar. ' + - 'See https://reactnative.dev/docs/statusbar', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access PickerIOS. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access PickerIOS. */ - Object.defineProperty(module.exports, 'PickerIOS', { - configurable: true, - get() { - invariant( - false, - 'PickerIOS has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-picker/picker' instead of 'react-native'. " + - 'See https://github.com/react-native-picker/picker', - ); - }, - }); - - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access Picker. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access Picker. */ - Object.defineProperty(module.exports, 'Picker', { - configurable: true, - get() { - invariant( - false, - 'Picker has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-picker/picker' instead of 'react-native'. " + - 'See https://github.com/react-native-picker/picker', - ); - }, - }); - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access DatePickerAndroid. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access DatePickerAndroid. */ - Object.defineProperty(module.exports, 'DatePickerAndroid', { - configurable: true, - get() { - invariant( - false, - 'DatePickerAndroid has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " + - 'See https://github.com/react-native-datetimepicker/datetimepicker', - ); - }, - }); - /* $FlowFixMe[prop-missing] This is intentional: Flow will error when - * attempting to access MaskedViewIOS. */ - /* $FlowFixMe[invalid-export] This is intentional: Flow will error when - * attempting to access MaskedViewIOS. */ - Object.defineProperty(module.exports, 'MaskedViewIOS', { - configurable: true, - get() { - invariant( - false, - 'MaskedViewIOS has been removed from React Native. ' + - "It can now be installed and imported from '@react-native-masked-view/masked-view' instead of 'react-native'. " + - 'See https://github.com/react-native-masked-view/masked-view', - ); - }, - }); /* $FlowFixMe[prop-missing] This is intentional: Flow will error when * attempting to access AsyncStorage. */ /* $FlowFixMe[invalid-export] This is intentional: Flow will error when