Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,19 @@ class RNIntersectionObserver {
return
}
let targetRef = null
if (this.observeAll) {
targetRef = this.component.__selectRef(selector, 'node', true)
} else {
targetRef = this.component.__selectRef(selector, 'node')
// 支持传递 ref 对象或数组
if (isArray(selector)) {
const refs = [].concat(...selector.map(item => (item && item.nodeRefs) || []))
targetRef = this.observeAll ? refs : refs[0]
} else if (isObject(selector)) {
const refs = selector.nodeRefs || []
targetRef = this.observeAll ? refs : refs[0]
} else if (isString(selector)) {
if (this.observeAll) {
targetRef = this.component.__selectRef(selector, 'node', true)
} else {
targetRef = this.component.__selectRef(selector, 'node')
}
}
if (!targetRef || targetRef.length === 0) {
warn('intersection observer target not found', this.mpxFileResource)
Expand Down
Loading