From 11b40845b049f19b129cba299f4f3b177c23961b Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Fri, 15 Sep 2017 16:16:09 -0700 Subject: [PATCH] Added Flow types for React Native host components Reviewed By: calebmer Differential Revision: D5844473 fbshipit-source-id: 2893e5a5ee58d147a2f7d351143a7ce0eb8eebe3 --- Libraries/Components/View/View.js.flow | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Libraries/Components/View/View.js.flow diff --git a/Libraries/Components/View/View.js.flow b/Libraries/Components/View/View.js.flow new file mode 100644 index 00000000000000..fb62d61037f498 --- /dev/null +++ b/Libraries/Components/View/View.js.flow @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule View + * @flow + * @format + */ + +'use strict'; + +const {NativeComponent} = require('ReactNative'); + +import type {ViewProps} from 'ViewPropTypes'; + +export type Props = ViewProps; + +/** + * Host components in React 16 are represented by strings (eg "div", "View"). + * This is inconvenient for users who want to type a ref (eg `ref: View`). + * The following type isn't sound but it enables consistent Flow types + * for various default React Native components, so it seems a good tradeoff. + */ +declare class View extends NativeComponent {} + +module.exports = View;