createReactNativeComponentClass.js 938 B

12345678910111213141516171819202122232425262728293031323334
  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 strict-local
  9. */
  10. 'use strict';
  11. import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
  12. import type {ViewConfigGetter} from './ReactNativeTypes';
  13. const {register} = ReactNativeViewConfigRegistry;
  14. /**
  15. * Creates a renderable ReactNative host component.
  16. * Use this method for view configs that are loaded from UIManager.
  17. * Use createReactNativeComponentClass() for view configs defined within JavaScript.
  18. *
  19. * @param {string} config iOS View configuration.
  20. * @private
  21. */
  22. const createReactNativeComponentClass = function(
  23. name: string,
  24. callback: ViewConfigGetter,
  25. ): string {
  26. return register(name, callback);
  27. };
  28. module.exports = createReactNativeComponentClass;