Files
react-native/Libraries/ReactNative/ReactNativeArchitectureIndicator.js
T
Kevin Gozali e5b63410b4 Show both TM/Fabric overlay over the root view
Summary: This expands the existing FABRIC overlay to also indicate "TM" if turbomodule is active.

Reviewed By: yungsters

Differential Revision: D16999391

fbshipit-source-id: 42eedb697636c1172e595bc7c1ace2a9367a13b8
2019-08-26 11:02:25 -07:00

57 lines
1.2 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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 React = require('react');
const StyleSheet = require('../StyleSheet/StyleSheet');
const Text = require('../Text/Text');
const View = require('../Components/View/View');
const hasTurboModule = global.__turboModuleProxy != null;
const isBridgeless = global.RN$Bridgeless === true;
function ReactNativeArchitectureIndicator(props: {|
fabric: boolean,
|}): React.Node {
const parts = [];
if (isBridgeless) {
parts.push('NOBRIDGE');
} else {
if (props.fabric) {
parts.push('FABRIC');
}
if (hasTurboModule) {
parts.push('TM');
}
}
return (
<View style={styles.container}>
<Text style={styles.text}>{parts.join('+')}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'rgba(0,0,0, 0.25)',
position: 'absolute',
top: 0,
right: 0,
padding: 2,
},
text: {
fontSize: 6,
color: '#ffffff',
},
});
module.exports = ReactNativeArchitectureIndicator;