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

Commit

Permalink
IntersectionObserver support
Browse files Browse the repository at this point in the history
  • Loading branch information
rnosov committed Mar 5, 2018
1 parent 7762294 commit 6d73653
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 164 deletions.
35 changes: 8 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,6 @@ or if you want to customize `div` props:
</Zoom>
```

If you don't want any tag at all then another option is to [expose DOM ref](https://reactjs.org/docs/refs-and-the-dom.html#exposing-dom-refs-to-parent-components) to `react-reveal`. You do that by using `refProp` prop. Consider following custom React Component:

```jsx
function CustomComponent({ innerRef, className, style }) {
return (<div ref={innerRef} className={className} style={style}>Some content</div>);
}
```

And then you can reveal using following code:

```jsx
<Zoom refProp="innerRef">
<CustomComponent />
</Zoom>
```

In this case, `react-reveal` will not insert any tags and will use the exposed HTML element. Some React components such as React Router links already expose their refs via `innerRef` prop:

```jsx
<Zoom refProp="innerRef">
<Link to="/">Your Content</Link>
</Zoom>
```

## Revealing Images

If you want to reveal an image you can wrap `img` tag with with the desired `react-reveal` effect:
Expand Down Expand Up @@ -153,15 +129,20 @@ 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 it's something you
don't really want then you can place the following code somewhere near the entry point of your app to disable this fadeout effect on initial loading:
`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. To prevent this `react-reveal` will not apply reveal effects on the initial load.
Another option is to apply gentle fadeout effect on the initial render. You can force it on all `react-reveal` elements by placing the following code somewhere near the entry point of your app:

```jsx
import config from 'react-reveal/globals';

config({ ssrFadeout: false });
config({ ssrFadeout: true });
```

Or you you can do it on a per element basis using `ssrFadeout` prop:

```jsx
<Zoom ssrFadeout><h1>Content</h1></Zoom>
```

## 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.11",
"version": "1.2.0-beta.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
Loading

0 comments on commit 6d73653

Please sign in to comment.