BorderBox.js 787 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow strict-local
  9. */
  10. 'use strict';
  11. const React = require('react');
  12. const View = require('../Components/View/View');
  13. class BorderBox extends React.Component<$FlowFixMeProps> {
  14. render(): $FlowFixMe | React.Node {
  15. const box = this.props.box;
  16. if (!box) {
  17. return this.props.children;
  18. }
  19. const style = {
  20. borderTopWidth: box.top,
  21. borderBottomWidth: box.bottom,
  22. borderLeftWidth: box.left,
  23. borderRightWidth: box.right,
  24. };
  25. return <View style={[style, this.props.style]}>{this.props.children}</View>;
  26. }
  27. }
  28. module.exports = BorderBox;