index.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow
  9. */
  10. 'use strict';
  11. import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';
  12. import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
  13. import typeof Button from './Libraries/Components/Button';
  14. import typeof CheckBox from './Libraries/Components/CheckBox/CheckBox';
  15. import typeof DatePickerIOS from './Libraries/Components/DatePicker/DatePickerIOS';
  16. import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
  17. import typeof FlatList from './Libraries/Lists/FlatList';
  18. import typeof Image from './Libraries/Image/Image';
  19. import typeof ImageBackground from './Libraries/Image/ImageBackground';
  20. import typeof InputAccessoryView from './Libraries/Components/TextInput/InputAccessoryView';
  21. import typeof KeyboardAvoidingView from './Libraries/Components/Keyboard/KeyboardAvoidingView';
  22. import typeof MaskedViewIOS from './Libraries/Components/MaskedView/MaskedViewIOS';
  23. import typeof Modal from './Libraries/Modal/Modal';
  24. import typeof Picker from './Libraries/Components/Picker/Picker';
  25. import typeof PickerIOS from './Libraries/Components/Picker/PickerIOS';
  26. import typeof Pressable from './Libraries/Components/Pressable/Pressable';
  27. import typeof ProgressBarAndroid from './Libraries/Components/ProgressBarAndroid/ProgressBarAndroid';
  28. import typeof ProgressViewIOS from './Libraries/Components/ProgressViewIOS/ProgressViewIOS';
  29. import typeof SafeAreaView from './Libraries/Components/SafeAreaView/SafeAreaView';
  30. import typeof ScrollView from './Libraries/Components/ScrollView/ScrollView';
  31. import typeof SectionList from './Libraries/Lists/SectionList';
  32. import typeof SegmentedControlIOS from './Libraries/Components/SegmentedControlIOS/SegmentedControlIOS';
  33. import typeof Slider from './Libraries/Components/Slider/Slider';
  34. import typeof Switch from './Libraries/Components/Switch/Switch';
  35. import typeof RefreshControl from './Libraries/Components/RefreshControl/RefreshControl';
  36. import typeof StatusBar from './Libraries/Components/StatusBar/StatusBar';
  37. import typeof Text from './Libraries/Text/Text';
  38. import typeof TextInput from './Libraries/Components/TextInput/TextInput';
  39. import typeof Touchable from './Libraries/Components/Touchable/Touchable';
  40. import typeof TouchableHighlight from './Libraries/Components/Touchable/TouchableHighlight';
  41. import typeof TouchableNativeFeedback from './Libraries/Components/Touchable/TouchableNativeFeedback';
  42. import typeof TouchableOpacity from './Libraries/Components/Touchable/TouchableOpacity';
  43. import typeof TouchableWithoutFeedback from './Libraries/Components/Touchable/TouchableWithoutFeedback';
  44. import typeof View from './Libraries/Components/View/View';
  45. import typeof VirtualizedList from './Libraries/Lists/VirtualizedList';
  46. import typeof VirtualizedSectionList from './Libraries/Lists/VirtualizedSectionList';
  47. import typeof ActionSheetIOS from './Libraries/ActionSheetIOS/ActionSheetIOS';
  48. import typeof Alert from './Libraries/Alert/Alert';
  49. import typeof Animated from './Libraries/Animated/src/Animated';
  50. import typeof Appearance from './Libraries/Utilities/Appearance';
  51. import typeof AppRegistry from './Libraries/ReactNative/AppRegistry';
  52. import typeof AppState from './Libraries/AppState/AppState';
  53. import typeof AsyncStorage from './Libraries/Storage/AsyncStorage';
  54. import typeof BackHandler from './Libraries/Utilities/BackHandler';
  55. import typeof Clipboard from './Libraries/Components/Clipboard/Clipboard';
  56. import typeof DatePickerAndroid from './Libraries/Components/DatePickerAndroid/DatePickerAndroid';
  57. import typeof DeviceInfo from './Libraries/Utilities/DeviceInfo';
  58. import typeof DevSettings from './Libraries/Utilities/DevSettings';
  59. import typeof Dimensions from './Libraries/Utilities/Dimensions';
  60. import typeof Easing from './Libraries/Animated/src/Easing';
  61. import typeof ReactNative from './Libraries/Renderer/shims/ReactNative';
  62. import typeof I18nManager from './Libraries/ReactNative/I18nManager';
  63. import typeof ImagePickerIOS from './Libraries/Image/ImagePickerIOS';
  64. import typeof InteractionManager from './Libraries/Interaction/InteractionManager';
  65. import typeof Keyboard from './Libraries/Components/Keyboard/Keyboard';
  66. import typeof LayoutAnimation from './Libraries/LayoutAnimation/LayoutAnimation';
  67. import typeof Linking from './Libraries/Linking/Linking';
  68. import typeof NativeDialogManagerAndroid from './Libraries/NativeModules/specs/NativeDialogManagerAndroid';
  69. import typeof NativeEventEmitter from './Libraries/EventEmitter/NativeEventEmitter';
  70. import typeof Networking from './Libraries/Network/RCTNetworking';
  71. import typeof PanResponder from './Libraries/Interaction/PanResponder';
  72. import typeof PermissionsAndroid from './Libraries/PermissionsAndroid/PermissionsAndroid';
  73. import typeof PixelRatio from './Libraries/Utilities/PixelRatio';
  74. import typeof PushNotificationIOS from './Libraries/PushNotificationIOS/PushNotificationIOS';
  75. import typeof Settings from './Libraries/Settings/Settings';
  76. import typeof Share from './Libraries/Share/Share';
  77. import typeof StatusBarIOS from './Libraries/Components/StatusBar/StatusBarIOS';
  78. import typeof StyleSheet from './Libraries/StyleSheet/StyleSheet';
  79. import typeof Systrace from './Libraries/Performance/Systrace';
  80. import typeof ToastAndroid from './Libraries/Components/ToastAndroid/ToastAndroid';
  81. import typeof * as TurboModuleRegistry from './Libraries/TurboModule/TurboModuleRegistry';
  82. import typeof TVEventHandler from './Libraries/Components/AppleTV/TVEventHandler';
  83. import typeof UIManager from './Libraries/ReactNative/UIManager';
  84. import typeof useColorScheme from './Libraries/Utilities/useColorScheme';
  85. import typeof useWindowDimensions from './Libraries/Utilities/useWindowDimensions';
  86. import typeof UTFSequence from './Libraries/UTFSequence';
  87. import typeof Vibration from './Libraries/Vibration/Vibration';
  88. import typeof YellowBox from './Libraries/YellowBox/YellowBoxDeprecated';
  89. import typeof LogBox from './Libraries/LogBox/LogBox';
  90. import typeof RCTDeviceEventEmitter from './Libraries/EventEmitter/RCTDeviceEventEmitter';
  91. import typeof RCTNativeAppEventEmitter from './Libraries/EventEmitter/RCTNativeAppEventEmitter';
  92. import typeof NativeModules from './Libraries/BatchedBridge/NativeModules';
  93. import typeof Platform from './Libraries/Utilities/Platform';
  94. import typeof processColor from './Libraries/StyleSheet/processColor';
  95. import typeof {PlatformColor} from './Libraries/StyleSheet/PlatformColorValueTypes';
  96. import typeof {DynamicColorIOS} from './Libraries/StyleSheet/PlatformColorValueTypesIOS';
  97. import typeof {ColorAndroid} from './Libraries/StyleSheet/PlatformColorValueTypesAndroid';
  98. import typeof RootTagContext from './Libraries/ReactNative/RootTagContext';
  99. import typeof DeprecatedColorPropType from './Libraries/DeprecatedPropTypes/DeprecatedColorPropType';
  100. import typeof DeprecatedEdgeInsetsPropType from './Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType';
  101. import typeof DeprecatedPointPropType from './Libraries/DeprecatedPropTypes/DeprecatedPointPropType';
  102. import typeof DeprecatedViewPropTypes from './Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes';
  103. import type {HostComponent as _HostComponentInternal} from './Libraries/Renderer/shims/ReactNativeTypes';
  104. export type HostComponent<T> = _HostComponentInternal<T>;
  105. const invariant = require('invariant');
  106. const warnOnce = require('./Libraries/Utilities/warnOnce');
  107. module.exports = {
  108. // Components
  109. get AccessibilityInfo(): AccessibilityInfo {
  110. return require('./Libraries/Components/AccessibilityInfo/AccessibilityInfo');
  111. },
  112. get ActivityIndicator(): ActivityIndicator {
  113. return require('./Libraries/Components/ActivityIndicator/ActivityIndicator');
  114. },
  115. get Button(): Button {
  116. return require('./Libraries/Components/Button');
  117. },
  118. get CheckBox(): CheckBox {
  119. warnOnce(
  120. 'checkBox-moved',
  121. 'CheckBox has been extracted from react-native core and will be removed in a future release. ' +
  122. "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " +
  123. 'See https://github.com/react-native-community/react-native-checkbox',
  124. );
  125. return require('./Libraries/Components/CheckBox/CheckBox');
  126. },
  127. get DatePickerIOS(): DatePickerIOS {
  128. warnOnce(
  129. 'DatePickerIOS-merged',
  130. 'DatePickerIOS has been merged with DatePickerAndroid and will be removed in a future release. ' +
  131. "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
  132. 'See https://github.com/react-native-community/datetimepicker',
  133. );
  134. return require('./Libraries/Components/DatePicker/DatePickerIOS');
  135. },
  136. get DrawerLayoutAndroid(): DrawerLayoutAndroid {
  137. return require('./Libraries/Components/DrawerAndroid/DrawerLayoutAndroid');
  138. },
  139. get FlatList(): FlatList {
  140. return require('./Libraries/Lists/FlatList');
  141. },
  142. get Image(): Image {
  143. return require('./Libraries/Image/Image');
  144. },
  145. get ImageBackground(): ImageBackground {
  146. return require('./Libraries/Image/ImageBackground');
  147. },
  148. get InputAccessoryView(): InputAccessoryView {
  149. return require('./Libraries/Components/TextInput/InputAccessoryView');
  150. },
  151. get KeyboardAvoidingView(): KeyboardAvoidingView {
  152. return require('./Libraries/Components/Keyboard/KeyboardAvoidingView');
  153. },
  154. get MaskedViewIOS(): MaskedViewIOS {
  155. warnOnce(
  156. 'maskedviewios-moved',
  157. 'MaskedViewIOS has been extracted from react-native core and will be removed in a future release. ' +
  158. "It can now be installed and imported from '@react-native-community/masked-view' instead of 'react-native'. " +
  159. 'See https://github.com/react-native-community/react-native-masked-view',
  160. );
  161. return require('./Libraries/Components/MaskedView/MaskedViewIOS');
  162. },
  163. get Modal(): Modal {
  164. return require('./Libraries/Modal/Modal');
  165. },
  166. get Picker(): Picker {
  167. warnOnce(
  168. 'picker-moved',
  169. 'Picker has been extracted from react-native core and will be removed in a future release. ' +
  170. "It can now be installed and imported from '@react-native-community/picker' instead of 'react-native'. " +
  171. 'See https://github.com/react-native-community/react-native-picker',
  172. );
  173. return require('./Libraries/Components/Picker/Picker');
  174. },
  175. get PickerIOS(): PickerIOS {
  176. warnOnce(
  177. 'pickerios-moved',
  178. 'PickerIOS has been extracted from react-native core and will be removed in a future release. ' +
  179. "It can now be installed and imported from '@react-native-community/picker' instead of 'react-native'. " +
  180. 'See https://github.com/react-native-community/react-native-picker',
  181. );
  182. return require('./Libraries/Components/Picker/PickerIOS');
  183. },
  184. get Pressable(): Pressable {
  185. return require('./Libraries/Components/Pressable/Pressable').default;
  186. },
  187. get ProgressBarAndroid(): ProgressBarAndroid {
  188. warnOnce(
  189. 'progress-bar-android-moved',
  190. 'ProgressBarAndroid has been extracted from react-native core and will be removed in a future release. ' +
  191. "It can now be installed and imported from '@react-native-community/progress-bar-android' instead of 'react-native'. " +
  192. 'See https://github.com/react-native-community/progress-bar-android',
  193. );
  194. return require('./Libraries/Components/ProgressBarAndroid/ProgressBarAndroid');
  195. },
  196. get ProgressViewIOS(): ProgressViewIOS {
  197. warnOnce(
  198. 'progress-view-ios-moved',
  199. 'ProgressViewIOS has been extracted from react-native core and will be removed in a future release. ' +
  200. "It can now be installed and imported from '@react-native-community/progress-view' instead of 'react-native'. " +
  201. 'See https://github.com/react-native-community/progress-view',
  202. );
  203. return require('./Libraries/Components/ProgressViewIOS/ProgressViewIOS');
  204. },
  205. get SafeAreaView(): SafeAreaView {
  206. return require('./Libraries/Components/SafeAreaView/SafeAreaView');
  207. },
  208. get ScrollView(): ScrollView {
  209. return require('./Libraries/Components/ScrollView/ScrollView');
  210. },
  211. get SectionList(): SectionList {
  212. return require('./Libraries/Lists/SectionList');
  213. },
  214. get SegmentedControlIOS(): SegmentedControlIOS {
  215. warnOnce(
  216. 'segmented-control-ios-moved',
  217. 'SegmentedControlIOS has been extracted from react-native core and will be removed in a future release. ' +
  218. "It can now be installed and imported from '@react-native-community/segmented-control' instead of 'react-native'. " +
  219. 'See https://github.com/react-native-community/segmented-control',
  220. );
  221. return require('./Libraries/Components/SegmentedControlIOS/SegmentedControlIOS');
  222. },
  223. get Slider(): Slider {
  224. warnOnce(
  225. 'slider-moved',
  226. 'Slider has been extracted from react-native core and will be removed in a future release. ' +
  227. "It can now be installed and imported from '@react-native-community/slider' instead of 'react-native'. " +
  228. 'See https://github.com/react-native-community/react-native-slider',
  229. );
  230. return require('./Libraries/Components/Slider/Slider');
  231. },
  232. get Switch(): Switch {
  233. return require('./Libraries/Components/Switch/Switch');
  234. },
  235. get RefreshControl(): RefreshControl {
  236. return require('./Libraries/Components/RefreshControl/RefreshControl');
  237. },
  238. get StatusBar(): StatusBar {
  239. return require('./Libraries/Components/StatusBar/StatusBar');
  240. },
  241. get Text(): Text {
  242. return require('./Libraries/Text/Text');
  243. },
  244. get TextInput(): TextInput {
  245. return require('./Libraries/Components/TextInput/TextInput');
  246. },
  247. get Touchable(): Touchable {
  248. return require('./Libraries/Components/Touchable/Touchable');
  249. },
  250. get TouchableHighlight(): TouchableHighlight {
  251. return require('./Libraries/Components/Touchable/TouchableHighlight');
  252. },
  253. get TouchableNativeFeedback(): TouchableNativeFeedback {
  254. return require('./Libraries/Components/Touchable/TouchableNativeFeedback');
  255. },
  256. get TouchableOpacity(): TouchableOpacity {
  257. return require('./Libraries/Components/Touchable/TouchableOpacity');
  258. },
  259. get TouchableWithoutFeedback(): TouchableWithoutFeedback {
  260. return require('./Libraries/Components/Touchable/TouchableWithoutFeedback');
  261. },
  262. get View(): View {
  263. return require('./Libraries/Components/View/View');
  264. },
  265. get VirtualizedList(): VirtualizedList {
  266. return require('./Libraries/Lists/VirtualizedList');
  267. },
  268. get VirtualizedSectionList(): VirtualizedSectionList {
  269. return require('./Libraries/Lists/VirtualizedSectionList');
  270. },
  271. // APIs
  272. get ActionSheetIOS(): ActionSheetIOS {
  273. return require('./Libraries/ActionSheetIOS/ActionSheetIOS');
  274. },
  275. get Alert(): Alert {
  276. return require('./Libraries/Alert/Alert');
  277. },
  278. get Animated(): Animated {
  279. return require('./Libraries/Animated/src/Animated');
  280. },
  281. get Appearance(): Appearance {
  282. return require('./Libraries/Utilities/Appearance');
  283. },
  284. get AppRegistry(): AppRegistry {
  285. return require('./Libraries/ReactNative/AppRegistry');
  286. },
  287. get AppState(): AppState {
  288. return require('./Libraries/AppState/AppState');
  289. },
  290. get AsyncStorage(): AsyncStorage {
  291. warnOnce(
  292. 'async-storage-moved',
  293. 'AsyncStorage has been extracted from react-native core and will be removed in a future release. ' +
  294. "It can now be installed and imported from '@react-native-community/async-storage' instead of 'react-native'. " +
  295. 'See https://github.com/react-native-community/async-storage',
  296. );
  297. return require('./Libraries/Storage/AsyncStorage');
  298. },
  299. get BackHandler(): BackHandler {
  300. return require('./Libraries/Utilities/BackHandler');
  301. },
  302. get Clipboard(): Clipboard {
  303. warnOnce(
  304. 'clipboard-moved',
  305. 'Clipboard has been extracted from react-native core and will be removed in a future release. ' +
  306. "It can now be installed and imported from '@react-native-community/clipboard' instead of 'react-native'. " +
  307. 'See https://github.com/react-native-community/clipboard',
  308. );
  309. return require('./Libraries/Components/Clipboard/Clipboard');
  310. },
  311. get DatePickerAndroid(): DatePickerAndroid {
  312. warnOnce(
  313. 'DatePickerAndroid-merged',
  314. 'DatePickerAndroid has been merged with DatePickerIOS and will be removed in a future release. ' +
  315. "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
  316. 'See https://github.com/react-native-community/datetimepicker',
  317. );
  318. return require('./Libraries/Components/DatePickerAndroid/DatePickerAndroid');
  319. },
  320. get DeviceInfo(): DeviceInfo {
  321. return require('./Libraries/Utilities/DeviceInfo');
  322. },
  323. get DevSettings(): DevSettings {
  324. return require('./Libraries/Utilities/DevSettings');
  325. },
  326. get Dimensions(): Dimensions {
  327. return require('./Libraries/Utilities/Dimensions');
  328. },
  329. get Easing(): Easing {
  330. return require('./Libraries/Animated/src/Easing');
  331. },
  332. get findNodeHandle(): $PropertyType<ReactNative, 'findNodeHandle'> {
  333. return require('./Libraries/Renderer/shims/ReactNative').findNodeHandle;
  334. },
  335. get I18nManager(): I18nManager {
  336. return require('./Libraries/ReactNative/I18nManager');
  337. },
  338. get ImagePickerIOS(): ImagePickerIOS {
  339. warnOnce(
  340. 'imagePickerIOS-moved',
  341. 'ImagePickerIOS has been extracted from react-native core and will be removed in a future release. ' +
  342. "Please upgrade to use either '@react-native-community/react-native-image-picker' or 'expo-image-picker'. " +
  343. "If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " +
  344. 'See https://github.com/react-native-community/react-native-image-picker-ios',
  345. );
  346. return require('./Libraries/Image/ImagePickerIOS');
  347. },
  348. get InteractionManager(): InteractionManager {
  349. return require('./Libraries/Interaction/InteractionManager');
  350. },
  351. get Keyboard(): Keyboard {
  352. return require('./Libraries/Components/Keyboard/Keyboard');
  353. },
  354. get LayoutAnimation(): LayoutAnimation {
  355. return require('./Libraries/LayoutAnimation/LayoutAnimation');
  356. },
  357. get Linking(): Linking {
  358. return require('./Libraries/Linking/Linking');
  359. },
  360. get LogBox(): LogBox {
  361. return require('./Libraries/LogBox/LogBox');
  362. },
  363. get NativeDialogManagerAndroid(): NativeDialogManagerAndroid {
  364. return require('./Libraries/NativeModules/specs/NativeDialogManagerAndroid')
  365. .default;
  366. },
  367. get NativeEventEmitter(): NativeEventEmitter {
  368. return require('./Libraries/EventEmitter/NativeEventEmitter');
  369. },
  370. get Networking(): Networking {
  371. return require('./Libraries/Network/RCTNetworking');
  372. },
  373. get PanResponder(): PanResponder {
  374. return require('./Libraries/Interaction/PanResponder');
  375. },
  376. get PermissionsAndroid(): PermissionsAndroid {
  377. return require('./Libraries/PermissionsAndroid/PermissionsAndroid');
  378. },
  379. get PixelRatio(): PixelRatio {
  380. return require('./Libraries/Utilities/PixelRatio');
  381. },
  382. get PushNotificationIOS(): PushNotificationIOS {
  383. warnOnce(
  384. 'pushNotificationIOS-moved',
  385. 'PushNotificationIOS has been extracted from react-native core and will be removed in a future release. ' +
  386. "It can now be installed and imported from '@react-native-community/push-notification-ios' instead of 'react-native'. " +
  387. 'See https://github.com/react-native-community/push-notification-ios',
  388. );
  389. return require('./Libraries/PushNotificationIOS/PushNotificationIOS');
  390. },
  391. get Settings(): Settings {
  392. return require('./Libraries/Settings/Settings');
  393. },
  394. get Share(): Share {
  395. return require('./Libraries/Share/Share');
  396. },
  397. get StatusBarIOS(): StatusBarIOS {
  398. warnOnce(
  399. 'StatusBarIOS-merged',
  400. 'StatusBarIOS has been merged with StatusBar and will be removed in a future release. Use StatusBar for mutating the status bar',
  401. );
  402. return require('./Libraries/Components/StatusBar/StatusBarIOS');
  403. },
  404. get StyleSheet(): StyleSheet {
  405. return require('./Libraries/StyleSheet/StyleSheet');
  406. },
  407. get Systrace(): Systrace {
  408. return require('./Libraries/Performance/Systrace');
  409. },
  410. get ToastAndroid(): ToastAndroid {
  411. return require('./Libraries/Components/ToastAndroid/ToastAndroid');
  412. },
  413. get TurboModuleRegistry(): TurboModuleRegistry {
  414. return require('./Libraries/TurboModule/TurboModuleRegistry');
  415. },
  416. get TVEventHandler(): TVEventHandler {
  417. return require('./Libraries/Components/AppleTV/TVEventHandler');
  418. },
  419. get UIManager(): UIManager {
  420. return require('./Libraries/ReactNative/UIManager');
  421. },
  422. get unstable_batchedUpdates(): $PropertyType<
  423. ReactNative,
  424. 'unstable_batchedUpdates',
  425. > {
  426. return require('./Libraries/Renderer/shims/ReactNative')
  427. .unstable_batchedUpdates;
  428. },
  429. get useColorScheme(): useColorScheme {
  430. return require('./Libraries/Utilities/useColorScheme').default;
  431. },
  432. get useWindowDimensions(): useWindowDimensions {
  433. return require('./Libraries/Utilities/useWindowDimensions').default;
  434. },
  435. get UTFSequence(): UTFSequence {
  436. return require('./Libraries/UTFSequence');
  437. },
  438. get Vibration(): Vibration {
  439. return require('./Libraries/Vibration/Vibration');
  440. },
  441. get YellowBox(): YellowBox {
  442. return require('./Libraries/YellowBox/YellowBoxDeprecated');
  443. },
  444. // Plugins
  445. get DeviceEventEmitter(): RCTDeviceEventEmitter {
  446. return require('./Libraries/EventEmitter/RCTDeviceEventEmitter');
  447. },
  448. get NativeAppEventEmitter(): RCTNativeAppEventEmitter {
  449. return require('./Libraries/EventEmitter/RCTNativeAppEventEmitter');
  450. },
  451. get NativeModules(): NativeModules {
  452. return require('./Libraries/BatchedBridge/NativeModules');
  453. },
  454. get Platform(): Platform {
  455. return require('./Libraries/Utilities/Platform');
  456. },
  457. get processColor(): processColor {
  458. return require('./Libraries/StyleSheet/processColor');
  459. },
  460. get PlatformColor(): PlatformColor {
  461. return require('./Libraries/StyleSheet/PlatformColorValueTypes')
  462. .PlatformColor;
  463. },
  464. get DynamicColorIOS(): DynamicColorIOS {
  465. return require('./Libraries/StyleSheet/PlatformColorValueTypesIOS')
  466. .DynamicColorIOS;
  467. },
  468. get ColorAndroid(): ColorAndroid {
  469. return require('./Libraries/StyleSheet/PlatformColorValueTypesAndroid')
  470. .ColorAndroid;
  471. },
  472. get requireNativeComponent(): <T>(
  473. uiViewClassName: string,
  474. ) => HostComponent<T> {
  475. return require('./Libraries/ReactNative/requireNativeComponent');
  476. },
  477. get unstable_RootTagContext(): RootTagContext {
  478. return require('./Libraries/ReactNative/RootTagContext');
  479. },
  480. get unstable_enableLogBox(): () => void {
  481. return () =>
  482. console.warn(
  483. 'LogBox is enabled by default so there is no need to call unstable_enableLogBox() anymore. This is a no op and will be removed in the next version.',
  484. );
  485. },
  486. // Prop Types
  487. get ColorPropType(): DeprecatedColorPropType {
  488. return require('./Libraries/DeprecatedPropTypes/DeprecatedColorPropType');
  489. },
  490. get EdgeInsetsPropType(): DeprecatedEdgeInsetsPropType {
  491. return require('./Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType');
  492. },
  493. get PointPropType(): DeprecatedPointPropType {
  494. return require('./Libraries/DeprecatedPropTypes/DeprecatedPointPropType');
  495. },
  496. get ViewPropTypes(): DeprecatedViewPropTypes {
  497. return require('./Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes');
  498. },
  499. };
  500. if (__DEV__) {
  501. // $FlowFixMe This is intentional: Flow will error when attempting to access ART.
  502. Object.defineProperty(module.exports, 'ART', {
  503. configurable: true,
  504. get() {
  505. invariant(
  506. false,
  507. 'ART has been removed from React Native. ' +
  508. "It can now be installed and imported from '@react-native-community/art' instead of 'react-native'. " +
  509. 'See https://github.com/react-native-community/art',
  510. );
  511. },
  512. });
  513. // $FlowFixMe This is intentional: Flow will error when attempting to access ListView.
  514. Object.defineProperty(module.exports, 'ListView', {
  515. configurable: true,
  516. get() {
  517. invariant(
  518. false,
  519. 'ListView has been removed from React Native. ' +
  520. 'See https://fb.me/nolistview for more information or use ' +
  521. '`deprecated-react-native-listview`.',
  522. );
  523. },
  524. });
  525. // $FlowFixMe This is intentional: Flow will error when attempting to access SwipeableListView.
  526. Object.defineProperty(module.exports, 'SwipeableListView', {
  527. configurable: true,
  528. get() {
  529. invariant(
  530. false,
  531. 'SwipeableListView has been removed from React Native. ' +
  532. 'See https://fb.me/nolistview for more information or use ' +
  533. '`deprecated-react-native-swipeable-listview`.',
  534. );
  535. },
  536. });
  537. // $FlowFixMe This is intentional: Flow will error when attempting to access WebView.
  538. Object.defineProperty(module.exports, 'WebView', {
  539. configurable: true,
  540. get() {
  541. invariant(
  542. false,
  543. 'WebView has been removed from React Native. ' +
  544. "It can now be installed and imported from 'react-native-webview' instead of 'react-native'. " +
  545. 'See https://github.com/react-native-community/react-native-webview',
  546. );
  547. },
  548. });
  549. // $FlowFixMe This is intentional: Flow will error when attempting to access NetInfo.
  550. Object.defineProperty(module.exports, 'NetInfo', {
  551. configurable: true,
  552. get() {
  553. invariant(
  554. false,
  555. 'NetInfo has been removed from React Native. ' +
  556. "It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. " +
  557. 'See https://github.com/react-native-community/react-native-netinfo',
  558. );
  559. },
  560. });
  561. // $FlowFixMe This is intentional: Flow will error when attempting to access CameraRoll.
  562. Object.defineProperty(module.exports, 'CameraRoll', {
  563. configurable: true,
  564. get() {
  565. invariant(
  566. false,
  567. 'CameraRoll has been removed from React Native. ' +
  568. "It can now be installed and imported from '@react-native-community/cameraroll' instead of 'react-native'. " +
  569. 'See https://github.com/react-native-community/react-native-cameraroll',
  570. );
  571. },
  572. });
  573. // $FlowFixMe This is intentional: Flow will error when attempting to access ImageStore.
  574. Object.defineProperty(module.exports, 'ImageStore', {
  575. configurable: true,
  576. get() {
  577. invariant(
  578. false,
  579. 'ImageStore has been removed from React Native. ' +
  580. 'To get a base64-encoded string from a local image use either of the following third-party libraries:' +
  581. "* expo-file-system: `readAsStringAsync(filepath, 'base64')`" +
  582. "* react-native-fs: `readFile(filepath, 'base64')`",
  583. );
  584. },
  585. });
  586. // $FlowFixMe This is intentional: Flow will error when attempting to access ImageEditor.
  587. Object.defineProperty(module.exports, 'ImageEditor', {
  588. configurable: true,
  589. get() {
  590. invariant(
  591. false,
  592. 'ImageEditor has been removed from React Native. ' +
  593. "It can now be installed and imported from '@react-native-community/image-editor' instead of 'react-native'. " +
  594. 'See https://github.com/react-native-community/react-native-image-editor',
  595. );
  596. },
  597. });
  598. // $FlowFixMe This is intentional: Flow will error when attempting to access TimePickerAndroid.
  599. Object.defineProperty(module.exports, 'TimePickerAndroid', {
  600. configurable: true,
  601. get() {
  602. invariant(
  603. false,
  604. 'TimePickerAndroid has been removed from React Native. ' +
  605. "It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
  606. 'See https://github.com/react-native-community/datetimepicker',
  607. );
  608. },
  609. });
  610. // $FlowFixMe This is intentional: Flow will error when attempting to access ToolbarAndroid.
  611. Object.defineProperty(module.exports, 'ToolbarAndroid', {
  612. configurable: true,
  613. get() {
  614. invariant(
  615. false,
  616. 'ToolbarAndroid has been removed from React Native. ' +
  617. "It can now be installed and imported from '@react-native-community/toolbar-android' instead of 'react-native'. " +
  618. 'See https://github.com/react-native-community/toolbar-android',
  619. );
  620. },
  621. });
  622. // $FlowFixMe This is intentional: Flow will error when attempting to access ViewPagerAndroid.
  623. Object.defineProperty(module.exports, 'ViewPagerAndroid', {
  624. configurable: true,
  625. get() {
  626. invariant(
  627. false,
  628. 'ViewPagerAndroid has been removed from React Native. ' +
  629. "It can now be installed and imported from '@react-native-community/viewpager' instead of 'react-native'. " +
  630. 'See https://github.com/react-native-community/react-native-viewpager',
  631. );
  632. },
  633. });
  634. }