-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathindex.ts
44 lines (42 loc) · 1.11 KB
/
index.ts
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
import { registerComponent, ComponentConfig } from "../config";
import { Fiber } from "react-reconciler";
import { RNScrollArea, ScrollAreaProps } from "./RNScrollArea";
import { AppContainer } from "../../reconciler";
class ScrollAreaConfig extends ComponentConfig {
tagName = RNScrollArea.tagName;
shouldSetTextContent(nextProps: ScrollAreaProps): boolean {
return false;
}
createInstance(
newProps: ScrollAreaProps,
rootInstance: AppContainer,
context: any,
workInProgress: Fiber
): RNScrollArea {
const widget = new RNScrollArea();
widget.setProps(newProps, {});
return widget;
}
commitMount(
instance: RNScrollArea,
newProps: ScrollAreaProps,
internalInstanceHandle: any
): void {
if (newProps.visible !== false) {
instance.show();
}
return;
}
commitUpdate(
instance: RNScrollArea,
updatePayload: any,
oldProps: ScrollAreaProps,
newProps: ScrollAreaProps,
finishedWork: Fiber
): void {
instance.setProps(newProps, oldProps);
}
}
export const ScrollArea = registerComponent<ScrollAreaProps>(
new ScrollAreaConfig()
);