Skip to content
This repository has been archived by the owner on Mar 26, 2023. It is now read-only.

Commit

Permalink
cascade text node fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rnosov committed Feb 16, 2018
1 parent 1382b81 commit 4bb2d71
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React Reveal

[React Reveal](https://www.npmjs.com/package/react-reveal) is an attention management framework for your React app. The traditional way of calling attention to a certain element has been in-your-face method of placing it in a popup or putting it in a sticky navigation element like sticky headers, footers or sidebars. As the number of these elements proliferate, the app is at danger of starting to resemble a control panel from a jumbo jet cockpit. There should be a better way of managing a user attention and `react-reveal` can do just that.
[React Reveal](https://www.react-reveal.com/) is an attention management framework for your React app. The traditional way of calling attention to a certain element has been in-your-face method of placing it in a popup or putting it in a sticky navigation element like sticky headers, footers or sidebars. As the number of these elements proliferate, the app is at danger of starting to resemble a control panel from a jumbo jet cockpit. There should be a better way of managing a user attention and `react-reveal` can do just that.

Instead of trying to squeeze everything that requires attention into one screen, you can draw user attention to important bits as they scroll past. `react-reveal` provides a dead simple way to add cool reveal-on-scroll animations to your React app. In addition, it has a first class support for collapsing elements thereby abolishing the need for the universally hated popups.

Expand Down Expand Up @@ -159,13 +159,7 @@ If you don't want this to happen, you should wrap multiple children in a `div` t

## Server Side Rendering

`react-reveal` supports server side rendering out of the box. In some cases, when the javascript bundle arrives much later than the HTML&CSS it might cause a flickering. `react-reveal` will try to autodetect this and apply gentle fadeout effect on the initial render to mitigate flickering. If you want you can disable the fadeout effect like so ( place this code somewhere near the entry point of your app):

```jsx
import {ssrFadeout} from 'react-reveal/globals';

ssrFadeout(false);
```
`react-reveal` supports server side rendering out of the box. In some cases, when the javascript bundle arrives much later than the HTML&CSS it might cause a flickering. `react-reveal` will try to autodetect this and apply gentle fadeout effect on the initial render to mitigate flickering.

## Search Engine Optimisation

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-reveal",
"version": "1.1.1",
"version": "1.1.2",
"author": "Roman Nosov <rnosov@gmail.com>",
"description": "Really simple way to add reveal on scroll animation to your React app.",
"license": "MIT",
Expand Down
19 changes: 11 additions & 8 deletions src/RevealBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,16 @@ class RevealBase extends React.Component {
//let i = reverse ? count : 0;
let i = 0;
newChildren = newChildren.map( child =>
React.cloneElement(child,{
style: {
...child.props.style,
...(this.props.collapse?{...this.state.style, boxSizing: void 0, height: void 0, border: void 0, padding: void 0, transition: void 0}:this.state.style),
animationDuration: Math.round(cascade( /*reverse ? i-- : i++ */i++,0 , count, duration, total)) + 'ms',
},
//ref: i === count? (el => this.finalEl = el) : void 0,
}));
typeof child === 'object' && 'type' in child && typeof child.type === 'string'
? React.cloneElement(child,{
style: {
...child.props.style,
...(this.props.collapse?{...this.state.style, boxSizing: void 0, height: void 0, border: void 0, padding: void 0, transition: void 0}:this.state.style),
animationDuration: Math.round(cascade( /*reverse ? i-- : i++ */i++,0 , count, duration, total)) + 'ms',
},
//ref: i === count? (el => this.finalEl = el) : void 0,
})
: child );
return newChildren;
}

Expand Down Expand Up @@ -454,5 +456,6 @@ class RevealBase extends React.Component {
RevealBase.propTypes = propTypes;
RevealBase.defaultProps = defaultProps;
RevealBase.contextTypes = contextTypes;
RevealBase.displayName = 'RevealBase';
//RevealBase.childContextTypes = childContextTypes;
export default RevealBase;

0 comments on commit 4bb2d71

Please sign in to comment.