This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
60 lines (54 loc) · 1.49 KB
/
App.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/** @jsx nativeEvents */
import React, { Component, createRef } from 'react';
import nativeEvents from 'jsx-native-events';
import { observe, unobserve } from './lib';
export default class App extends Component {
constructor(props) {
super(props);
this.ref = createRef();
}
componentDidMount() {
observe(this.ref.current);
}
componentWillUnmount() {
unobserve(this.ref.current);
}
handleAppear(e) {
console.log('appear', e);
}
handleDisappear(e) {
console.log('disappear', e);
}
render() {
return (
<div>
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div
className="item"
onEventAppear={this.handleAppear}
onEventDisappear={this.handleDisappear}
ref={this.ref}
>
appear and disappear
</div>
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
<div className="placeholder" />
</div>
);
}
}