Skip to content
This repository was archived by the owner on Feb 4, 2021. It is now read-only.

Commit 3782930

Browse files
committed
Remove View.PropTypes.style no longer needed in new React version
1 parent e9a09e0 commit 3782930

File tree

7 files changed

+2730
-40
lines changed

7 files changed

+2730
-40
lines changed

lib/Button.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, {Component} from "react";
1+
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import {ActivityIndicator, View, Text, TouchableNativeFeedback, Platform} from "react-native";
3+
import { ActivityIndicator, View, Text, TouchableNativeFeedback, Platform } from 'react-native';
44
import Ripple from './polyfill/Ripple';
55
import { TYPO, PRIMARY, THEME_NAME, PRIMARY_COLORS } from './config';
66
import { getColor, isCompatible } from './helpers';
@@ -20,11 +20,7 @@ export default class Button extends Component {
2020
loading: PropTypes.bool,
2121
activityIndicatorColor: PropTypes.string,
2222
raised: PropTypes.bool,
23-
styles: PropTypes.shape({
24-
button: View.propTypes.style,
25-
disabled: View.propTypes.style,
26-
text: Text.propTypes.style
27-
}),
23+
styles: PropTypes.shape({}),
2824
onPress: PropTypes.func,
2925
onLongPress: PropTypes.func,
3026
};
@@ -37,7 +33,7 @@ export default class Button extends Component {
3733
raised: false,
3834
activityIndicatorColor: 'black',
3935
styles: {
40-
disabled: {opacity: 0.5}
36+
disabled: { opacity: 0.5 }
4137
}
4238
};
4339

@@ -259,7 +255,7 @@ export default class Button extends Component {
259255
elevation: raised ? elevation : 0
260256
},
261257
styles.button
262-
]}
258+
]}
263259
>
264260
<Text style={[TYPO.paperFontButton, textStyle, componentStyles.text, styles.text]}>
265261
{text || value}

lib/Card/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, {Component} from "react";
1+
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import {View, TouchableNativeFeedback} from "react-native";
3+
import { View, TouchableNativeFeedback } from 'react-native';
44
import Ripple from '../polyfill/Ripple';
55
import { getColor, isCompatible } from '../helpers';
66

@@ -21,8 +21,7 @@ export default class Card extends Component {
2121
elevation: PropTypes.number,
2222
disabled: PropTypes.bool,
2323
onPress: PropTypes.func,
24-
children: PropTypes.node.isRequired,
25-
style: View.propTypes.style
24+
children: PropTypes.node.isRequired
2625
};
2726

2827
static defaultProps = {

lib/Divider.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import React, {Component} from "react";
1+
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import {View} from "react-native";
3+
import { View } from 'react-native';
44
import { THEME_NAME } from './config';
55

66
export default class Divider extends Component {
77

88
static propTypes = {
99
inset: PropTypes.bool,
10-
theme: PropTypes.oneOf(THEME_NAME),
11-
style: View.propTypes.style
10+
theme: PropTypes.oneOf(THEME_NAME)
1211
};
1312

1413
static defaultProps = {

lib/Icon.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import React, {Component} from "react";
1+
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import {View} from "react-native";
43
import { getColor } from './helpers';
54
import VectorIconComponent from './VectorIconComponent';
65

76
export default class Icon extends Component {
87

98
static propTypes = {
109
name: PropTypes.string.isRequired,
11-
style: View.propTypes.style,
1210
size: PropTypes.number,
1311
color: PropTypes.string,
1412
allowFontScaling: PropTypes.bool
@@ -21,7 +19,7 @@ export default class Icon extends Component {
2119
};
2220

2321
render() {
24-
const { name, style, size, color, allowFontScaling} = this.props;
22+
const { name, style, size, color, allowFontScaling } = this.props;
2523
const VectorIcon = VectorIconComponent.get();
2624

2725
return (

lib/Toolbar.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, {Component} from "react";
1+
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import {View, Text} from "react-native";
3+
import { View, Text } from 'react-native';
44
import { TYPO, PRIMARY, THEME_NAME, PRIMARY_COLORS } from './config';
55
import { getColor } from './helpers';
66
import Icon from './Icon';
@@ -12,7 +12,6 @@ export default class Toolbar extends Component {
1212
title: PropTypes.string,
1313
theme: PropTypes.oneOf(THEME_NAME),
1414
primary: PropTypes.oneOf(PRIMARY_COLORS),
15-
style: View.propTypes.style,
1615
leftIconStyle: PropTypes.object,
1716
rightIconStyle: PropTypes.object,
1817
elevation: PropTypes.number,

lib/polyfill/Ripple.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, {Component} from "react";
1+
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import {View, Animated, TouchableOpacity, Platform} from "react-native";
3+
import { View, Animated, TouchableOpacity, Platform } from 'react-native';
44

55
import elevationPolyfill from './Elevation';
66

@@ -26,7 +26,7 @@ export default class Ripple extends Component {
2626
elevation: PropTypes.array,
2727
onPress: PropTypes.func,
2828
onLongPress: PropTypes.func,
29-
style: PropTypes.oneOfType([View.propTypes.style, PropTypes.object, PropTypes.array]),
29+
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
3030
children: PropTypes.element.isRequired
3131
};
3232

@@ -42,25 +42,25 @@ export default class Ripple extends Component {
4242

4343
// Extract padding, margin from style since IOS overflow: hidden has issues with the shadow
4444
if(Platform.OS == 'ios') {
45-
({outerStyle, innerStyle} = (style instanceof Array ? style : [style]).reduce((obj, styles) => {
45+
({ outerStyle, innerStyle } = (style instanceof Array ? style : [style]).reduce((obj, styles) => {
4646
if (styles instanceof Object) {
4747
Object.entries(styles).forEach(
4848
([name, value]) =>
49-
[
50-
'marginLeft',
51-
'marginRight',
52-
'marginTop',
53-
'marginBottom',
54-
'marginHorizontal',
55-
'marginVertical',
56-
'margin',
57-
'borderRadius',
58-
'backgroundColor'
59-
].indexOf(name) !== -1 ? obj.outerStyle[name] = value : obj.innerStyle[name] = value
49+
[
50+
'marginLeft',
51+
'marginRight',
52+
'marginTop',
53+
'marginBottom',
54+
'marginHorizontal',
55+
'marginVertical',
56+
'margin',
57+
'borderRadius',
58+
'backgroundColor'
59+
].indexOf(name) !== -1 ? obj.outerStyle[name] = value : obj.innerStyle[name] = value
6060
)
6161
}
6262
return obj
63-
}, {outerStyle: {}, innerStyle: {}}));
63+
}, { outerStyle: {}, innerStyle: {} }));
6464
}
6565

6666
return (

0 commit comments

Comments
 (0)