Skip to content

Commit 74c3ce7

Browse files
authored
Fix deprecated prop types (ptomasroos#1185)
1 parent a7f46de commit 74c3ce7

File tree

5 files changed

+51
-20
lines changed

5 files changed

+51
-20
lines changed

DefaultTabBar.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const React = require('react');
2-
const { ViewPropTypes } = ReactNative = require('react-native');
2+
const ReactNative = require('react-native');
3+
const DeprecatedPropTypes = require('deprecated-react-native-prop-types');
34
const PropTypes = require('prop-types');
45
const createReactClass = require('create-react-class');
56
const {
@@ -18,10 +19,10 @@ const DefaultTabBar = createReactClass({
1819
backgroundColor: PropTypes.string,
1920
activeTextColor: PropTypes.string,
2021
inactiveTextColor: PropTypes.string,
21-
textStyle: Text.propTypes.style,
22-
tabStyle: ViewPropTypes.style,
22+
textStyle: DeprecatedPropTypes.TextPropTypes.style,
23+
tabStyle: DeprecatedPropTypes.ViewPropTypes.style,
2324
renderTab: PropTypes.func,
24-
underlineStyle: ViewPropTypes.style,
25+
underlineStyle: DeprecatedPropTypes.ViewPropTypes.style,
2526
},
2627

2728
getDefaultProps() {

ScrollableTabBar.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const React = require('react');
2-
const { ViewPropTypes } = ReactNative = require('react-native');
2+
const ReactNative = require('react-native');
3+
const DeprecatedPropTypes = require('deprecated-react-native-prop-types');
34
const PropTypes = require('prop-types');
45
const createReactClass = require('create-react-class');
56
const {
@@ -24,12 +25,12 @@ const ScrollableTabBar = createReactClass({
2425
activeTextColor: PropTypes.string,
2526
inactiveTextColor: PropTypes.string,
2627
scrollOffset: PropTypes.number,
27-
style: ViewPropTypes.style,
28-
tabStyle: ViewPropTypes.style,
29-
tabsContainerStyle: ViewPropTypes.style,
30-
textStyle: Text.propTypes.style,
28+
style: DeprecatedPropTypes.ViewPropTypes.style,
29+
tabStyle: DeprecatedPropTypes.ViewPropTypes.style,
30+
tabsContainerStyle: DeprecatedPropTypes.ViewPropTypes.style,
31+
textStyle: DeprecatedPropTypes.TextPropTypes.style,
3132
renderTab: PropTypes.func,
32-
underlineStyle: ViewPropTypes.style,
33+
underlineStyle: DeprecatedPropTypes.ViewPropTypes.style,
3334
onScroll: PropTypes.func,
3435
},
3536

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const React = require('react');
2-
const { Component } = React;
3-
const { ViewPropTypes } = ReactNative = require('react-native');
2+
const ReactNative = require('react-native');
3+
const DeprecatedPropTypes = require('deprecated-react-native-prop-types');
44
const createReactClass = require('create-react-class');
55
const PropTypes = require('prop-types');
66
const {
@@ -41,12 +41,12 @@ const ScrollableTabView = createReactClass({
4141
onChangeTab: PropTypes.func,
4242
onScroll: PropTypes.func,
4343
renderTabBar: PropTypes.any,
44-
tabBarUnderlineStyle: ViewPropTypes.style,
44+
tabBarUnderlineStyle: DeprecatedPropTypes.ViewPropTypes.style,
4545
tabBarBackgroundColor: PropTypes.string,
4646
tabBarActiveTextColor: PropTypes.string,
4747
tabBarInactiveTextColor: PropTypes.string,
4848
tabBarTextStyle: PropTypes.object,
49-
style: ViewPropTypes.style,
49+
style: DeprecatedPropTypes.ViewPropTypes.style,
5050
contentProps: PropTypes.object,
5151
scrollWithoutAnimation: PropTypes.bool,
5252
locked: PropTypes.bool,
@@ -342,7 +342,7 @@ const ScrollableTabView = createReactClass({
342342
if (!width || width <= 0 || Math.round(width) === Math.round(this.state.containerWidth)) {
343343
return;
344344
}
345-
345+
346346
if (Platform.OS === 'ios') {
347347
const containerWidthAnimatedValue = new Animated.Value(width);
348348
// Need to call __makeNative manually to avoid a native animated bug. See

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"dependencies": {
3232
"@react-native-community/viewpager": "3.3.0",
3333
"create-react-class": "^15.6.2",
34+
"deprecated-react-native-prop-types": "^2.3.0",
3435
"prop-types": "^15.6.0",
3536
"react-timer-mixin": "^0.13.3"
3637
},

yarn.lock

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
# yarn lockfile v1
33

44

5-
"@react-native-community/viewpager@^1.1.7":
6-
version "1.1.7"
7-
resolved "https://registry.yarnpkg.com/@react-native-community/viewpager/-/viewpager-1.1.7.tgz#7d3b1631f1ec91145db92a8e25c80d53027e96ba"
8-
integrity sha512-k9v2KJtAprNPq7IZmedD2VLMePvPW+ohX3uDnkpoKritBji+/RtRmTKrdtPi3Uvp0toq/KtPttAds1dr7AZNpw==
5+
"@react-native-community/[email protected]":
6+
version "3.3.0"
7+
resolved "https://registry.yarnpkg.com/@react-native-community/viewpager/-/viewpager-3.3.0.tgz#e613747a43a31a6f3278f817ba96fdaaa7941f23"
8+
integrity sha512-tyzh79l4t/hxiyS9QD3LRmWMs8KVkZzjrkQ8U8+8To1wmvVCBtp8BenvNsDLTBO7CpO/YmiThpmIdEZMr1WuVw==
9+
10+
"@react-native/normalize-color@*":
11+
version "2.0.0"
12+
resolved "https://registry.yarnpkg.com/@react-native/normalize-color/-/normalize-color-2.0.0.tgz#da955909432474a9a0fe1cbffc66576a0447f567"
13+
integrity sha512-Wip/xsc5lw8vsBlmY2MO/gFLp3MvuZ2baBZjDeTjjndMgM0h5sxz7AZR62RDPGgstp8Np7JzjvVqVT7tpFZqsw==
914

1015
acorn-jsx@^3.0.0:
1116
version "3.0.1"
@@ -261,6 +266,15 @@ deep-is@~0.1.3:
261266
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
262267
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
263268

269+
deprecated-react-native-prop-types@^2.3.0:
270+
version "2.3.0"
271+
resolved "https://registry.yarnpkg.com/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-2.3.0.tgz#c10c6ee75ff2b6de94bb127f142b814e6e08d9ab"
272+
integrity sha512-pWD0voFtNYxrVqvBMYf5gq3NA2GCpfodS1yNynTPc93AYA/KEMGeWDqqeUB6R2Z9ZofVhks2aeJXiuQqKNpesA==
273+
dependencies:
274+
"@react-native/normalize-color" "*"
275+
invariant "*"
276+
prop-types "*"
277+
264278
doctrine@^2.0.0:
265279
version "2.1.0"
266280
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d"
@@ -594,7 +608,7 @@ interpret@^1.0.0:
594608
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296"
595609
integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==
596610

597-
invariant@^2.2.2:
611+
invariant@*, invariant@^2.2.2:
598612
version "2.2.4"
599613
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
600614
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
@@ -850,6 +864,15 @@ promise@^7.1.1:
850864
dependencies:
851865
asap "~2.0.3"
852866

867+
prop-types@*:
868+
version "15.8.1"
869+
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
870+
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
871+
dependencies:
872+
loose-envify "^1.4.0"
873+
object-assign "^4.1.1"
874+
react-is "^16.13.1"
875+
853876
prop-types@^15.6.0:
854877
version "15.7.2"
855878
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
@@ -859,6 +882,11 @@ prop-types@^15.6.0:
859882
object-assign "^4.1.1"
860883
react-is "^16.8.1"
861884

885+
react-is@^16.13.1:
886+
version "16.13.1"
887+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
888+
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
889+
862890
react-is@^16.8.1:
863891
version "16.9.0"
864892
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb"

0 commit comments

Comments
 (0)