mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 08:05:34 +00:00
Setup event emitters for TextShdowNode
and ParagraphShadowNode
Summary: This diff includes two changes: 1. `TextShadowNode` represents virtual texts. For the time being, virtual text nodes only need touch capabilities so that they can handle `onPress` events for their children. Therefore, we should set the `TextShadowNode`'s `EventEmitterT` to `TouchEventEmitter`. 2. Since `ParagraphShadowNode` extends an instance of the `ConcreteViewShadowNode` template, it automatically uses the `ViewEventEmitter` if no event emitter is specified. I think it's better to make the event emitter explicitly specified. So, I've included that change in this diff. Reviewed By: shergin Differential Revision: D9696906 fbshipit-source-id: ac053ffdde4c2fbc6351f177c07a2ada4445cbb8
This commit is contained in:
parent
74c24147e2
commit
4c7cf13678
@ -21,6 +21,8 @@ namespace react {
|
|||||||
|
|
||||||
extern const char ParagraphComponentName[];
|
extern const char ParagraphComponentName[];
|
||||||
|
|
||||||
|
using ParagraphEventEmitter = ViewEventEmitter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* `ShadowNode` for <Paragraph> component, represents <View>-like component
|
* `ShadowNode` for <Paragraph> component, represents <View>-like component
|
||||||
* containing and displaying text. Text content is represented as nested <Text>
|
* containing and displaying text. Text content is represented as nested <Text>
|
||||||
@ -29,7 +31,8 @@ extern const char ParagraphComponentName[];
|
|||||||
class ParagraphShadowNode:
|
class ParagraphShadowNode:
|
||||||
public ConcreteViewShadowNode<
|
public ConcreteViewShadowNode<
|
||||||
ParagraphComponentName,
|
ParagraphComponentName,
|
||||||
ParagraphProps
|
ParagraphProps,
|
||||||
|
ParagraphEventEmitter
|
||||||
>,
|
>,
|
||||||
public BaseTextShadowNode {
|
public BaseTextShadowNode {
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <fabric/components/view/ViewEventEmitter.h>
|
||||||
#include <fabric/components/text/BaseTextShadowNode.h>
|
#include <fabric/components/text/BaseTextShadowNode.h>
|
||||||
#include <fabric/components/text/TextProps.h>
|
#include <fabric/components/text/TextProps.h>
|
||||||
#include <fabric/core/ConcreteShadowNode.h>
|
#include <fabric/core/ConcreteShadowNode.h>
|
||||||
@ -16,10 +17,13 @@ namespace react {
|
|||||||
|
|
||||||
extern const char TextComponentName[];
|
extern const char TextComponentName[];
|
||||||
|
|
||||||
|
using TextEventEmitter = TouchEventEmitter;
|
||||||
|
|
||||||
class TextShadowNode:
|
class TextShadowNode:
|
||||||
public ConcreteShadowNode<
|
public ConcreteShadowNode<
|
||||||
TextComponentName,
|
TextComponentName,
|
||||||
TextProps
|
TextProps,
|
||||||
|
TextEventEmitter
|
||||||
>,
|
>,
|
||||||
public BaseTextShadowNode {
|
public BaseTextShadowNode {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user