ModalHostViewState.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #pragma once
  8. #include <react/graphics/Float.h>
  9. #include <react/graphics/Geometry.h>
  10. #include <react/graphics/conversions.h>
  11. #ifdef ANDROID
  12. #include <folly/dynamic.h>
  13. #endif
  14. namespace facebook {
  15. namespace react {
  16. /*
  17. * State for <BottomSheetView> component.
  18. */
  19. class ModalHostViewState final {
  20. public:
  21. using Shared = std::shared_ptr<const ModalHostViewState>;
  22. ModalHostViewState(){};
  23. ModalHostViewState(Size screenSize_) : screenSize(screenSize_){};
  24. #ifdef ANDROID
  25. ModalHostViewState(
  26. ModalHostViewState const &previousState,
  27. folly::dynamic data)
  28. : screenSize(Size{(Float)data["screenWidth"].getDouble(),
  29. (Float)data["screenHeight"].getDouble()}){};
  30. #endif
  31. const Size screenSize{};
  32. #ifdef ANDROID
  33. folly::dynamic getDynamic() const;
  34. #endif
  35. #pragma mark - Getters
  36. };
  37. } // namespace react
  38. } // namespace facebook