mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Codegen for PullToRefresh component
Summary: Straightforward. Rick, I rename some stuff, I hope you are cool with that. Reviewed By: mdvacca Differential Revision: D15403306 fbshipit-source-id: 1dbd34060052a9bd39ed4211010f14b76fffcde6
This commit is contained in:
committed by
Facebook Github Bot
parent
e8b2145263
commit
f02feb8d38
+4
-5
@@ -12,11 +12,11 @@
|
||||
|
||||
import type {SchemaType} from '../../../packages/react-native-codegen/src/CodegenSchema.js';
|
||||
|
||||
const RCTRefreshControlNativeTypeSchema: SchemaType = {
|
||||
const PullToRefreshViewSchema: SchemaType = {
|
||||
modules: {
|
||||
RCTRefreshControlNativeType: {
|
||||
PullToRefreshView: {
|
||||
components: {
|
||||
RCTRefreshControlNativeType: {
|
||||
PullToRefreshView: {
|
||||
extendsProps: [
|
||||
{
|
||||
type: 'ReactNativeBuiltInType',
|
||||
@@ -27,7 +27,6 @@ const RCTRefreshControlNativeTypeSchema: SchemaType = {
|
||||
{
|
||||
name: 'onRefresh',
|
||||
optional: true,
|
||||
|
||||
bubblingType: 'bubble',
|
||||
typeAnnotation: {
|
||||
type: 'EventTypeAnnotation',
|
||||
@@ -78,4 +77,4 @@ const RCTRefreshControlNativeTypeSchema: SchemaType = {
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = RCTRefreshControlNativeTypeSchema;
|
||||
module.exports = PullToRefreshViewSchema;
|
||||
@@ -43,8 +43,8 @@ export type NativeProps = $ReadOnly<{|
|
||||
refreshing: boolean,
|
||||
|}>;
|
||||
|
||||
type RCTRefreshControlNativeType = Class<NativeComponent<NativeProps>>;
|
||||
type PullToRefreshView = Class<NativeComponent<NativeProps>>;
|
||||
|
||||
module.exports = ((requireNativeComponent(
|
||||
'RCTRefreshControl',
|
||||
): any): RCTRefreshControlNativeType);
|
||||
): any): PullToRefreshView);
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
|
||||
#import "RNPullToRefreshViewComponentView.h"
|
||||
|
||||
#import <react/components/scrollview/PullToRefreshViewComponentDescriptor.h>
|
||||
#import <react/components/scrollview/PullToRefreshViewEventEmitter.h>
|
||||
#import <react/components/scrollview/PullToRefreshViewProps.h>
|
||||
#import <react/components/rncore/ComponentDescriptors.h>
|
||||
#import <react/components/rncore/EventEmitters.h>
|
||||
#import <react/components/rncore/Props.h>
|
||||
|
||||
#import <React/RCTScrollViewComponentView.h>
|
||||
#import <React/RCTConversions.h>
|
||||
|
||||
|
||||
using namespace facebook::react;
|
||||
|
||||
@implementation RNPullToRefreshViewComponentView {
|
||||
@@ -81,7 +80,7 @@ using namespace facebook::react;
|
||||
|
||||
- (void)handleUIControlEventValueChanged
|
||||
{
|
||||
std::static_pointer_cast<PullToRefreshViewEventEmitter const>(_eventEmitter)->onRefresh();
|
||||
std::static_pointer_cast<PullToRefreshViewEventEmitter const>(_eventEmitter)->onRefresh({});
|
||||
}
|
||||
|
||||
- (void)_updateTitle
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/scrollview/PullToRefreshViewShadowNode.h>
|
||||
#include <react/core/ConcreteComponentDescriptor.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
using PullToRefreshViewComponentDescriptor =
|
||||
ConcreteComponentDescriptor<PullToRefreshViewShadowNode>;
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "PullToRefreshViewEventEmitter.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
void PullToRefreshViewEventEmitter::onRefresh() const {
|
||||
dispatchEvent("refresh");
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <react/components/view/ViewEventEmitter.h>
|
||||
#include <react/core/EventEmitter.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class PullToRefreshViewEventEmitter : public ViewEventEmitter {
|
||||
public:
|
||||
using ViewEventEmitter::ViewEventEmitter;
|
||||
|
||||
void onRefresh() const;
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "PullToRefreshViewProps.h"
|
||||
|
||||
#include <react/core/propsConversions.h>
|
||||
#include <react/graphics/conversions.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
PullToRefreshViewProps::PullToRefreshViewProps(
|
||||
PullToRefreshViewProps const &sourceProps,
|
||||
RawProps const &rawProps)
|
||||
: ViewProps(sourceProps, rawProps),
|
||||
refreshing(
|
||||
convertRawProp(rawProps, "refreshing", sourceProps.refreshing)),
|
||||
tintColor(convertRawProp(rawProps, "tintColor", sourceProps.tintColor)),
|
||||
title(convertRawProp(rawProps, "title", sourceProps.title)),
|
||||
titleColor(
|
||||
convertRawProp(rawProps, "titleColor", sourceProps.titleColor)) {}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/view/ViewProps.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class PullToRefreshViewProps final : public ViewProps {
|
||||
public:
|
||||
PullToRefreshViewProps() = default;
|
||||
PullToRefreshViewProps(
|
||||
PullToRefreshViewProps const &sourceProps,
|
||||
RawProps const &rawProps);
|
||||
|
||||
#pragma mark - Props
|
||||
|
||||
bool const refreshing{};
|
||||
SharedColor const tintColor{};
|
||||
std::string const title{};
|
||||
SharedColor const titleColor{};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "PullToRefreshViewShadowNode.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
const char PullToRefreshViewComponentName[] = "RefreshControl";
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <react/components/scrollview/PullToRefreshViewEventEmitter.h>
|
||||
#include <react/components/scrollview/PullToRefreshViewProps.h>
|
||||
#include <react/components/view/ConcreteViewShadowNode.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
extern const char PullToRefreshViewComponentName[];
|
||||
|
||||
/*
|
||||
* `ShadowNode` for <PullToRefreshView> component.
|
||||
*/
|
||||
class PullToRefreshViewShadowNode final : public ConcreteViewShadowNode<
|
||||
PullToRefreshViewComponentName,
|
||||
PullToRefreshViewProps,
|
||||
PullToRefreshViewEventEmitter> {
|
||||
public:
|
||||
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
||||
Reference in New Issue
Block a user