-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Changelog: ---------- [iOS] [Changed] - moved RCTRefreshControl from RefreshControl as a separate component, as mentioned in #22990 [Android] [Changed] - moved AndroidSwipeRefreshLayout from RefreshControl as a separate component, as mentioned in #22990 Pull Request resolved: #23039 Reviewed By: rickhanlonii Differential Revision: D13710076 Pulled By: cpojer fbshipit-source-id: 332520b74d6fc73e50dbe511dae22f82015c2d3a
- Loading branch information
1 parent
707622a
commit b864b6c
Showing
3 changed files
with
154 additions
and
19 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* 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'; | ||
|
||
const requireNativeComponent = require('requireNativeComponent'); | ||
|
||
import type {ColorValue} from 'StyleSheetTypes'; | ||
import type {ViewProps} from 'ViewPropTypes'; | ||
import type {NativeComponent} from 'ReactNative'; | ||
|
||
const AndroidSwipeRefreshLayout = require('UIManager').getViewManagerConfig( | ||
'AndroidSwipeRefreshLayout', | ||
); | ||
const RefreshLayoutConsts = AndroidSwipeRefreshLayout | ||
? AndroidSwipeRefreshLayout.Constants | ||
: {SIZE: {}}; | ||
|
||
type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
/** | ||
* Whether the pull to refresh functionality is enabled. | ||
*/ | ||
enabled?: ?boolean, | ||
/** | ||
* The colors (at least one) that will be used to draw the refresh indicator. | ||
*/ | ||
colors?: ?$ReadOnlyArray<ColorValue>, | ||
/** | ||
* The background color of the refresh indicator. | ||
*/ | ||
progressBackgroundColor?: ?ColorValue, | ||
/** | ||
* Size of the refresh indicator, see RefreshControl.SIZE. | ||
*/ | ||
size?: ?( | ||
| typeof RefreshLayoutConsts.SIZE.DEFAULT | ||
| typeof RefreshLayoutConsts.SIZE.LARGE | ||
), | ||
/** | ||
* Progress view top offset | ||
*/ | ||
progressViewOffset?: ?number, | ||
|
||
/** | ||
* Called when the view starts refreshing. | ||
*/ | ||
onRefresh?: ?() => mixed, | ||
|
||
/** | ||
* Whether the view should be indicating an active refresh. | ||
*/ | ||
refreshing: boolean, | ||
|}>; | ||
|
||
type AndroidSwipeRefreshLayoutNativeType = Class<NativeComponent<NativeProps>>; | ||
|
||
module.exports = ((requireNativeComponent( | ||
'AndroidSwipeRefreshLayout', | ||
): any): AndroidSwipeRefreshLayoutNativeType); |
50 changes: 50 additions & 0 deletions
50
Libraries/Components/RefreshControl/RCTRefreshControlNativeComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* 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'; | ||
|
||
const requireNativeComponent = require('requireNativeComponent'); | ||
|
||
import type {ColorValue} from 'StyleSheetTypes'; | ||
import type {ViewProps} from 'ViewPropTypes'; | ||
import type {NativeComponent} from 'ReactNative'; | ||
|
||
export type NativeProps = $ReadOnly<{| | ||
...ViewProps, | ||
|
||
/** | ||
* The color of the refresh indicator. | ||
*/ | ||
tintColor?: ?ColorValue, | ||
/** | ||
* Title color. | ||
*/ | ||
titleColor?: ?ColorValue, | ||
/** | ||
* The title displayed under the refresh indicator. | ||
*/ | ||
title?: ?string, | ||
|
||
/** | ||
* Called when the view starts refreshing. | ||
*/ | ||
onRefresh?: ?() => mixed, | ||
|
||
/** | ||
* Whether the view should be indicating an active refresh. | ||
*/ | ||
refreshing: boolean, | ||
|}>; | ||
|
||
type RCTRefreshControlNativeType = Class<NativeComponent<NativeProps>>; | ||
|
||
module.exports = ((requireNativeComponent( | ||
'RCTRefreshControl', | ||
): any): RCTRefreshControlNativeType); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters