-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JSI<->C++ bridging conversion for folly::dynamic (#37237)
Summary: Pull Request resolved: #37237 Enables bridging conversions to/from jsi::Value and folly::dynamic. Changelog: [Internal] - Add JSI<->C++ bridging conversion for folly::dynamic Differential Revision: D45544843 fbshipit-source-id: a0619f8274cf589526b29ad065443c6983200cda
- Loading branch information
1 parent
c8a0f19
commit 07b36a6
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/react-native/ReactCommon/react/bridging/Dynamic.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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 <folly/dynamic.h> | ||
#include <jsi/JSIDynamic.h> | ||
|
||
namespace facebook::react { | ||
|
||
template <> | ||
struct Bridging<folly::dynamic> { | ||
static folly::dynamic fromJs(jsi::Runtime &rt, const jsi::Value &value) { | ||
return jsi::dynamicFromValue(rt, value); | ||
} | ||
|
||
static jsi::Value toJs(jsi::Runtime &rt, folly::dynamic value) { | ||
return jsi::valueFromDynamic(rt, std::move(value)); | ||
} | ||
}; | ||
|
||
} // namespace facebook::react |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters