forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
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 (facebook#37237)
Summary: Pull Request resolved: facebook#37237 Enables bridging conversions to/from jsi::Value and folly::dynamic. Changelog: [Internal] - Add JSI<->C++ bridging conversion for folly::dynamic Reviewed By: javache Differential Revision: D45544843 fbshipit-source-id: 210e06a682cfef15499f04e520c953f6daac2aa5
- Loading branch information
1 parent
80ecbdf
commit 7fbfcca
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, const folly::dynamic &value) { | ||
return jsi::valueFromDynamic(rt, 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