Make UnimplementedView invisible in prod

Reviewed By: yungsters

Differential Revision: D5188697

fbshipit-source-id: 13bae1c99876d81204a89d72227bed4774be1664
This commit is contained in:
Spencer Ahrens 2017-06-06 09:38:32 -07:00 committed by Facebook Github Bot
parent d78fb45f43
commit 23e2771719

View File

@ -8,26 +8,27 @@
* *
* @providesModule UnimplementedView * @providesModule UnimplementedView
* @flow * @flow
* @format
*/ */
'use strict'; 'use strict';
var React = require('React'); const React = require('React');
var StyleSheet = require('StyleSheet'); const StyleSheet = require('StyleSheet');
/** /**
* Common implementation for a simple stubbed view. Simply applies the view's styles to the inner * Common implementation for a simple stubbed view. Simply applies the view's styles to the inner
* View component and renders its children. * View component and renders its children.
*/ */
class UnimplementedView extends React.Component { class UnimplementedView extends React.Component {
setNativeProps = () => { setNativeProps() {
// Do nothing. // Do nothing.
// This method is required in order to use this view as a Touchable* child. // This method is required in order to use this view as a Touchable* child.
// See ensureComponentIsNative.js for more info // See ensureComponentIsNative.js for more info
}; }
render() { render() {
// Workaround require cycle from requireNativeComponent // Workaround require cycle from requireNativeComponent
var View = require('View'); const View = require('View');
return ( return (
<View style={[styles.unimplementedView, this.props.style]}> <View style={[styles.unimplementedView, this.props.style]}>
{this.props.children} {this.props.children}
@ -36,12 +37,14 @@ class UnimplementedView extends React.Component {
} }
} }
var styles = StyleSheet.create({ const styles = StyleSheet.create({
unimplementedView: { unimplementedView: __DEV__
borderWidth: 1, ? {
borderColor: 'red', alignSelf: 'flex-start',
alignSelf: 'flex-start', borderColor: 'red',
} borderWidth: 1,
}
: {},
}); });
module.exports = UnimplementedView; module.exports = UnimplementedView;