Add setNativeRefreshing command to SwipeRefreshLayoutManager

Summary:
As a part of the migration from `setNativeProps` in Fabric and Paper, we are replacing it by view commands in the RefreshControl component on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18475428

fbshipit-source-id: f2e978d88e34c74771f8582247ecc82b2b942557
This commit is contained in:
Oleksandr Melnykov
2019-11-13 10:21:04 -08:00
committed by Facebook Github Bot
parent cd1e34d4a2
commit c5c3264a94
4 changed files with 44 additions and 1 deletions
@@ -10,6 +10,9 @@
'use strict';
import * as React from 'react';
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
@@ -65,6 +68,19 @@ type NativeProps = $ReadOnly<{|
refreshing: boolean,
|}>;
type NativeType = HostComponent<NativeProps>;
interface NativeCommands {
+setNativeRefreshing: (
viewRef: React.ElementRef<NativeType>,
value: boolean,
) => void;
}
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['setNativeRefreshing'],
});
export default (codegenNativeComponent<NativeProps>(
'AndroidSwipeRefreshLayout',
): HostComponent<NativeProps>);
): NativeType);