Skip to content

Commit bfd280f

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents ff05c45 + c12b371 commit bfd280f

File tree

5 files changed

+20
-25
lines changed

5 files changed

+20
-25
lines changed

.storybook/base.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
body {
2-
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
2+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
3+
Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
34
padding: 0;
45
margin: 0;
56
color: #0c0c0c;
@@ -8,4 +9,4 @@ body {
89

910
h1 {
1011
font-size: 2rem;
11-
}
12+
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- "7"
3+
- "9"
44
cache: yarn
55
script:
66
- yarn test

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The **`<Observer />`** accepts the following props:
113113
| **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. |
114114
| **triggerOnce** | Bool | false | false | Only trigger this method once |
115115
| **onChange** | Func | | false | Call this function whenever the in view state changes |
116-
| **render** | Func | | false | Render prop boolean indicating inView state |
116+
| **render** | Func | | false | Render prop boolean indicating inView state |
117117
| **innerRef** | Func | | false | Get a reference to the the inner DOM node |
118118

119119
## Example code
@@ -137,16 +137,11 @@ export default Component
137137

138138
### Render prop
139139

140-
141140
```js
142141
import Observer from 'react-intersection-observer'
143142

144143
const Component = () => (
145-
<Observer
146-
render={(inView) => (
147-
inView => <h2>{`Header inside viewport ${inView}.`}</h2>
148-
)}
149-
/>
144+
<Observer render={inView => <h2>{`Header inside viewport ${inView}.`}</h2>} />
150145
)
151146

152147
export default Component

index.d.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,59 @@
11
declare module 'react-intersection-observer' {
2-
import React = require('react');
2+
import React = require('react')
33

44
export interface IntersectionObserverProps {
55
/** Children should be either a function or a node */
6-
children?: React.ReactNode | ((inView: boolean) => React.ReactNode);
6+
children?: React.ReactNode | ((inView: boolean) => React.ReactNode)
77

88
/** Render prop boolean indicating inView state */
9-
render?(inView: boolean): React.ReactNode;
10-
9+
render?: (inView: boolean) => React.ReactNode
1110

1211
/**
1312
* The `HTMLElement` that is used as the viewport for checking visibility of
1413
* the target.
1514
* Defaults to the browser viewport if not specified or if `null`.
1615
*/
17-
root?: HTMLElement | null;
16+
root?: HTMLElement | null
1817

1918
/**
2019
* Unique identifier for the root element - This is used to identify the
2120
* `IntersectionObserver` instance, so it can be reused.
2221
* If you defined a root element, without adding an `id`, it will create a new
2322
* instance for all components.
2423
*/
25-
rootId?: string;
24+
rootId?: string
2625

2726
/**
2827
* Margin around the root.
2928
* Can have values similar to the CSS margin property,
3029
* e.g. `"10px 20px 30px 40px"` (top, right, bottom, left).
3130
*/
32-
rootMargin?: string;
31+
rootMargin?: string
3332

3433
/**
3534
* Element tag to use for the wrapping component
3635
* @default `'div'`
3736
*/
38-
tag?: string;
37+
tag?: string
3938

4039
/** Number between 0 and 1 indicating the the percentage that should be
4140
* visible before triggering. Can also be an array of numbers, to create
4241
* multiple trigger points.
4342
* @default `0`
4443
*/
45-
threshold?: number | number[];
44+
threshold?: number | number[]
4645

4746
/**
4847
* Only trigger this method once
4948
* @default `false`
5049
*/
51-
triggerOnce?: boolean;
50+
triggerOnce?: boolean
5251

5352
/** Call this function whenever the in view state changes */
54-
onChange?(inView: boolean|React.FormEvent<HTMLElement>): void;
53+
onChange?: (inView: boolean) => void
5554

5655
/** Get a reference to the the inner DOM node */
57-
innerRef?(element?: HTMLElement): void;
56+
innerRef?: (element?: HTMLElement) => void
5857
}
5958

6059
export default class IntersectionObserver extends React.Component<

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@
7878
"enzyme-to-json": "^3.3.1",
7979
"eslint": "^4.17.0",
8080
"eslint-config-insilico": "^5.1.0",
81-
"flow-bin": "^0.64.0",
81+
"flow-bin": "^0.71.0",
8282
"flow-copy-source": "^1.2.2",
8383
"husky": "^0.14.3",
8484
"intersection-observer": "^0.5.0",
8585
"jest": "^22.1.4",
86-
"lint-staged": "^6.1.0",
86+
"lint-staged": "^7.0.0",
8787
"prettier": "^1.10.2",
8888
"react": "^16.2.0",
8989
"react-dom": "^16.2.0",
9090
"react-test-renderer": "^16.2.0",
91-
"request": "~2.83.0"
91+
"request": "~2.84.0"
9292
},
9393
"resolutions": {
9494
"react": "^16.2.0",

0 commit comments

Comments
 (0)