From d7a356bf3328daadce1d660cf41e8efd10859e2e Mon Sep 17 00:00:00 2001 From: AllenFang Date: Sun, 10 Dec 2017 14:51:35 +0800 Subject: [PATCH] fix wrong HOC for SortWrapper --- packages/react-bootstrap-table2/src/sort/wrapper.js | 4 ++-- packages/react-bootstrap-table2/src/table-factory.js | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/react-bootstrap-table2/src/sort/wrapper.js b/packages/react-bootstrap-table2/src/sort/wrapper.js index 61513fc2d..fcb644c10 100644 --- a/packages/react-bootstrap-table2/src/sort/wrapper.js +++ b/packages/react-bootstrap-table2/src/sort/wrapper.js @@ -4,7 +4,7 @@ import { Component } from 'react'; import PropTypes from 'prop-types'; -import { paginationElement } from '../table-factory'; +import { sortableElement } from '../table-factory'; class SortWrapper extends Component { constructor(props) { @@ -34,7 +34,7 @@ class SortWrapper extends Component { } render() { - return paginationElement({ + return sortableElement({ ...this.props, ref: node => this.table = node, onSort: this.handleSort, diff --git a/packages/react-bootstrap-table2/src/table-factory.js b/packages/react-bootstrap-table2/src/table-factory.js index 7ebfbd7f1..e8dbc4d49 100644 --- a/packages/react-bootstrap-table2/src/table-factory.js +++ b/packages/react-bootstrap-table2/src/table-factory.js @@ -20,11 +20,13 @@ export const pureTable = props => React.createElement(BootstrapTable, { ...props }); export const wrapWithPagination = (props) => { - const { wrapper } = props.pagination; - const PaginationBase = wrapper(pureTable); - return React.createElement(PaginationBase, { ...props }); + if (props.pagination) { + const { wrapper } = props.pagination; + const PaginationBase = wrapper(pureTable); + return React.createElement(PaginationBase, { ...props }); + } + return pureTable(props); }; -export const paginationElement = props => pureTable(props); export const sortableElement = props => wrapWithPagination(props);