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:
Ramanpreet Nara 2018-09-10 11:19:25 -07:00 committed by Facebook Github Bot
parent 74c24147e2
commit 4c7cf13678
2 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,8 @@ namespace react {
extern const char ParagraphComponentName[];
using ParagraphEventEmitter = ViewEventEmitter;
/*
* `ShadowNode` for <Paragraph> component, represents <View>-like component
* containing and displaying text. Text content is represented as nested <Text>
@ -29,7 +31,8 @@ extern const char ParagraphComponentName[];
class ParagraphShadowNode:
public ConcreteViewShadowNode<
ParagraphComponentName,
ParagraphProps
ParagraphProps,
ParagraphEventEmitter
>,
public BaseTextShadowNode {

View File

@ -7,6 +7,7 @@
#pragma once
#include <fabric/components/view/ViewEventEmitter.h>
#include <fabric/components/text/BaseTextShadowNode.h>
#include <fabric/components/text/TextProps.h>
#include <fabric/core/ConcreteShadowNode.h>
@ -16,10 +17,13 @@ namespace react {
extern const char TextComponentName[];
using TextEventEmitter = TouchEventEmitter;
class TextShadowNode:
public ConcreteShadowNode<
TextComponentName,
TextProps
TextProps,
TextEventEmitter
>,
public BaseTextShadowNode {