Skip to content

Commit

Permalink
1.5.0 #298
Browse files Browse the repository at this point in the history
  • Loading branch information
iRoachie authored Jul 25, 2019
2 parents dca17b2 + cc46697 commit 29a339b
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 357 deletions.
143 changes: 3 additions & 140 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,144 +1,7 @@
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true,
"es6": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"extends": ["prettier", "prettier/flowtype", "prettier/react"],
"plugins": [
"babel",
"flowtype",
"import",
"react",
"react-native",
"prettier"
],
"extends": "@react-native-community",
"rules": {
"constructor-super": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-new-symbol": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-undef": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unused-labels": "error",
"no-unused-vars": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"babel/new-cap": "off",
"babel/object-curly-spacing": "off",
"babel/arrow-parens": "off",
"flowtype/boolean-style": ["error", "boolean"],
"flowtype/define-flow-type": "error",
"flowtype/no-dupe-keys": "error",
"flowtype/no-primitive-constructor-types": "error",
"flowtype/no-weak-types": "off",
"flowtype/require-parameter-type": "off",
"flowtype/require-return-type": "off",
"flowtype/require-valid-file-annotation": "error",
"flowtype/require-variable-type": "off",
"flowtype/sort-keys": "off",
"flowtype/type-id-match": "off",
"flowtype/use-flow-type": "error",
"flowtype/valid-syntax": "error",
"import/no-unresolved": "error",
"import/named": "error",
"import/default": "off",
"import/namespace": "off",
"import/export": "error",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/no-deprecated": "off",
"import/no-extraneous-dependencies": "off",
"import/no-commonjs": "error",
"import/no-amd": "error",
"import/no-nodejs-modules": "off",
"import/imports-first": "error",
"import/no-duplicates": "error",
"import/no-namespace": "off",
"import/extensions": [
"error",
{
"js": "never",
"json": "always"
}
],
"import/order": "off",
"react/display-name": "off",
"react/forbid-prop-types": "off",
"react/no-danger": "error",
"react/no-deprecated": "error",
"react/no-did-mount-set-state": "error",
"react/no-did-update-set-state": "off",
"react/no-direct-mutation-state": "error",
"react/no-is-mounted": "error",
"react/no-multi-comp": "off",
"react/no-set-state": "off",
"react/no-string-refs": "error",
"react/no-unknown-property": "error",
"react/prefer-es6-class": "error",
"react/prop-types": "error",
"react/react-in-jsx-scope": "error",
"react/require-render-return": "error",
"react/self-closing-comp": "error",
"react/sort-comp": "error",
"react/sort-prop-types": "off",
"react/jsx-boolean-value": ["error", "never"],
"react/jsx-handler-names": "off",
"react/jsx-key": "error",
"react/jsx-no-bind": "off",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-literals": "off",
"react/jsx-no-undef": "error",
"react/jsx-pascal-case": "error",
"react/jsx-sort-props": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react-native/no-unused-styles": "error",
"react-native/split-platform-components": "off",
"prettier/prettier": [
"error",
{
"trailingComma": "es5",
"singleQuote": true
}
]
"react-native/no-inline-styles": 0,
"react/no-did-update-set-state": 0
}
}
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cache:
install:
- yarn
script:
- yarn run test
- yarn run lint
deploy:
provider: npm
email: joel@oblador.se
Expand Down
19 changes: 17 additions & 2 deletions Accordion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ export interface AccordionProps<T> {
sections: T[]
): React.ReactElement<{}>;

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

