Skip to content

Commit 32885f5

Browse files
committed
[Fabric] Create a custom component spec file
1 parent 5408f18 commit 32885f5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

‎js/NativeAnswerViewer.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* @format
3+
* @flow strict-local
4+
*/
5+
6+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
8+
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
9+
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
10+
import type {Int32} from 'react-native/Libraries/Types/CodegenTypes';
11+
import * as React from 'react';
12+
13+
type NativeProps = $ReadOnly<{|
14+
...ViewProps,
15+
color?: string,
16+
step?: Int32,
17+
|}>;
18+
19+
export type AnswerViewerViewType = HostComponent<NativeProps>;
20+
21+
interface NativeCommands {
22+
+changeBackgroundColor: (
23+
viewRef: React.ElementRef<AnswerViewerViewType>,
24+
color: string,
25+
) => void;
26+
}
27+
28+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
29+
supportedCommands: ['changeBackgroundColor'],
30+
});
31+
32+
export default (codegenNativeComponent<NativeProps>(
33+
'AnswerViewer',
34+
): AnswerViewerViewType);

0 commit comments

Comments
 (0)