-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathindex.ts
49 lines (48 loc) · 1.17 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
45
46
47
48
49
import { Fiber } from "react-reconciler";
import { registerComponent, ComponentConfig } from "../config";
import { RNText, TextProps } from "./RNText";
import { AppContainer } from "../../reconciler";
class TextConfig extends ComponentConfig {
tagName = RNText.tagName;
shouldSetTextContent(nextProps: TextProps): boolean {
return true;
}
createInstance(
newProps: TextProps,
rootInstance: AppContainer,
context: any,
workInProgress: Fiber
): RNText {
const widget = new RNText();
widget.setProps(newProps, {});
return widget;
}
commitMount(
instance: RNText,
newProps: TextProps,
internalInstanceHandle: any
): void {
if (newProps.visible !== false) {
instance.show();
}
return;
}
finalizeInitialChildren(
instance: RNText,
newProps: TextProps,
rootContainerInstance: AppContainer,
context: any
): boolean {
return true;
}
commitUpdate(
instance: RNText,
updatePayload: any,
oldProps: TextProps,
newProps: TextProps,
finishedWork: Fiber
): void {
instance.setProps(newProps, oldProps);
}
}
export const Text = registerComponent<TextProps>(new TextConfig());