/**
* A function that should return a renderable representing the section title above the touchable
*/
Expand All @@ -43,6 +53,11 @@ export interface AccordionProps<T> {
*/
onChange(indexes: number[]): void;

/**
* Controls whether user can interact with accordion
*/
disabled?: boolean;

/**
* Expand content from the bottom instead of the top
*
Expand Down Expand Up @@ -102,12 +117,12 @@ export interface AccordionProps<T> {
*/
touchableProps?: {};

/**
/**
* Optional styling for the section container
*/
sectionContainerStyle?: StyleProp<ViewStyle>;

/**
/**
* Optional styling for the Accordion container
*/
containerStyle?: StyleProp<ViewStyle>;
Expand Down
10 changes: 10 additions & 0 deletions Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default class Accordion extends Component {
sections: PropTypes.array.isRequired,
renderHeader: PropTypes.func.isRequired,
renderContent: PropTypes.func.isRequired,
renderFooter: PropTypes.func,
renderSectionTitle: PropTypes.func,
activeSections: PropTypes.arrayOf(PropTypes.number).isRequired,
onChange: PropTypes.func.isRequired,
Expand Down Expand Up @@ -82,6 +83,7 @@ export default class Accordion extends Component {
onAnimationEnd,
renderContent,
renderHeader,
renderFooter,
renderSectionTitle,
} = this.props;

Expand Down Expand Up @@ -117,6 +119,14 @@ export default class Accordion extends Component {
</Touchable>

{!expandFromBottom && renderCollapsible(section, key)}

{renderFooter &&
renderFooter(
section,
key,
activeSections.includes(key),
sections
)}
</View>
))}
</View>
Expand Down
4 changes: 1 addition & 3 deletions Example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ export default class App extends Component {
<Text style={styles.multipleToggle__title}>Multiple Select?</Text>
<Switch
value={multipleSelect}
onValueChange={multipleSelect =>
this.setState({ multipleSelect })
}
onValueChange={a => this.setState({ multipleSelect: a })}
/>
</View>

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import Accordion from 'react-native-collapsible/Accordion';
| **`sections`** | An array of sections passed to the render methods |
| **`renderHeader(content, index, isActive, sections)`** | A function that should return a renderable representing the header |
| **`renderContent(content, index, isActive, sections)`** | A function that should return a renderable representing the content |
| **`renderFooter(content, index, isActive, sections)`** | A function that should return a renderable representing the footer |
| **`renderSectionTitle(content, index, isActive)`** | A function that should return a renderable representing the title of the section outside the touchable element |
| **`onChange(indexes)`** | A function that is called when the currently active section(s) are updated. |
| **`activeSections`** | Control which indices in the `sections` array are currently open. If empty, closes all sections. |
Expand Down
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface CollapsibleProps {

/**
* Enable pointer events on collapsed view
*
*
* @default false
*/
enablePointerEvents?: boolean;
Expand All @@ -81,7 +81,7 @@ export interface CollapsibleProps {
* Optional styling for the container
*/
style?: StyleProp<ViewStyle>;

/**
* Function called when the animation finished
*/
Expand Down
27 changes: 10 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
{
"name": "react-native-collapsible",
"version": "1.4.0",
"version": "1.5.0",
"description": "Animated collapsible component for React Native using the Animated API. Good for accordions, toggles etc",
"main": "Collapsible.js",
"types": "index.d.ts",
"scripts": {
"test": "eslint *.js"
},
"keywords": [
"react-native",
"react-component",
Expand All @@ -31,21 +26,19 @@
"url": "https://github.com/oblador/react-native-collapsible/issues"
},
"homepage": "https://github.com/oblador/react-native-collapsible",
"main": "Collapsible.js",
"types": "index.d.ts",
"scripts": {
"lint": "eslint --ext js,ts ."
},
"devDependencies": {
"babel-eslint": "^8.2.6",
"@react-native-community/eslint-config": "^0.0.5",
"eslint": "^5.2.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-flowtype": "^2.50.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.10.0",
"eslint-plugin-react-native": "^3.2.1",
"husky": "^1.1.0",
"lint-staged": "^7.3.0",
"prettier": "^1.13.7",
"react": "16.4.1",
"react-native": "0.56.0"
"react-native": "0.56.0",
"typescript": "^3.5.3"
},
"dependencies": {
"prop-types": "^15.6.2"
Expand All @@ -60,7 +53,7 @@
}
},
"lint-staged": {
"*.js": [
"*.{js,ts}": [
"eslint --fix",
"git add"
]
Expand Down
Loading

0 comments on commit 29a339b

Please sign in to comment.