Skip to content

Commit

Permalink
1.3.0 #259
Browse files Browse the repository at this point in the history
  • Loading branch information
iRoachie authored Oct 30, 2018
2 parents 50db0b9 + 4de712f commit a06a3cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
18 changes: 9 additions & 9 deletions Accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@ import * as React from 'react';
import { StyleProp, ViewStyle } from 'react-native';
import { EasingMode } from './index';

export interface AccordionProps {
export interface AccordionProps<T> {
/**
* An array of sections passed to the render methods
*/
sections: any[];
sections: T[];

/**
* A function that should return a renderable representing the header
*/
renderHeader(
content: any,
content: T,
index: number,
isActive: boolean,
sections: any[]
sections: T[]
): React.ReactElement<{}>;

/**
* A function that should return a renderable representing the section title above the touchable
*/
renderSectionTitle?(
content: any,
content: T,
index: number,
isActive: boolean,
sections: any[]
sections: T[]
): React.ReactElement<{}>;

/**
* A function that should return a renderable representing the content
*/
renderContent(
content: any,
content: T,
index: number,
isActive: boolean,
sections: any[]
sections: T[]
): React.ReactElement<{}>;

/**
Expand Down Expand Up @@ -108,4 +108,4 @@ export interface AccordionProps {
sectionContainerStyle?: StyleProp<ViewStyle>;
}

export default class Accordion extends React.Component<AccordionProps> {}
export default class Accordion<T> extends React.Component<AccordionProps<T>> {}
8 changes: 0 additions & 8 deletions Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ export default class Accordion extends Component {
}
}

handleErrors = () => {
if (!Array.isArray(this.props.sections)) {
throw new Error('Sections should be an array');
}
};

render() {
let viewProps = {};
let collapsibleProps = {};
Expand All @@ -75,8 +69,6 @@ export default class Accordion extends Component {
}
});

this.handleErrors();

const {
activeSections,
sectionContainerStyle,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-collapsible",
"version": "1.2.1",
"version": "1.3.0",
"description": "Animated collapsible component for React Native using the Animated API. Good for accordions, toggles etc",
"main": "Collapsible.js",
"types": "index.d.ts",
Expand Down

0 comments on commit a06a3cc

Please sign in to comment.