Skip to content

Commit

Permalink
feat(propTypes): add prop types
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocesarato committed Jun 6, 2021
1 parent 48cc675 commit 2e852ad
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
59 changes: 59 additions & 0 deletions lib/BigList.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { PureComponent } from "react";
import { Animated, Platform, ScrollView, View } from "react-native";
import PropTypes from "prop-types";

import BigListItem, { BigListItemType } from "./BigListItem";
import BigListProcessor from "./BigListProcessor";
Expand Down Expand Up @@ -467,6 +468,63 @@ class BigList extends PureComponent {
);
}
}

BigList.propTypes = {
actionSheetScrollRef: PropTypes.any,
bottom: PropTypes.number,
contentInset: PropTypes.shape({
bottom: PropTypes.number,
left: PropTypes.number,
right: PropTypes.number,
top: PropTypes.number,
}),
data: PropTypes.array,
footerHeight: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.func,
]),
headerHeight: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.func,
]),
insetBottom: PropTypes.number,
insetTop: PropTypes.number,
itemHeight: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.func,
]),
keyboardDismissMode: PropTypes.string,
keyboardShouldPersistTaps: PropTypes.string,
onLayout: PropTypes.func,
onScroll: PropTypes.func,
onScrollEnd: PropTypes.func,
removeClippedSubviews: PropTypes.bool,
renderAccessory: PropTypes.func,
renderActionSheetScrollViewWrapper: PropTypes.func,
renderEmpty: PropTypes.func,
renderFooter: PropTypes.func,
renderHeader: PropTypes.func,
renderItem: PropTypes.func.isRequired,
renderSection: PropTypes.func,
renderSectionFooter: PropTypes.func,
scrollEventThrottle: PropTypes.number,
scrollTopValue: PropTypes.number,
sectionFooterHeight: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.func,
]),
sectionHeight: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.func,
]),
sections: PropTypes.array,
};

BigList.defaultProps = {
// Data
data: [],
Expand Down Expand Up @@ -494,4 +552,5 @@ BigList.defaultProps = {
insetBottom: 0,
contentInset: { top: 0, right: 0, left: 0, bottom: 0 },
};

export default BigList;
10 changes: 10 additions & 0 deletions lib/BigListItem.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from "prop-types";
import React, { memo } from "react";
import { View } from "react-native";

Expand All @@ -14,4 +15,13 @@ export const BigListItemType = {
const BigListItem = ({ height, children }) => (
<View style={{ height }}>{children}</View>
);

BigListItem.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]),
height: PropTypes.number,
};

export default memo(BigListItem);
13 changes: 13 additions & 0 deletions lib/BigListSection.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from "prop-types";
import React, { memo } from "react";
import { Animated } from "react-native";

Expand Down Expand Up @@ -42,4 +43,16 @@ const BigListSection = ({
];
return <Animated.View style={style}>{fillChildren}</Animated.View>;
};

BigListSection.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]),
height: PropTypes.number,
nextSectionPosition: PropTypes.number,
position: PropTypes.number,
scrollTopValue: PropTypes.instanceOf(Animated.Value),
};

export default memo(BigListSection);

0 comments on commit 2e852ad

Please sign in to comment.