Migrate RefreshControl to Native Commands

Summary:
Changelog: [Internal]

Introduce native command `setNativeRefreshing`, it has the word Native in order to avoid name conflict with setRefreshing in Android implementation. Even this component is iOS only, it would make it easier to merge them in the future.

Introduce `RCTRefreshableProtocol` and make `RCTRefreshControl` and `RCTPullToRefreshViewComponentView` to conform to the protocol so view manager can forward command to both, Paper and Fabric component.

Reviewed By: mmmulani

Differential Revision: D18475804

fbshipit-source-id: 4c19225784efc931b7b8f2d2671cc839bce429bf
This commit is contained in:
Samuel Susla
2019-11-19 10:02:26 -08:00
committed by Facebook Github Bot
parent 83f0210cee
commit 2d80a248cd
9 changed files with 102 additions and 3 deletions
@@ -11,6 +11,7 @@ package com.facebook.react.viewmanagers;
import android.view.View;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.uimanager.BaseViewManagerDelegate;
import com.facebook.react.uimanager.BaseViewManagerInterface;
import com.facebook.react.uimanager.LayoutShadowNode;
@@ -38,4 +39,12 @@ public class PullToRefreshViewManagerDelegate<T extends View, U extends BaseView
super.setProperty(view, propName, value);
}
}
public void receiveCommand(PullToRefreshViewManagerInterface<T> viewManager, T view, String commandName, ReadableArray args) {
switch (commandName) {
case "setNativeRefreshing":
viewManager.setNativeRefreshing(view, args.getBoolean(0));
break;
}
}
}