Files
react-native/packages/react-native-codegen/src/parsers/flow/modules/schema.js
T
Michał Osadnik cbd4ad43c0 Change module parser to consider extends instead of default exports
Summary:
Following out internal communication we decided to change logic of current parser to consider types which extend 'TurboModule' instead of looking at default exports.

It also cassed for minor changes i n testing logic and updating snapshots.

Reviewed By: rickhanlonii

Differential Revision: D16200939

fbshipit-source-id: a21cbfc461647df2b9210c0eca4c2c95c285dfe1
2019-07-11 09:30:52 -07:00

39 lines
757 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';
import type {SchemaType, MethodTypeShape} from '../../../CodegenSchema.js';
export type NativeModuleSchemaBuilderConfig = $ReadOnly<{|
properties: $ReadOnlyArray<MethodTypeShape>,
|}>;
function buildModuleSchema(
{properties}: NativeModuleSchemaBuilderConfig,
moduleName: string,
): SchemaType {
return {
modules: {
[`Native${moduleName}`]: {
nativeModules: {
[moduleName]: {
properties,
},
},
},
},
};
}
module.exports = {
buildModuleSchema,
};