@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
41 lines (37 loc) • 1.17 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React, { useMemo, memo } from 'react';
import { View } from 'react-native';
import RowContext from './context';
import STYLES from './style';
/**
* Row 布局
* @description 一组单元格。
*/
const Row = _ref => {
let {
gap = 0,
style,
justify,
align,
...restProps
} = _ref;
const ctx = useMemo(() => ({
gap
}), [gap]);
const rowStyles = [STYLES.row, {
marginHorizontal: -(+gap / 2),
justifyContent: justify,
alignItems: align
}, style // to test ui
// {
// backgroundColor: '#666',
// },
]; // console.log(-(+gutter / 2));
return /*#__PURE__*/React.createElement(RowContext.Provider, {
value: ctx
}, /*#__PURE__*/React.createElement(View, _extends({}, restProps, {
style: rowStyles
})));
};
export default /*#__PURE__*/memo(Row);
//# sourceMappingURL=row.js.map