2015-09-09 08:41:41 +08:00
|
|
|
/**
|
2022-10-18 23:19:24 +08:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2015-09-09 08:41:41 +08:00
|
|
|
*
|
2017-09-25 04:48:13 +08: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-09 08:41:41 +08:00
|
|
|
*
|
2018-05-15 08:47:47 +08:00
|
|
|
* @format
|
2018-08-30 04:54:58 +08:00
|
|
|
* @flow strict-local
|
2015-09-09 08:41:41 +08:00
|
|
|
*/
|
2017-04-05 23:47:29 +08:00
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2019-06-03 22:58:31 +08:00
|
|
|
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
2021-02-26 13:00:32 +08:00
|
|
|
import {type ViewConfig} from './ReactNativeTypes';
|
2017-04-05 23:47:29 +08:00
|
|
|
|
2019-06-03 22:58:31 +08:00
|
|
|
const {register} = ReactNativeViewConfigRegistry;
|
2018-04-10 11:05:57 +08: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
|
|
|
|
|
*/
|
2023-01-31 21:25:05 +08:00
|
|
|
const createReactNativeComponentClass = function (
|
2018-04-10 11:05:57 +08:00
|
|
|
name: string,
|
2021-02-26 13:00:32 +08:00
|
|
|
callback: () => ViewConfig,
|
2018-04-10 11:05:57 +08:00
|
|
|
): string {
|
|
|
|
|
return register(name, callback);
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-10 11:41:49 +08:00
|
|
|
module.exports = createReactNativeComponentClass;
|