Skip to content

Commit

Permalink
feat: Add Metro.container
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasdelfino committed Oct 1, 2017
1 parent 3526fdd commit b38896b
Show file tree
Hide file tree
Showing 4 changed files with 1,387 additions and 3 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Import
```javascript
import Metro from 'react-metro'
```
#### Metro.sequence - animate multiple objects:

Create a sequence, map it:
```javascript
// in method renderMetroComponents:
Expand Down Expand Up @@ -64,6 +66,28 @@ defaultAnimation // optional
{ this.renderMetroComponents() }
</TransitionGroupPlus>
```
#### Metro.container - single node enhancer:
```javascript
renderMetroContainer() {
if (!this.state.showContainer) {
return null;
}

const props = {
wrapperType: "div",
enableClickDuringAnimation: true,
onMount: this.wrapMount.bind(this),
onUnmount: this.wrapUnmount.bind(this)
};

return Metro.container(
<div>...</div>, // base node: pass in text, wrap components
containerAnimation, // optional
props //optional
);
}
```

#### Customizing animations
```javascript
// override Metro´s default animations settings for each unique item in your items
Expand Down Expand Up @@ -125,6 +149,7 @@ const defaultAnimationOverride = {
```javascript
wrapperType // dom element, defaults to div
onClick // receives props (original array data), array index and animating
enableClickDuringAnimation // boolean, defaults to false
onMount // fires when the mount sequence completes
onUnmount // fires when the unmount sequence completes
```
Expand Down Expand Up @@ -159,6 +184,7 @@ PRs are welcomed, to contribute make sure that:
* Branch name references issue number if it adresses a feature / bug fix.
* Branch has already been [synced with the upstream repo](https://help.github.com/articles/syncing-a-fork/) and any merge-conflicts have been resolved.
* Install eslint and prettier to avoid lint issues while developing
* Use <a href="https://github.com/semantic-release/semantic-release">semantic release guidelines</a> when commiting

##### Contributors
<img src="https://avatars3.githubusercontent.com/u/26581738?v=4&s=400" width="70px;"/><br /><a href="https://github.com/emilpalsson"><sub>Emil Pålsson</sub></a>
Expand Down
2 changes: 1 addition & 1 deletion dist/react-metro.js

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

0 comments on commit b38896b

Please sign in to comment.