Skip to content

Commit

Permalink
fix: remove usage of PropTypes (#139)
Browse files Browse the repository at this point in the history
* chore: remove usage of PropTypes

Co-authored-by: Benedikt Viebahn <[email protected]>
  • Loading branch information
bviebahn and Benedikt Viebahn authored Jun 9, 2022
1 parent 0df53e3 commit 538ff00
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 82 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"rules": {
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-explicit-any": 0
"@typescript-eslint/no-explicit-any": 0,
"react/prop-types": 0
}
}
9 changes: 7 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@types/prop-types": "^15.7.3",
"@types/react": "^17.0.3",
"@types/react-native": "^0.64.2",
"@typescript-eslint/eslint-plugin": "^4.22.0",
Expand All @@ -49,7 +48,6 @@
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5",
"prop-types": "^15.7.2",
"semantic-release": "^17.1.2",
"typescript": "^4.2.4"
},
Expand Down
11 changes: 0 additions & 11 deletions src/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import {
TouchableOpacity,
PlatformColor,
TextProps,
TextPropTypes,
ColorValue,
} from "react-native";
import useTheme, { StyleBuilder } from "./useTheme";
import PropTypes from "prop-types";

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

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

DialogButton.propTypes = {
...TextPropTypes,
label: PropTypes.string.isRequired,
color: PropTypes.string,
bold: PropTypes.bool,
disabled: PropTypes.bool,
onPress: PropTypes.func.isRequired,
};

DialogButton.displayName = "DialogButton";

const buildStyles: StyleBuilder = (isDark) =>
Expand Down
14 changes: 0 additions & 14 deletions src/CodeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import {
PlatformColor,
TextInputProps,
ViewStyle,
ViewPropTypes,
StyleProp,
TextStyle,
} from "react-native";
import useTheme from "./useTheme";
import PropTypes from "prop-types";

export interface DialogCodeInputProps extends TextInputProps {
wrapperStyle?: StyleProp<ViewStyle>;
Expand Down Expand Up @@ -104,18 +102,6 @@ const DialogCodeInput: React.FC<DialogCodeInputProps> = (props) => {
</View>
);
};

DialogCodeInput.propTypes = {
...ViewPropTypes,
wrapperStyle: ViewPropTypes.style,
digitContainerStyle: ViewPropTypes.style,
digitContainerFocusedStyle: ViewPropTypes.style,
digitStyle: ViewPropTypes.style,
codeLength: PropTypes.number,
onCodeChange: PropTypes.func,
style: (Text as any).propTypes.style,
};

DialogCodeInput.displayName = "DialogCodeInput";

const buildStyles = (isDark: boolean) =>
Expand Down
17 changes: 0 additions & 17 deletions src/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import {
PlatformColor,
ViewStyle,
StyleProp,
ViewPropTypes,
} from "react-native";
import Modal from "./Modal";
import useTheme, { StyleBuilder } from "./useTheme";
import PropTypes from "prop-types";
import DialogTitle, { DialogTitleProps } from "./Title";
import DialogDescription, { DialogDescriptionProps } from "./Description";
import DialogButton, { DialogButtonProps } from "./Button";
Expand Down Expand Up @@ -136,21 +134,6 @@ const DialogContainer: React.FC<DialogContainerProps> = (props) => {
);
};

DialogContainer.propTypes = {
blurComponentIOS: PropTypes.node,
buttonSeparatorStyle: ViewPropTypes.style,
contentStyle: ViewPropTypes.style,
footerStyle: ViewPropTypes.style,
headerStyle: ViewPropTypes.style,
blurStyle: ViewPropTypes.style,
visible: PropTypes.bool,
verticalButtons: PropTypes.bool,
onBackdropPress: PropTypes.func,
keyboardVerticalOffset: PropTypes.number,
useNativeDriver: PropTypes.bool,
children: PropTypes.node.isRequired,
};

const buildStyles: StyleBuilder = () =>
StyleSheet.create({
centeredView: {
Expand Down
3 changes: 0 additions & 3 deletions src/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
StyleSheet,
Text,
PlatformColor,
TextPropTypes,
TextProps,
} from "react-native";
import useTheme, { StyleBuilder } from "./useTheme";
Expand All @@ -22,8 +21,6 @@ const DialogDescription: React.FC<DialogDescriptionProps> = (props) => {
);
};

DialogDescription.propTypes = TextPropTypes;

DialogDescription.displayName = "DialogDescription";

const buildStyles: StyleBuilder = (isDark) =>
Expand Down
12 changes: 0 additions & 12 deletions src/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import {
PlatformColor,
TextInputProps,
ViewStyle,
ViewPropTypes,
StyleProp,
} from "react-native";
import useTheme, { StyleBuilder } from "./useTheme";
import PropTypes from "prop-types";

export interface DialogInputProps extends TextInputProps {
label?: ReactNode;
Expand Down Expand Up @@ -63,16 +61,6 @@ const DialogInput: React.FC<DialogInputProps> = (props) => {
);
};

DialogInput.propTypes = {
...ViewPropTypes,
label: PropTypes.string,
textInputRef: PropTypes.any,
wrapperStyle: ViewPropTypes.style,
numberOfLines: PropTypes.number,
multiline: PropTypes.bool,
style: (Text as any).propTypes.style,
};

DialogInput.displayName = "DialogInput";

const buildStyles: StyleBuilder = (isDark) =>
Expand Down
10 changes: 0 additions & 10 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from "react";
import { Component } from "react";
import PropTypes from "prop-types";
import {
Animated,
Easing,
Expand All @@ -10,7 +9,6 @@ import {
StyleProp,
StyleSheet,
TouchableWithoutFeedback,
ViewPropTypes,
ViewStyle,
} from "react-native";

Expand Down Expand Up @@ -73,14 +71,6 @@ interface ModalState {
}

export class Modal extends Component<ModalProps, ModalState> {
static propTypes = {
onBackdropPress: PropTypes.func,
onHide: PropTypes.func,
visible: PropTypes.bool,
contentStyle: ViewPropTypes.style,
useNativeDriver: PropTypes.bool,
};

static defaultProps: Partial<ModalProps> = {
onBackdropPress: () => null,
onHide: () => null,
Expand Down
7 changes: 0 additions & 7 deletions src/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import {
View,
PlatformColor,
SwitchProps,
ViewPropTypes,
} from "react-native";
import useTheme, { StyleBuilder } from "./useTheme";
import PropTypes from "prop-types";

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

DialogSwitch.propTypes = {
...ViewPropTypes,
label: PropTypes.node,
};

DialogSwitch.displayName = "DialogSwitch";

const buildStyles: StyleBuilder = (isDark) =>
Expand Down
3 changes: 0 additions & 3 deletions src/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
StyleSheet,
Text,
PlatformColor,
TextPropTypes,
TextProps,
} from "react-native";
import useTheme, { StyleBuilder } from "./useTheme";
Expand All @@ -22,8 +21,6 @@ const DialogTitle: React.FC<DialogTitleProps> = (props) => {
);
};

DialogTitle.propTypes = TextPropTypes;

DialogTitle.displayName = "DialogTitle";

const buildStyles: StyleBuilder = (isDark) =>
Expand Down

0 comments on commit 538ff00

Please sign in to comment.