Skip to content

Commit 78c8ec0

Browse files
authored
Remove deprecated ViewPropTypes (#209)
* Remove deprecated ViewPropTypes * Revise styles proptype
1 parent 7cda786 commit 78c8ec0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/Row.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component, cloneElement} from 'react';
22
import PropTypes from 'prop-types';
3-
import {Animated, PanResponder, StyleSheet, ViewPropTypes} from 'react-native';
3+
import {Animated, PanResponder, StyleSheet} from 'react-native';
44
import {shallowEqual} from './utils';
55

66
export default class Row extends Component {
@@ -9,7 +9,7 @@ export default class Row extends Component {
99
animated: PropTypes.bool,
1010
disabled: PropTypes.bool,
1111
horizontal: PropTypes.bool,
12-
style: ViewPropTypes.style,
12+
style: PropTypes.object,
1313
location: PropTypes.shape({
1414
x: PropTypes.number,
1515
y: PropTypes.number,

src/SortableList.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
22
import PropTypes from 'prop-types';
3-
import {ScrollView, View, StyleSheet, Platform, RefreshControl, ViewPropTypes} from 'react-native';
3+
import {ScrollView, View, StyleSheet, Platform, RefreshControl} from 'react-native';
44
import {shallowEqual, swapArrayElements} from './utils';
55
import Row from './Row';
66

@@ -13,13 +13,17 @@ function uniqueRowKey(key) {
1313

1414
uniqueRowKey.id = 0
1515

16+
// react-native seems to sometimes represent stylesheet entries as numbers, and sometimes as objects.
17+
// See: https://stackoverflow.com/questions/41483862/how-are-styles-mapped-to-numbers-in-react-native
18+
const STYLE_TYPE = PropTypes.oneOfType([PropTypes.number, PropTypes.object])
19+
1620
export default class SortableList extends Component {
1721
static propTypes = {
1822
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
1923
order: PropTypes.arrayOf(PropTypes.any),
20-
style: ViewPropTypes.style,
21-
contentContainerStyle: ViewPropTypes.style,
22-
innerContainerStyle: ViewPropTypes.style,
24+
style: STYLE_TYPE,
25+
contentContainerStyle: STYLE_TYPE,
26+
innerContainerStyle: STYLE_TYPE,
2327
sortingEnabled: PropTypes.bool,
2428
scrollEnabled: PropTypes.bool,
2529
horizontal: PropTypes.bool,

0 commit comments

Comments
 (0)