2015-09-08 17:41:41 -07:00
|
|
|
/**
|
2022-10-18 11:19:24 -04:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2015-09-08 17:41:41 -07:00
|
|
|
*
|
2017-09-24 13:48:13 -07:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-09-08 17:41:41 -07:00
|
|
|
*
|
2018-05-14 17:47:47 -07:00
|
|
|
* @format
|
2018-08-29 13:54:58 -07:00
|
|
|
* @flow strict-local
|
2015-09-08 17:41:41 -07:00
|
|
|
*/
|
2017-04-05 16:47:29 +01:00
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2019-06-03 07:58:31 -07:00
|
|
|
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
2021-02-26 00:00:32 -05:00
|
|
|
import {type ViewConfig} from './ReactNativeTypes';
|
2017-04-05 16:47:29 +01:00
|
|
|
|
2019-06-03 07:58:31 -07:00
|
|
|
const {register} = ReactNativeViewConfigRegistry;
|
2018-04-09 20:05:57 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a renderable ReactNative host component.
|
|
|
|
|
* Use this method for view configs that are loaded from UIManager.
|
|
|
|
|
* Use createReactNativeComponentClass() for view configs defined within JavaScript.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} config iOS View configuration.
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
const createReactNativeComponentClass = function(
|
|
|
|
|
name: string,
|
2021-02-26 00:00:32 -05:00
|
|
|
callback: () => ViewConfig,
|
2018-04-09 20:05:57 -07:00
|
|
|
): string {
|
|
|
|
|
return register(name, callback);
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-09 20:41:49 -07:00
|
|
|
module.exports = createReactNativeComponentClass;
|