Merge pull request #24333 from umidbekkarimov/react-native-collapsible

[react-native-collapsible/Accordion]: Allow to use complex sections
This commit is contained in:
Mine Starks
2018-03-21 09:17:36 -07:00
committed by GitHub
4 changed files with 28 additions and 2 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ export interface AccordionProps {
/**
* An array of sections passed to the render methods
*/
sections: string[];
sections: any[];
/**
* A function that should return a renderable representing the header
+1
View File
@@ -1,6 +1,7 @@
// Type definitions for react-native-collapsible 0.8
// Project: https://github.com/oblador/react-native-collapsible
// Definitions by: Kyle Roach <https://github.com/iRoachie>
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -36,3 +36,27 @@ class AccordianTest extends React.Component<any, any> {
);
}
}
class AccordionComplexTest extends React.Component<any, any> {
_renderHeader() {
return (
<View />
);
}
_renderContent() {
return (
<View />
);
}
render() {
return (
<Accordion
sections={[{icon: 'foo', title: 'Section 1'}, {icon: 'bar', title: 'Section 2'}, {icon: 'baz', title: 'Section 3'}]}
renderHeader={this._renderHeader}
renderContent={this._renderContent}
/>
);
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
@@ -22,4 +23,4 @@
"Accordion.d.ts",
"react-native-collapsible-tests.tsx"
]
}
}