2015-01-30 01:10:49 +00:00
|
|
|
/**
|
2015-03-23 22:07:33 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
2015-01-30 01:10:49 +00:00
|
|
|
*
|
2015-05-08 16:45:43 +00:00
|
|
|
* @providesModule createReactNativeComponentClass
|
2015-03-26 01:19:28 +00:00
|
|
|
* @flow
|
2015-01-30 01:10:49 +00:00
|
|
|
*/
|
|
|
|
|
2015-05-19 20:43:46 +00:00
|
|
|
'use strict';
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-05-08 16:45:43 +00:00
|
|
|
var ReactNativeBaseComponent = require('ReactNativeBaseComponent');
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-05-08 16:45:43 +00:00
|
|
|
// See also ReactNativeBaseComponent
|
|
|
|
type ReactNativeBaseComponentViewConfig = {
|
2015-03-26 01:19:28 +00:00
|
|
|
validAttributes: Object;
|
|
|
|
uiViewClassName: string;
|
2015-07-25 01:31:55 +00:00
|
|
|
propTypes?: Object,
|
2015-03-26 01:19:28 +00:00
|
|
|
}
|
|
|
|
|
2015-01-30 01:10:49 +00:00
|
|
|
/**
|
|
|
|
* @param {string} config iOS View configuration.
|
|
|
|
* @private
|
|
|
|
*/
|
2015-05-08 16:45:43 +00:00
|
|
|
var createReactNativeComponentClass = function(
|
|
|
|
viewConfig: ReactNativeBaseComponentViewConfig
|
2016-03-08 20:38:52 +00:00
|
|
|
): ReactClass<any> {
|
2015-03-09 05:39:23 +00:00
|
|
|
var Constructor = function(element) {
|
|
|
|
this._currentElement = element;
|
|
|
|
|
|
|
|
this._rootNodeID = null;
|
|
|
|
this._renderedChildren = null;
|
2015-01-30 01:10:49 +00:00
|
|
|
};
|
|
|
|
Constructor.displayName = viewConfig.uiViewClassName;
|
2015-06-09 23:02:16 +00:00
|
|
|
Constructor.viewConfig = viewConfig;
|
2015-07-25 01:31:55 +00:00
|
|
|
Constructor.propTypes = viewConfig.propTypes;
|
2015-05-08 16:45:43 +00:00
|
|
|
Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
|
2015-05-31 19:44:18 +00:00
|
|
|
Constructor.prototype.constructor = Constructor;
|
2015-01-30 01:10:49 +00:00
|
|
|
|
2015-06-10 20:42:41 +00:00
|
|
|
return ((Constructor: any): ReactClass);
|
2015-01-30 01:10:49 +00:00
|
|
|
};
|
|
|
|
|
2015-05-08 16:45:43 +00:00
|
|
|
module.exports = createReactNativeComponentClass;
|