File tree Expand file tree Collapse file tree 5 files changed +33
-31
lines changed Expand file tree Collapse file tree 5 files changed +33
-31
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as React from 'react';
2
2
const raf = require ( 'raf' ) ;
3
3
4
4
import { shallowEqualRect } from './utils' ;
5
+ import { IRect } from './types' ;
5
6
6
7
interface IProps {
7
8
/**
@@ -29,15 +30,6 @@ interface IProps {
29
30
onUpdate ?: ( rect : IRect ) => void ;
30
31
}
31
32
32
- export interface IRect {
33
- top : number ;
34
- right : number ;
35
- bottom : number ;
36
- left : number ;
37
- height : number ;
38
- width : number ;
39
- }
40
-
41
33
interface IState extends IRect {
42
34
isInitialized : boolean ;
43
35
}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const memoize =
5
5
const raf = require ( 'raf' ) ;
6
6
7
7
import { shallowEqualScroll , shallowEqualDimensions } from './utils' ;
8
+ import { IScroll , IDimensions } from './types' ;
8
9
9
10
import {
10
11
Consumer ,
@@ -15,24 +16,10 @@ import {
15
16
SCROLL_DIR_DOWN ,
16
17
SCROLL_DIR_RIGHT ,
17
18
SCROLL_DIR_LEFT ,
18
- IDimensions ,
19
19
} from './ViewportProvider' ;
20
20
21
21
interface IState extends IContextScroll , IDimensions { }
22
22
23
- export interface IScroll {
24
- x : number ;
25
- y : number ;
26
- xTurn : number ;
27
- yTurn : number ;
28
- xDTurn : number ;
29
- yDTurn : number ;
30
- isScrollingUp : boolean ;
31
- isScrollingDown : boolean ;
32
- isScrollingLeft : boolean ;
33
- isScrollingRight : boolean ;
34
- }
35
-
36
23
export interface IChildProps {
37
24
scroll : IScroll | null ;
38
25
dimensions : IDimensions | null ;
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import * as React from 'react';
2
2
const throttle = require ( 'lodash.throttle' ) ;
3
3
const debounce = require ( 'lodash.debounce' ) ;
4
4
5
+ import { IDimensions } from './types' ;
6
+
5
7
export const SCROLL_DIR_DOWN = Symbol ( 'SCROLL_DIR_DOWN' ) ;
6
8
export const SCROLL_DIR_UP = Symbol ( 'SCROLL_DIR_UP' ) ;
7
9
export const SCROLL_DIR_LEFT = Symbol ( 'SCROLL_DIR_LEFT' ) ;
@@ -18,11 +20,6 @@ export interface IScroll {
18
20
yDTurn : number ;
19
21
}
20
22
21
- export interface IDimensions {
22
- width : number ;
23
- height : number ;
24
- }
25
-
26
23
const ViewportContext = React . createContext ( {
27
24
scroll : { } ,
28
25
dimensions : { } ,
Original file line number Diff line number Diff line change 1
- export { default as ViewportProvider , IDimensions } from './ViewportProvider' ;
1
+ export { default as ViewportProvider } from './ViewportProvider' ;
2
2
export {
3
3
/**
4
4
* @deprecated use connectViewport instead
8
8
} from './ConnectViewport' ;
9
9
export {
10
10
default as ObserveBoundingClientRect ,
11
- IRect ,
12
11
} from './ObserveBoundingClientRect' ;
13
- export { default as ObserveViewport , IScroll } from './ObserveViewport' ;
12
+ export { default as ObserveViewport } from './ObserveViewport' ;
13
+ export { IRect , IScroll , IDimensions } from './types' ;
Original file line number Diff line number Diff line change
1
+ export interface IDimensions {
2
+ width : number ;
3
+ height : number ;
4
+ }
5
+
6
+ export interface IScroll {
7
+ x : number ;
8
+ y : number ;
9
+ xTurn : number ;
10
+ yTurn : number ;
11
+ xDTurn : number ;
12
+ yDTurn : number ;
13
+ isScrollingUp : boolean ;
14
+ isScrollingDown : boolean ;
15
+ isScrollingLeft : boolean ;
16
+ isScrollingRight : boolean ;
17
+ }
18
+
19
+ export interface IRect {
20
+ top : number ;
21
+ right : number ;
22
+ bottom : number ;
23
+ left : number ;
24
+ height : number ;
25
+ width : number ;
26
+ }
You can’t perform that action at this time.
0 commit comments