/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
59 строк
2 KB
zhongwuzw
Fabric: Only add selection of textinput payload when event is selectionChange (#51051)
17 июн 2025, 13:23
17 июн 2025, 13:23
3bfbaa8
Код
Авторство
О чём код?
/* * Copyright (c) Meta Platforms, Inc. and 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/attributedstring/AttributedString.h> #include <react/renderer/components/view/ViewEventEmitter.h> namespace facebook::react { class TextInputEventEmitter : public ViewEventEmitter { public: using ViewEventEmitter::ViewEventEmitter; struct Metrics { std::string text; AttributedString::Range selectionRange; // ScrollView-like metrics Size contentSize; Point contentOffset; EdgeInsets contentInset; Size containerSize; int eventCount; Size layoutMeasurement; Float zoomScale; Tag target; }; struct KeyPressMetrics { std::string text; int eventCount; }; void onFocus(const Metrics& textInputMetrics) const; void onBlur(const Metrics& textInputMetrics) const; void onChange(const Metrics& textInputMetrics) const; void onContentSizeChange(const Metrics& textInputMetrics) const; void onSelectionChange(const Metrics& textInputMetrics) const; void onEndEditing(const Metrics& textInputMetrics) const; void onSubmitEditing(const Metrics& textInputMetrics) const; void onKeyPress(const KeyPressMetrics& keyPressMetrics) const; void onScroll(const Metrics& textInputMetrics) const; private: void dispatchTextInputEvent( const std::string& name, const Metrics& textInputMetrics, bool includeSelectionState = false) const; void dispatchTextInputContentSizeChangeEvent( const std::string& name, const Metrics& textInputMetrics) const; }; } // namespace facebook::react