From b063c417822d06f4a91eaaa9ba97da748abaa865 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Fri, 21 Jun 2019 03:15:53 -0700 Subject: [PATCH] Generate PullToRefreshView Summary: Adds the codgen types and generated view config for PullToRefresh Reviewed By: TheSavior Differential Revision: D15900138 fbshipit-source-id: ee2c179317749182aaf6d3b90c8379ce06a82b9c --- .../PullToRefreshViewNativeComponent.js | 15 +++++---------- .../Components/RefreshControl/RefreshControl.js | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js b/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js index 43105157841..ac6dab24b37 100644 --- a/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js +++ b/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js @@ -11,11 +11,10 @@ 'use strict'; import type {BubblingEvent, WithDefault} from '../../Types/CodegenTypes'; -import type {NativeComponent} from '../../Renderer/shims/ReactNative'; import type {ColorValue} from '../../StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../View/ViewPropTypes'; -const requireNativeComponent = require('../../ReactNative/requireNativeComponent'); +import codegenNativeComponent from '../../Utilities/codegenNativeComponent'; type NativeProps = $ReadOnly<{| ...ViewProps, @@ -31,7 +30,7 @@ type NativeProps = $ReadOnly<{| /** * The title displayed under the refresh indicator. */ - title?: ?WithDefault, + title?: ?WithDefault, /** * Called when the view starts refreshing. @@ -44,10 +43,6 @@ type NativeProps = $ReadOnly<{| refreshing: WithDefault, |}>; -// TODO: Switch this over to CodegenNativeComponent -// once the native components are renamed in paper and fabric -type PullToRefreshViewType = Class>; - -module.exports = ((requireNativeComponent( - 'RCTRefreshControl', -): any): PullToRefreshViewType); +export default codegenNativeComponent('PullToRefresh', { + paperComponentName: 'RCTRefreshControl', +}); diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index db6844d0947..c0eea823b81 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -14,7 +14,7 @@ const Platform = require('../../Utilities/Platform'); const React = require('react'); import AndroidSwipeRefreshLayoutNativeComponent from './AndroidSwipeRefreshLayoutNativeComponent'; -const PullToRefreshViewNativeComponent = require('./PullToRefreshViewNativeComponent'); +import PullToRefreshViewNativeComponent from './PullToRefreshViewNativeComponent'; const nullthrows = require('nullthrows'); import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';