mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
2bd503285e
Summary:
Flow types like this:
```
interface NativeCommands {
+hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void;
}
export const Commands = codegenNativeCommands<NativeCommands>();
```
get turned into this:
```
export const Commands = {
hotspotUpdate(viewRef: React.Ref<'RCTView'>, x: number, y: number) {
UIManager.dispatchViewCommand(
findNodeHandle(viewRef),
UIManager.getViewManagerConfig('RCTView').Commands.hotspotUpdate,
[x, y]
);
}
}
```
Reviewed By: rickhanlonii
Differential Revision: D15953126
fbshipit-source-id: edbb91056347d021dd0683391c903b76f3d1c33f
18 lines
335 B
JavaScript
18 lines
335 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
function codegenNativeCommands<T>(): T {
|
|
return (({}: any): T);
|
|
}
|
|
|
|
export default codegenNativeCommands;
|