2015-06-03 19:53:08 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-06-03 19:53:08 +00:00
|
|
|
*
|
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
|
|
|
*
|
2018-05-11 02:06:46 +00:00
|
|
|
* @format
|
2018-08-09 15:32:04 +00:00
|
|
|
* @flow strict-local
|
2015-06-03 19:53:08 +00:00
|
|
|
*/
|
2018-05-11 02:06:46 +00:00
|
|
|
|
2015-06-03 19:53:08 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-05-10 22:44:52 +00:00
|
|
|
const React = require('React');
|
|
|
|
const View = require('View');
|
2015-06-03 19:53:08 +00:00
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class BorderBox extends React.Component<$FlowFixMeProps> {
|
2015-06-03 19:53:08 +00:00
|
|
|
render() {
|
2018-05-10 22:44:52 +00:00
|
|
|
const box = this.props.box;
|
2015-06-03 19:53:08 +00:00
|
|
|
if (!box) {
|
|
|
|
return this.props.children;
|
|
|
|
}
|
2018-05-10 22:44:52 +00:00
|
|
|
const style = {
|
2015-06-03 19:53:08 +00:00
|
|
|
borderTopWidth: box.top,
|
|
|
|
borderBottomWidth: box.bottom,
|
|
|
|
borderLeftWidth: box.left,
|
|
|
|
borderRightWidth: box.right,
|
|
|
|
};
|
2018-05-11 02:06:46 +00:00
|
|
|
return <View style={[style, this.props.style]}>{this.props.children}</View>;
|
2015-06-03 19:53:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = BorderBox;
|