szchenghuang / react-transitions

A collection of animated transitions when React components enter or leave the DOM.
MIT License
35 stars 11 forks source link

centering children? #2

Open kraegpoeth opened 7 years ago

kraegpoeth commented 7 years ago

Any way to center animated children? Tried with margin: auto on ReactTransistions and parent element, but it does not work...

MikeDabrowski commented 7 years ago

I found a workaround: Go to node_modules>react-transitions>dist>index.js and remove or comment out line position: 'absolute', under childWrapperStyle.

Edit: removing inline-block helps too. Edit2: previous workaround causes problems that next page does not 'push' previous away. Better solution is to add left:0,top:0 to childWrapperStyle and to _react2.default.createElement(..) (around 90th line)

szchenghuang commented 7 years ago

Would you show some snippets so that I could try to help out? On the demo page there is a text block, a "Hi, there" string, being centered. Giving a look at its source may help.

Feel free to let me know how it works out!