react-native/Libraries/Components/View/ViewNativeComponent.js
Eli White d0eb8ff858 Put View ViewConfig in JS
Summary: Moving this config to native for android so we skip the native lookup for the config.

Reviewed By: yungsters

Differential Revision: D9415726

fbshipit-source-id: 84cac3f0dfa4f6ea8800de77676f1e2896ee463d
2018-08-22 13:03:15 -07:00

34 lines
914 B
JavaScript

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const Platform = require('Platform');
const ReactNative = require('ReactNative');
const requireNativeComponent = require('requireNativeComponent');
const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry');
import type {ViewProps} from 'ViewPropTypes';
type ViewNativeComponentType = Class<ReactNative.NativeComponent<ViewProps>>;
let NativeViewComponent;
if (Platform.OS === 'Android') {
NativeViewComponent = ReactNativeViewConfigRegistry.register('RCTView', () =>
require('ViewNativeComponentAndroidConfig'),
);
} else {
NativeViewComponent = requireNativeComponent('RCTView');
}
module.exports = ((NativeViewComponent: any): ViewNativeComponentType);