Skip to content

Commit

Permalink
[Fabric] Create a custom component spec file
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Feb 28, 2022
1 parent 5408f18 commit 32885f5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions js/NativeAnswerViewer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @format
* @flow strict-local
*/

import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
import type {Int32} from 'react-native/Libraries/Types/CodegenTypes';
import * as React from 'react';

type NativeProps = $ReadOnly<{|
...ViewProps,
color?: string,
step?: Int32,
|}>;

export type AnswerViewerViewType = HostComponent<NativeProps>;

interface NativeCommands {
+changeBackgroundColor: (
viewRef: React.ElementRef<AnswerViewerViewType>,
color: string,
) => void;
}

export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['changeBackgroundColor'],
});

export default (codegenNativeComponent<NativeProps>(
'AnswerViewer',
): AnswerViewerViewType);

0 comments on commit 32885f5

Please sign in to comment.