Valentin Shergin 88b8616437 Fabric: Using unordered_map instead of map for RawProps
Summary:
@public
We don't need to maintain an order of this collection, so using `unordered_map` is more appropriate.

Reviewed By: mdvacca

Differential Revision: D8826946

fbshipit-source-id: f6890097cc5d6a1e06f6b2cfd1b7d68a388da461
2018-07-17 22:53:56 -07:00

48 lines
1.2 KiB
C++

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* 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 <memory>
#include <string>
#include <unordered_map>
#include <folly/dynamic.h>
namespace facebook {
namespace react {
/*
* `Tag` and `InstanceHandle` are used to address React Native components.
*/
using Tag = int32_t;
using InstanceHandle = struct InstanceHandleDummyStruct {} *;
/*
* `RawProps` represents untyped map with props comes from JavaScript side.
*/
// TODO(T26954420): Use iterator as underlying type for RawProps.
using RawProps = std::unordered_map<std::string, folly::dynamic>;
using SharedRawProps = std::shared_ptr<const RawProps>;
/*
* Universal component handle which allows to refer to `ComponentDescriptor`s
* in maps efficiently.
* Practically, it's something that concrete ShadowNode and concrete
* ComponentDescriptor have in common.
*/
using ComponentHandle = size_t;
/*
* String identifier for components used for addressing them from
* JavaScript side.
*/
using ComponentName = std::string;
} // namespace react
} // namespace facebook