mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
412fc7d324
Summary: Changelog: [internal] In D23648430 (https://github.com/facebook/react-native/commit/a315e4cd30e4b8da841f587650146a62c868f67d) I made a mistake. I prevented calling `onTextLayout` unless there are attachments in the component. It fixed the problem because I unintentionally prevented `onTextLayout` to be called. Therefore, changes from D23648430 (https://github.com/facebook/react-native/commit/a315e4cd30e4b8da841f587650146a62c868f67d) need to be reverted. To prevent infinite loop in `onTextLayout`, ParagraphEventEmitter checks if `linesMeasurements` have changed before dispatching it to JS. Reviewed By: shergin Differential Revision: D23782717 fbshipit-source-id: 0e84ae4f46d79ce0cf4c7340cd32be6f562ae179
29 lines
710 B
C++
29 lines
710 B
C++
/*
|
|
* 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/renderer/components/view/ViewEventEmitter.h>
|
|
#include <react/renderer/textlayoutmanager/TextMeasureCache.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class ParagraphEventEmitter : public ViewEventEmitter {
|
|
public:
|
|
using ViewEventEmitter::ViewEventEmitter;
|
|
|
|
void onTextLayout(LinesMeasurements const &linesMeasurements) const;
|
|
|
|
private:
|
|
mutable std::mutex linesMeasurementsMutex_;
|
|
mutable LinesMeasurements linesMeasurementsMetrics_;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|