-
Notifications
You must be signed in to change notification settings - Fork 24k
/
index-test.js.snap
165 lines (157 loc) · 6.08 KB
/
index-test.js.snap
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Babel plugin inline view configs can inline config for FullNativeComponent.js 1`] = `
"// @flow
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type { Int32, BubblingEventHandler, DirectEventHandler, WithDefault } from 'CodegenFlowtypes';
import type { NativeComponentType } from 'codegenNativeComponent';
import type { ViewProps } from 'ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// Props
boolean_default_true_optional_both?: WithDefault<boolean, true>,
// Events
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|}>;
type NativeType = NativeComponentType<ModuleProps>;
interface NativeCommands {
+hotspotUpdate: (viewRef: React.ElementRef<NativeType>, x: Int32, y: Int32) => void,
+scrollTo: (viewRef: React.ElementRef<NativeType>, y: Int32, animated: boolean) => void,
}
const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');
const {
ConditionallyIgnoredEventHandlers
} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');
const {
dispatchCommand
} = require(\\"react-native/Libraries/ReactNative/RendererProxy\\");
let nativeComponentName = 'RCTModule';
export const __INTERNAL_VIEW_CONFIG = {
uiViewClassName: 'RCTModule',
bubblingEventTypes: {
topBubblingEventDefinedInlineNull: {
phasedRegistrationNames: {
captured: 'onBubblingEventDefinedInlineNullCapture',
bubbled: 'onBubblingEventDefinedInlineNull'
}
}
},
directEventTypes: {
topDirectEventDefinedInlineNull: {
registrationName: 'onDirectEventDefinedInlineNull'
}
},
validAttributes: {
boolean_default_true_optional_both: true,
...ConditionallyIgnoredEventHandlers({
onDirectEventDefinedInlineNull: true,
onBubblingEventDefinedInlineNull: true
})
}
};
export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);
export const Commands = {
hotspotUpdate(ref, x, y) {
dispatchCommand(ref, \\"hotspotUpdate\\", [x, y]);
},
scrollTo(ref, y, animated) {
dispatchCommand(ref, \\"scrollTo\\", [y, animated]);
}
};"
`;
exports[`Babel plugin inline view configs can inline config for FullTypedNativeComponent.js 1`] = `
"// @flow
const codegenNativeCommands = require('codegenNativeCommands');
const codegenNativeComponent = require('codegenNativeComponent');
import type { NativeComponentType } from 'codegenNativeComponent';
import type { Int32, BubblingEventHandler, DirectEventHandler, WithDefault } from 'CodegenFlowtypes';
import type { ViewProps } from 'ViewPropTypes';
type ModuleProps = $ReadOnly<{|
...ViewProps,
// Props
boolean_default_true_optional_both?: WithDefault<boolean, true>,
// Events
onDirectEventDefinedInlineNull: DirectEventHandler<null>,
onBubblingEventDefinedInlineNull: BubblingEventHandler<null>,
|}>;
type NativeType = NativeComponentType<ModuleProps>;
interface NativeCommands {
+hotspotUpdate: (viewRef: React.ElementRef<NativeType>, x: Int32, y: Int32) => void,
+scrollTo: (viewRef: React.ElementRef<NativeType>, y: Int32, animated: boolean) => void,
}
const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');
const {
ConditionallyIgnoredEventHandlers
} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');
const {
dispatchCommand
} = require(\\"react-native/Libraries/ReactNative/RendererProxy\\");
let nativeComponentName = 'RCTModule';
export const __INTERNAL_VIEW_CONFIG = {
uiViewClassName: 'RCTModule',
bubblingEventTypes: {
topBubblingEventDefinedInlineNull: {
phasedRegistrationNames: {
captured: 'onBubblingEventDefinedInlineNullCapture',
bubbled: 'onBubblingEventDefinedInlineNull'
}
}
},
directEventTypes: {
topDirectEventDefinedInlineNull: {
registrationName: 'onDirectEventDefinedInlineNull'
}
},
validAttributes: {
boolean_default_true_optional_both: true,
...ConditionallyIgnoredEventHandlers({
onDirectEventDefinedInlineNull: true,
onBubblingEventDefinedInlineNull: true
})
}
};
export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);
export const Commands = {
hotspotUpdate(ref, x, y) {
dispatchCommand(ref, \\"hotspotUpdate\\", [x, y]);
},
scrollTo(ref, y, animated) {
dispatchCommand(ref, \\"scrollTo\\", [y, animated]);
}
};"
`;
exports[`Babel plugin inline view configs can inline config for NotANativeComponent.js 1`] = `
"const requireNativeComponent = require('requireNativeComponent');
export default 'Not a view config';"
`;
exports[`Babel plugin inline view configs fails on inline config for CommandsExportedWithDifferentNameNativeComponent.js 1`] = `
"/CommandsExportedWithDifferentNameNativeComponent.js: Native commands must be exported with the name 'Commands'
17 | }
18 |
> 19 | export const Foo = codegenNativeCommands<NativeCommands>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20 |
21 | export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
22 |"
`;
exports[`Babel plugin inline view configs fails on inline config for CommandsExportedWithShorthandNativeComponent.js 1`] = `
"/CommandsExportedWithShorthandNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.
19 | const Commands = 4;
20 |
> 21 | export {Commands};
| ^^^^^^^^^^^^^^^^^^
22 |
23 | export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
24 |"
`;
exports[`Babel plugin inline view configs fails on inline config for OtherCommandsExportNativeComponent.js 1`] = `
"/OtherCommandsExportNativeComponent.js: 'Commands' is a reserved export and may only be used to export the result of codegenNativeCommands.
17 | }
18 |
> 19 | export const Commands = 4;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
20 |
21 | export default (codegenNativeComponent<ModuleProps>('Module'): NativeType);
22 |"
`;