react-native/Libraries/Components/View/requireFabricView.js
Andrew Chen (Eng) cbb7c7c193 Pass fabric flag from native to JS
Reviewed By: mdvacca

Differential Revision: D7373722

fbshipit-source-id: 3cd051f38677900693f3da797effa11f9161df37
2018-03-23 09:32:00 -07:00

26 lines
641 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.
*
* @providesModule requireFabricView
* @flow
* @format
*/
'use strict';
/**
* This is a switch on the correct view to use for Fabric
*/
module.exports = (name: string, fabric: boolean) => {
switch (name) {
case 'View':
return fabric ? require('FabricView') : require('View');
case 'Text':
return fabric ? require('FabricText') : require('Text');
default:
throw new Error(name + ' is not supported by Fabric yet');
}
};