diff --git a/SortableCell.js b/SortableCell.js index 4bec6bc..b267cef 100644 --- a/SortableCell.js +++ b/SortableCell.js @@ -1,7 +1,7 @@ import React, { - PropTypes, Component, } from 'react' +import PropTypes from 'prop-types'; import { View, Text, StyleSheet, diff --git a/SortableSudokuGrid.js b/SortableSudokuGrid.js index ca722d1..e443f15 100644 --- a/SortableSudokuGrid.js +++ b/SortableSudokuGrid.js @@ -6,9 +6,9 @@ */ import React, { - PropTypes, Component, } from 'react' +import PropTypes from 'prop-types'; import { View, StyleSheet, @@ -51,6 +51,7 @@ class SortableSudokuGrid extends Component { dataSource: PropTypes.array.isRequired, renderCell: PropTypes.func.isRequired, sortable: PropTypes.bool, + onResort: PropTypes.func, } createHeight(props){ @@ -535,6 +536,10 @@ class SortableSudokuGrid extends Component { this.setState({ dataSource, }) + + if (this.props.onResort) { + this.props.onResort(dataSource) + } } _removeData = (cellIndex) => { diff --git a/package.json b/package.json index 5af36ce..95eb9a9 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "homepage": "https://github.com/react-native-component/react-native-smart-sortable-sudoku-grid#readme", "dependencies": { + "prop-types": "^15.6.0", "react-native-smart-timer-enhance": "^1.0.2" } }