Skip to content

Commit 1d35c25

Browse files
committed
Fix storybook, and update docs
1 parent 2076a48 commit 1d35c25

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ The **`<Observer />`** accepts the following props:
5858
| **root** | HTMLElement | | false | The HTMLElement that is used as the viewport for checking visibility of the target. Defaults to the browser viewport if not specified or if null. |
5959
| **rootId** | String | | false | Unique identifier for the root element - This is used to identify the IntersectionObserver instance, so it can be reused. If you defined a root element, without adding an id, it will create a new instance for all components. |
6060
| **rootMargin** | String | '0px' | false | Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). |
61-
| **tag** | String | 'div' | false | Element tag to use for the wrapping component |
61+
| **tag** | String | 'div' | false | Element tag to use for the wrapping element when rendering using 'children'. Defaults to 'div' |
6262
| **threshold** | Number | 0 | false | Number between 0 and 1 indicating the the percentage that should be visible before triggering. Can also be an array of numbers, to create multiple trigger points. |
6363
| **triggerOnce** | Bool | false | false | Only trigger this method once |
6464
| **onChange** | Func | | false | Call this function whenever the in view state changes |
6565

66-
## Examples
66+
## Usage
6767

6868
### Child as function
6969

70-
The default way to use the `Observer`, is to pass a function as the child. It
70+
The easiest way to use the `Observer`, is to pass a function as the child. It
7171
will be called whenever the state changes, with the new value of `inView`.
7272
By default it will render inside a `<div>`, but you can change the element by setting `tag` to the HTMLElement you need.
7373

@@ -107,7 +107,7 @@ export default Component
107107
### OnChange callback
108108

109109
You can monitor the onChange method, and control the state in your own
110-
component. The child node will always be rendered.
110+
component.
111111

112112
```js
113113
import Observer from 'react-intersection-observer'

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,5 @@
9191
"react-dom": "^16.3.2",
9292
"react-test-renderer": "^16.3.2",
9393
"request": "~2.85.0"
94-
},
95-
"resolutions": {
96-
"react": "^16.2.0",
97-
"react-dom": "^16.2.0"
9894
}
9995
}

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { observe, unobserve } from './intersection'
44
import invariant from 'invariant'
55

66
type Props = {
7-
/** Element tag to use for the wrapping */
7+
/** Element tag to use for the wrapping element when rendering using 'children'. Defaults to 'div' */
88
tag: string,
99
/** Only trigger the inView callback once */
1010
triggerOnce: boolean,

stories/Observer.story.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ storiesOf('Intersection Observer', module)
4444
<Observer
4545
onChange={action('Render Observer inview')}
4646
render={({ inView, ref }) => (
47-
<Header>Header is inside viewport: {inView.toString()}</Header>
47+
<Header innerRef={ref}>
48+
Header is inside viewport: {inView.toString()}
49+
</Header>
4850
)}
4951
/>
5052
</ScrollWrapper>

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6790,7 +6790,7 @@ react-docgen@^3.0.0-beta11:
67906790
node-dir "^0.1.10"
67916791
recast "^0.12.6"
67926792

6793-
react-dom@^16.2.0, react-dom@^16.3.2:
6793+
react-dom@^16.3.2:
67946794
version "16.3.2"
67956795
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.3.2.tgz#cb90f107e09536d683d84ed5d4888e9640e0e4df"
67966796
dependencies:
@@ -6903,7 +6903,7 @@ react-treebeard@^2.1.0:
69036903
shallowequal "^0.2.2"
69046904
velocity-react "^1.3.1"
69056905

6906-
react@^16.2.0, react@^16.3.2:
6906+
react@^16.3.2:
69076907
version "16.3.2"
69086908
resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9"
69096909
dependencies:

0 commit comments

Comments
 (0)