Implement HorizontalScrollView component

Summary: This diff implements the HorizontalScrollView component for Android Fabric C++, as part of this diff I also re-named the components AndroidHorizontalScrollContentView for RCTAndroidHorizontalScrollContentView and AndroidHorizontalScrollView for RCTAndroidHorizontalScrollView. This might sound against our plan of removing the RCT preffix, but it is to make it simpler to map components between current implementation of RN and Fabric (otherwise we don't know when to add the RCT preffix in Android side to find the right View Manager), later we can just remove the preffix from C++, Android, iOS and JS.

Reviewed By: shergin, achen1

Differential Revision: D9122729

fbshipit-source-id: e9299552857c6dd0c18abfa5fa49a3d50e221729
This commit is contained in:
David Vacca 2018-08-28 22:49:21 -07:00 committed by Facebook Github Bot
parent 01580de613
commit 575f7d478d
5 changed files with 14 additions and 9 deletions

View File

@ -47,10 +47,10 @@ let RCTScrollContentView;
if (Platform.OS === 'android') {
AndroidScrollView = requireNativeComponent('RCTScrollView');
AndroidHorizontalScrollView = requireNativeComponent(
'AndroidHorizontalScrollView',
'RCTAndroidHorizontalScrollView',
);
AndroidHorizontalScrollContentView = requireNativeComponent(
'AndroidHorizontalScrollContentView',
'RCTAndroidHorizontalScrollContentView',
);
} else if (Platform.OS === 'ios') {
RCTScrollView = requireNativeComponent('RCTScrollView');

View File

@ -14,7 +14,7 @@ import com.facebook.react.uimanager.ViewGroupManager;
public class ReactHorizontalScrollContainerViewManager
extends ViewGroupManager<ReactHorizontalScrollContainerView> {
protected static final String REACT_CLASS = "AndroidHorizontalScrollContentView";
protected static final String REACT_CLASS = "RCTAndroidHorizontalScrollContentView";
public ReactHorizontalScrollContainerViewManager() {}

View File

@ -37,7 +37,7 @@ public class ReactHorizontalScrollViewManager
extends ViewGroupManager<ReactHorizontalScrollView>
implements ReactScrollViewCommandHelper.ScrollCommandHandler<ReactHorizontalScrollView> {
protected static final String REACT_CLASS = "AndroidHorizontalScrollView";
protected static final String REACT_CLASS = "RCTAndroidHorizontalScrollView";
private static final int[] SPACING_TYPES = {
Spacing.ALL, Spacing.LEFT, Spacing.RIGHT, Spacing.TOP, Spacing.BOTTOM,

View File

@ -65,6 +65,10 @@ static const std::string componentNameByReactViewName(std::string viewName) {
return "Image";
}
if (viewName == "AndroidHorizontalScrollView") {
return "ScrollView";
}
// We need this temporarly for testing purposes until we have proper
// implementation of core components.
if (
@ -72,7 +76,8 @@ static const std::string componentNameByReactViewName(std::string viewName) {
viewName == "MultilineTextInputView" ||
viewName == "RefreshControl" ||
viewName == "SafeAreaView" ||
viewName == "ScrollContentView"
viewName == "ScrollContentView" ||
viewName == "AndroidHorizontalScrollContentView" // Android
) {
return "View";
}