Add deprecation messages for NetInfo and CameraRoll

Summary: I simply removed them from RN but we should give an actionable error message for people who upgrade from older versions of RN and who may be using these old modules, at least in `__DEV__`.

Reviewed By: rickhanlonii

Differential Revision: D15554863

fbshipit-source-id: 1975d4773581258776d2586ae820677bb14488f6
This commit is contained in:
Christoph Nakazawa 2019-05-30 06:48:11 -07:00 коммит произвёл Facebook Github Bot
Родитель c83a89daa6
Коммит d31e90648e
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -383,4 +383,30 @@ if (__DEV__) {
);
},
});
// $FlowFixMe 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-netinfo' instead of 'react-native'. " +
'See https://github.com/react-native-community/react-native-netinfo',
);
},
});
// $FlowFixMe 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-cameraroll' instead of 'react-native'. " +
'See https://github.com/react-native-community/react-native-cameraroll',
);
},
});
}