Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix JSXStyle renders styles too late (#484)
We tried master on zeit.co and it seems that when we have the side effects in `componentDidMount` styles are rendered after the content causing transitions to apply to properties that wouldn't otherwise be animated e.g. `padding` similarly to this https://jsfiddle.net/uwbm165z/ (unfortunately I wasn't able to reproduce with React yet but here is my attempt https://codesandbox.io/s/p7q6n6r35m). In this patch we move the side effect `styleSheetRegistry.add` to `render` making sure that `shouldComponentUpdate` doesn't trigger unnecessary re-renderings. On update we then remove the old styles early enough aka on `getSnapshotBeforeUpdate`. @bvaughn this is a "followup" of the conversation we had in #457 (comment) Does it make sense?
- Loading branch information