Skip to content

Commit a18f53d

Browse files
rubennortemeta-codesync[bot]
authored andcommitted
Remove __DEV__ stubs for previously-removed legacy modules (#57025)
Summary: Pull Request resolved: #57025 The following modules were removed from `react-native` core years ago: `AsyncStorage`, `ImagePickerIOS`, `ProgressViewIOS`, `DatePickerIOS`, and `Slider`. Until now, accessing them from `react-native` triggered a `__DEV__`-only invariant that threw a helpful error directing users to the community package replacement. Enough release cycles have passed that the friendly invariant is no longer needed. This commit removes the five `Object.defineProperty(module.exports, …)` blocks from `index.js`, along with the wrapping `if (__DEV__) { … }` shell and the now-unused `invariant` import. After this change, accessing one of these names from `react-native` returns `undefined` (matching the behavior of any other non-exported name). Replacement packages, for reference: - `AsyncStorage` → `react-native-async-storage/async-storage` - `ImagePickerIOS` → `react-native-image-picker` or `expo-image-picker` - `ProgressViewIOS` → `react-native-community/progress-view` - `DatePickerIOS` → `react-native-community/datetimepicker` - `Slider` → `react-native-community/slider` Changelog: [Internal] Reviewed By: huntie Differential Revision: D106640956 fbshipit-source-id: 682be5529312362142f4b8d96dde9c93b307bdc7
1 parent 7cc8c76 commit a18f53d

1 file changed

Lines changed: 0 additions & 80 deletions

File tree

packages/react-native/index.js

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import typeof * as ReactNativePublicAPI from './index.js.flow';
2828

2929
const warnOnce = require('./Libraries/Utilities/warnOnce').default;
30-
const invariant = require('invariant');
3130

3231
module.exports = {
3332
// #region Components
@@ -395,82 +394,3 @@ module.exports = {
395394
},
396395
// #endregion
397396
} as ReactNativePublicAPI;
398-
399-
if (__DEV__) {
400-
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
401-
* attempting to access AsyncStorage. */
402-
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
403-
* attempting to access AsyncStorage. */
404-
Object.defineProperty(module.exports, 'AsyncStorage', {
405-
configurable: true,
406-
get() {
407-
invariant(
408-
false,
409-
'AsyncStorage has been removed from react-native core. ' +
410-
"It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. " +
411-
'See https://github.com/react-native-async-storage/async-storage',
412-
);
413-
},
414-
});
415-
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
416-
* attempting to access ImagePickerIOS. */
417-
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
418-
* attempting to access ImagePickerIOS. */
419-
Object.defineProperty(module.exports, 'ImagePickerIOS', {
420-
configurable: true,
421-
get() {
422-
invariant(
423-
false,
424-
'ImagePickerIOS has been removed from React Native. ' +
425-
"Please upgrade to use either 'react-native-image-picker' or 'expo-image-picker'. " +
426-
"If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " +
427-
'See https://github.com/rnc-archive/react-native-image-picker-ios',
428-
);
429-
},
430-
});
431-
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
432-
* attempting to access ProgressViewIOS. */
433-
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
434-
* attempting to access ProgressViewIOS. */
435-
Object.defineProperty(module.exports, 'ProgressViewIOS', {
436-
configurable: true,
437-
get() {
438-
invariant(
439-
false,
440-
'ProgressViewIOS has been removed from react-native core. ' +
441-
"It can now be installed and imported from '@react-native-community/progress-view' instead of 'react-native'. " +
442-
'See https://github.com/react-native-progress-view/progress-view',
443-
);
444-
},
445-
});
446-
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
447-
* attempting to access DatePickerIOS. */
448-
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
449-
* attempting to access DatePickerIOS. */
450-
Object.defineProperty(module.exports, 'DatePickerIOS', {
451-
configurable: true,
452-
get() {
453-
invariant(
454-
false,
455-
'DatePickerIOS has been removed from react-native core. ' +
456-
"It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
457-
'See https://github.com/react-native-datetimepicker/datetimepicker',
458-
);
459-
},
460-
});
461-
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
462-
* attempting to access Slider. */
463-
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
464-
* attempting to access Slider. */
465-
Object.defineProperty(module.exports, 'Slider', {
466-
configurable: true,
467-
get() {
468-
invariant(
469-
false,
470-
'Slider has been removed from react-native core. ' +
471-
"It can now be installed and imported from '@react-native-community/slider' instead of 'react-native'. " +
472-
'See https://github.com/callstack/react-native-slider',
473-
);
474-
},
475-
});
476-
}

0 commit comments

Comments
 (0)