mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
74608ee4ab
Summary: # LegacyViewManagerInterop is born LegacyViewManagerInterop is a component that should make it possible for legacy components to work in Fabric, new renderer. This is just a first stage that prints keys of props to screen together with component name. Reviewed By: shergin Differential Revision: D17552827 fbshipit-source-id: c3e062f413727729e6a9b683c60f59f0292cc63b
37 lines
1.0 KiB
C++
37 lines
1.0 KiB
C++
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include "LegacyViewManagerInteropViewProps.h"
|
|
#include <folly/json.h>
|
|
#include <react/core/propsConversions.h>
|
|
#include <iostream>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
static std::unordered_map<std::string, folly::dynamic> convertToMap(
|
|
RawProps const &rawProps) {
|
|
std::unordered_map<std::string, folly::dynamic> map{};
|
|
auto const dynamic = (folly::dynamic)rawProps;
|
|
if (dynamic.isObject()) {
|
|
for (auto const &t : dynamic.items()) {
|
|
if (t.first.isString()) {
|
|
map[t.first.asString()] = t.second;
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
LegacyViewManagerInteropViewProps::LegacyViewManagerInteropViewProps(
|
|
const LegacyViewManagerInteropViewProps &sourceProps,
|
|
const RawProps &rawProps)
|
|
: ViewProps(sourceProps, rawProps), otherProps(convertToMap(rawProps)) {}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|