From 9e2b540b5e5d11b505e840b96d613025b817aa53 Mon Sep 17 00:00:00 2001 From: Sushil da Silva Date: Mon, 6 Nov 2017 17:12:35 -0500 Subject: [PATCH 1/2] fix prop-types for react native 0.49 --- SortableCell.js | 2 +- SortableSudokuGrid.js | 2 +- package.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) 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..f244619 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, 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" } } From 3b7022f4361ef680b668094cc0ee6b2ee52ce7e9 Mon Sep 17 00:00:00 2001 From: Sushil da Silva Date: Tue, 14 Nov 2017 20:26:04 -0500 Subject: [PATCH 2/2] add onResort callback prop to be called whenever the datasource is re-sorted --- SortableSudokuGrid.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SortableSudokuGrid.js b/SortableSudokuGrid.js index f244619..e443f15 100644 --- a/SortableSudokuGrid.js +++ b/SortableSudokuGrid.js @@ -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) => {