2015-06-03 19:53:08 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-06-03 19:53:08 +00:00
|
|
|
*
|
|
|
|
* @providesModule BorderBox
|
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('React');
|
|
|
|
var View = require('View');
|
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class BorderBox extends React.Component<$FlowFixMeProps> {
|
2015-06-03 19:53:08 +00:00
|
|
|
render() {
|
|
|
|
var box = this.props.box;
|
|
|
|
if (!box) {
|
|
|
|
return this.props.children;
|
|
|
|
}
|
|
|
|
var style = {
|
|
|
|
borderTopWidth: box.top,
|
|
|
|
borderBottomWidth: box.bottom,
|
|
|
|
borderLeftWidth: box.left,
|
|
|
|
borderRightWidth: box.right,
|
|
|
|
};
|
|
|
|
return (
|
|
|
|
<View style={[style, this.props.style]}>
|
|
|
|
{this.props.children}
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = BorderBox;
|
|
|
|
|