Skip to content

Commit 538ff00

Browse files
bviebahnBenedikt Viebahn
and
Benedikt Viebahn
authored
fix: remove usage of PropTypes (mmazzarolo#139)
* chore: remove usage of PropTypes Co-authored-by: Benedikt Viebahn <[email protected]>
1 parent 0df53e3 commit 538ff00

11 files changed

+9
-82
lines changed

.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
},
2727
"rules": {
2828
"@typescript-eslint/explicit-module-boundary-types": 0,
29-
"@typescript-eslint/no-explicit-any": 0
29+
"@typescript-eslint/no-explicit-any": 0,
30+
"react/prop-types": 0
3031
}
3132
}

package-lock.json

+7-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"devDependencies": {
3737
"@semantic-release/changelog": "^5.0.1",
3838
"@semantic-release/git": "^9.0.0",
39-
"@types/prop-types": "^15.7.3",
4039
"@types/react": "^17.0.3",
4140
"@types/react-native": "^0.64.2",
4241
"@typescript-eslint/eslint-plugin": "^4.22.0",
@@ -49,7 +48,6 @@
4948
"husky": "^4.2.5",
5049
"lint-staged": "^10.2.11",
5150
"prettier": "^2.0.5",
52-
"prop-types": "^15.7.2",
5351
"semantic-release": "^17.1.2",
5452
"typescript": "^4.2.4"
5553
},

src/Button.tsx

-11
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ import {
77
TouchableOpacity,
88
PlatformColor,
99
TextProps,
10-
TextPropTypes,
1110
ColorValue,
1211
} from "react-native";
1312
import useTheme, { StyleBuilder } from "./useTheme";
14-
import PropTypes from "prop-types";
1513

1614
const COLOR = Platform.OS === "ios" ? "#007ff9" : "#169689";
1715

@@ -52,15 +50,6 @@ const DialogButton: React.FC<DialogButtonProps> = (props) => {
5250
);
5351
};
5452

55-
DialogButton.propTypes = {
56-
...TextPropTypes,
57-
label: PropTypes.string.isRequired,
58-
color: PropTypes.string,
59-
bold: PropTypes.bool,
60-
disabled: PropTypes.bool,
61-
onPress: PropTypes.func.isRequired,
62-
};
63-
6453
DialogButton.displayName = "DialogButton";
6554

6655
const buildStyles: StyleBuilder = (isDark) =>

src/CodeInput.tsx

-14
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import {
99
PlatformColor,
1010
TextInputProps,
1111
ViewStyle,
12-
ViewPropTypes,
1312
StyleProp,
1413
TextStyle,
1514
} from "react-native";
1615
import useTheme from "./useTheme";
17-
import PropTypes from "prop-types";
1816

1917
export interface DialogCodeInputProps extends TextInputProps {
2018
wrapperStyle?: StyleProp<ViewStyle>;
@@ -104,18 +102,6 @@ const DialogCodeInput: React.FC<DialogCodeInputProps> = (props) => {
104102
</View>
105103
);
106104
};
107-
108-
DialogCodeInput.propTypes = {
109-
...ViewPropTypes,
110-
wrapperStyle: ViewPropTypes.style,
111-
digitContainerStyle: ViewPropTypes.style,
112-
digitContainerFocusedStyle: ViewPropTypes.style,
113-
digitStyle: ViewPropTypes.style,
114-
codeLength: PropTypes.number,
115-
onCodeChange: PropTypes.func,
116-
style: (Text as any).propTypes.style,
117-
};
118-
119105
DialogCodeInput.displayName = "DialogCodeInput";
120106

121107
const buildStyles = (isDark: boolean) =>

src/Container.tsx

-17
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ import {
88
PlatformColor,
99
ViewStyle,
1010
StyleProp,
11-
ViewPropTypes,
1211
} from "react-native";
1312
import Modal from "./Modal";
1413
import useTheme, { StyleBuilder } from "./useTheme";
15-
import PropTypes from "prop-types";
1614
import DialogTitle, { DialogTitleProps } from "./Title";
1715
import DialogDescription, { DialogDescriptionProps } from "./Description";
1816
import DialogButton, { DialogButtonProps } from "./Button";
@@ -136,21 +134,6 @@ const DialogContainer: React.FC<DialogContainerProps> = (props) => {
136134
);
137135
};
138136

139-
DialogContainer.propTypes = {
140-
blurComponentIOS: PropTypes.node,
141-
buttonSeparatorStyle: ViewPropTypes.style,
142-
contentStyle: ViewPropTypes.style,
143-
footerStyle: ViewPropTypes.style,
144-
headerStyle: ViewPropTypes.style,
145-
blurStyle: ViewPropTypes.style,
146-
visible: PropTypes.bool,
147-
verticalButtons: PropTypes.bool,
148-
onBackdropPress: PropTypes.func,
149-
keyboardVerticalOffset: PropTypes.number,
150-
useNativeDriver: PropTypes.bool,
151-
children: PropTypes.node.isRequired,
152-
};
153-
154137
const buildStyles: StyleBuilder = () =>
155138
StyleSheet.create({
156139
centeredView: {

src/Description.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
StyleSheet,
55
Text,
66
PlatformColor,
7-
TextPropTypes,
87
TextProps,
98
} from "react-native";
109
import useTheme, { StyleBuilder } from "./useTheme";
@@ -22,8 +21,6 @@ const DialogDescription: React.FC<DialogDescriptionProps> = (props) => {
2221
);
2322
};
2423

25-
DialogDescription.propTypes = TextPropTypes;
26-
2724
DialogDescription.displayName = "DialogDescription";
2825

2926
const buildStyles: StyleBuilder = (isDark) =>

src/Input.tsx

-12
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ import {
99
PlatformColor,
1010
TextInputProps,
1111
ViewStyle,
12-
ViewPropTypes,
1312
StyleProp,
1413
} from "react-native";
1514
import useTheme, { StyleBuilder } from "./useTheme";
16-
import PropTypes from "prop-types";
1715

1816
export interface DialogInputProps extends TextInputProps {
1917
label?: ReactNode;
@@ -63,16 +61,6 @@ const DialogInput: React.FC<DialogInputProps> = (props) => {
6361
);
6462
};
6563

66-
DialogInput.propTypes = {
67-
...ViewPropTypes,
68-
label: PropTypes.string,
69-
textInputRef: PropTypes.any,
70-
wrapperStyle: ViewPropTypes.style,
71-
numberOfLines: PropTypes.number,
72-
multiline: PropTypes.bool,
73-
style: (Text as any).propTypes.style,
74-
};
75-
7664
DialogInput.displayName = "DialogInput";
7765

7866
const buildStyles: StyleBuilder = (isDark) =>

src/Modal.tsx

-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from "react";
22
import { Component } from "react";
3-
import PropTypes from "prop-types";
43
import {
54
Animated,
65
Easing,
@@ -10,7 +9,6 @@ import {
109
StyleProp,
1110
StyleSheet,
1211
TouchableWithoutFeedback,
13-
ViewPropTypes,
1412
ViewStyle,
1513
} from "react-native";
1614

@@ -73,14 +71,6 @@ interface ModalState {
7371
}
7472

7573
export class Modal extends Component<ModalProps, ModalState> {
76-
static propTypes = {
77-
onBackdropPress: PropTypes.func,
78-
onHide: PropTypes.func,
79-
visible: PropTypes.bool,
80-
contentStyle: ViewPropTypes.style,
81-
useNativeDriver: PropTypes.bool,
82-
};
83-
8474
static defaultProps: Partial<ModalProps> = {
8575
onBackdropPress: () => null,
8676
onHide: () => null,

src/Switch.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ import {
88
View,
99
PlatformColor,
1010
SwitchProps,
11-
ViewPropTypes,
1211
} from "react-native";
1312
import useTheme, { StyleBuilder } from "./useTheme";
14-
import PropTypes from "prop-types";
1513

1614
export interface DialogSwitchProps extends SwitchProps {
1715
label?: ReactNode;
@@ -28,11 +26,6 @@ const DialogSwitch: React.FC<DialogSwitchProps> = (props) => {
2826
);
2927
};
3028

31-
DialogSwitch.propTypes = {
32-
...ViewPropTypes,
33-
label: PropTypes.node,
34-
};
35-
3629
DialogSwitch.displayName = "DialogSwitch";
3730

3831
const buildStyles: StyleBuilder = (isDark) =>

src/Title.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
StyleSheet,
55
Text,
66
PlatformColor,
7-
TextPropTypes,
87
TextProps,
98
} from "react-native";
109
import useTheme, { StyleBuilder } from "./useTheme";
@@ -22,8 +21,6 @@ const DialogTitle: React.FC<DialogTitleProps> = (props) => {
2221
);
2322
};
2423

25-
DialogTitle.propTypes = TextPropTypes;
26-
2724
DialogTitle.displayName = "DialogTitle";
2825

2926
const buildStyles: StyleBuilder = (isDark) =>

0 commit comments

Comments
 (0)