mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-05 13:46:59 +00:00
114 lines
3.7 KiB
C++
Generated
114 lines
3.7 KiB
C++
Generated
///
|
|
/// HybridOmniViewComponent.hpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#pragma once
|
|
|
|
#include <optional>
|
|
#include <NitroModules/NitroDefines.hpp>
|
|
#include <NitroModules/NitroHash.hpp>
|
|
#include <NitroModules/CachedProp.hpp>
|
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
#include <react/renderer/core/PropsParserContext.h>
|
|
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
#include <react/renderer/components/view/ViewProps.h>
|
|
|
|
#include <memory>
|
|
#include "HybridOmniPlayerSpec.hpp"
|
|
#include <optional>
|
|
#include "HybridOmniViewSpec.hpp"
|
|
#include <functional>
|
|
|
|
namespace margelo::nitro::omni::views {
|
|
|
|
using namespace facebook;
|
|
|
|
/**
|
|
* The name of the actual native View.
|
|
*/
|
|
extern const char HybridOmniViewComponentName[];
|
|
|
|
/**
|
|
* Props for the "OmniView" View.
|
|
*/
|
|
class HybridOmniViewProps final: public react::ViewProps {
|
|
public:
|
|
HybridOmniViewProps() = default;
|
|
HybridOmniViewProps(const react::PropsParserContext& context,
|
|
const HybridOmniViewProps& sourceProps,
|
|
const react::RawProps& rawProps);
|
|
|
|
public:
|
|
CachedProp<std::shared_ptr<HybridOmniPlayerSpec>> player;
|
|
CachedProp<std::optional<bool>> autoplay;
|
|
CachedProp<std::optional<bool>> autoPip;
|
|
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridOmniViewSpec>& /* ref */)>>> hybridRef;
|
|
|
|
private:
|
|
static bool filterObjectKeys(const std::string& propName);
|
|
};
|
|
|
|
/**
|
|
* State for the "OmniView" View.
|
|
*/
|
|
class HybridOmniViewState final {
|
|
public:
|
|
HybridOmniViewState() = default;
|
|
explicit HybridOmniViewState(const std::shared_ptr<HybridOmniViewProps>& props):
|
|
_props(props) {}
|
|
|
|
public:
|
|
[[nodiscard]]
|
|
const std::shared_ptr<HybridOmniViewProps>& getProps() const {
|
|
return _props;
|
|
}
|
|
|
|
public:
|
|
#ifdef ANDROID
|
|
HybridOmniViewState(const HybridOmniViewState& /* previousState */, folly::dynamic /* data */) {}
|
|
folly::dynamic getDynamic() const {
|
|
throw std::runtime_error("HybridOmniViewState does not support folly!");
|
|
}
|
|
react::MapBuffer getMapBuffer() const {
|
|
throw std::runtime_error("HybridOmniViewState does not support MapBuffer!");
|
|
};
|
|
#endif
|
|
|
|
private:
|
|
std::shared_ptr<HybridOmniViewProps> _props;
|
|
};
|
|
|
|
/**
|
|
* The Shadow Node for the "OmniView" View.
|
|
*/
|
|
using HybridOmniViewShadowNode = react::ConcreteViewShadowNode<HybridOmniViewComponentName /* "HybridOmniView" */,
|
|
HybridOmniViewProps /* custom props */,
|
|
react::ViewEventEmitter /* default */,
|
|
HybridOmniViewState /* custom state */>;
|
|
|
|
/**
|
|
* The Component Descriptor for the "OmniView" View.
|
|
*/
|
|
class HybridOmniViewComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridOmniViewShadowNode> {
|
|
public:
|
|
explicit HybridOmniViewComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
|
|
|
|
public:
|
|
/**
|
|
* A faster path for cloning props - reuses the caching logic from `HybridOmniViewProps`.
|
|
*/
|
|
std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
|
|
const std::shared_ptr<const react::Props>& props,
|
|
react::RawProps rawProps) const override;
|
|
#ifdef ANDROID
|
|
void adopt(react::ShadowNode& shadowNode) const override;
|
|
#endif
|
|
};
|
|
|
|
/* The actual view for "OmniView" needs to be implemented in platform-specific code. */
|
|
|
|
} // namespace margelo::nitro::omni::views
|