-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathOnPageScroll.swift
46 lines (38 loc) · 1.16 KB
/
OnPageScroll.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Foundation
import React
public protocol RCTEvent {}
@objc public class RCTOnPageScroll: NSObject, RCTEvent {
private var position: NSNumber
private var offset: NSNumber
@objc public var viewTag: NSNumber
@objc public var coalescingKey: UInt16
@objc public var eventName: String {
return "onPageScroll"
}
@objc public init(reactTag: NSNumber, position: NSNumber, offset: NSNumber, coalescingKey: UInt16) {
self.viewTag = reactTag
self.position = position
self.offset = offset
self.coalescingKey = coalescingKey
super.init()
}
@objc public func canCoalesce() -> Bool {
return true
}
public func coalesce(with newEvent: RCTEvent) -> RCTEvent {
return newEvent
}
@objc public class func moduleDotMethod() -> String {
return "RCTEventEmitter.receiveEvent"
}
@objc public func arguments() -> [Any] {
return [
viewTag,
RCTNormalizeInputEventName(eventName) ?? eventName,
[
"position": position,
"offset": offset
]
]
}
}