/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/ReactCommon/react/renderer/observers/intersection/IntersectionObserverState.h
56 строк
1 KB
Luna Wei
Support `rn_rootThreshold` on IntersectionObserver (viewAreaCoveragePercentThreshold) (#47908)
22 ноя 2024, 22:50
22 ноя 2024, 22:50
a77d8d9
Код
Авторство
О чём код?
/* * 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/graphics/Float.h> #include <optional> namespace { enum class IntersectionObserverStateType { Initial, NotIntersecting, Intersecting, }; } namespace facebook::react { class IntersectionObserverState { public: static IntersectionObserverState Initial(); static IntersectionObserverState NotIntersecting(); static IntersectionObserverState Intersecting(Float threshold); static IntersectionObserverState Intersecting( Float threshold, Float rootThreshold); bool isIntersecting() const; bool operator==(const IntersectionObserverState& other) const; bool operator!=(const IntersectionObserverState& other) const; private: explicit IntersectionObserverState(IntersectionObserverStateType state); IntersectionObserverState( IntersectionObserverStateType state, Float threshold, Float rootThreshold); IntersectionObserverStateType state_; // This value is only relevant if the state is // IntersectionObserverStateType::Intersecting. Float threshold_{}; // This value is only relevant if the state is // IntersectionObserverStateType::Intersecting. std::optional<Float> rootThreshold_{}; }; } // namespace facebook::react