Skip to content

Commit

Permalink
fix: Update cpp code to support React Native 0.75.1 (#719)
Browse files Browse the repository at this point in the history
* fix: Update cpp code to support React Native 0.75.1

* fix: ran cpp linter
  • Loading branch information
davebray131 authored Aug 29, 2024
1 parent e28425c commit 430c2f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package/cpp/MmkvHostObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ MMKVMode MmkvHostObject::getMMKVMode(const facebook::react::MMKVConfig& config)
if (!config.mode.has_value()) {
return MMKVMode::MMKV_SINGLE_PROCESS;
}
react::MmkvCxxMode mode = config.mode.value();
react::NativeMmkvMode mode = config.mode.value();
switch (mode) {
case react::MmkvCxxMode::SINGLE_PROCESS:
case react::NativeMmkvMode::SINGLE_PROCESS:
return MMKVMode::MMKV_SINGLE_PROCESS;
case react::MmkvCxxMode::MULTI_PROCESS:
case react::NativeMmkvMode::MULTI_PROCESS:
return MMKVMode::MMKV_MULTI_PROCESS;
default:
[[unlikely]] throw std::runtime_error("Invalid MMKV Mode value!");
Expand Down
7 changes: 4 additions & 3 deletions package/cpp/NativeMmkvModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
namespace facebook::react {

// The MMKVConfiguration type from JS
using MMKVConfig = MmkvCxxConfiguration<std::string, std::optional<std::string>,
std::optional<std::string>, std::optional<MmkvCxxMode>>;
template <> struct Bridging<MMKVConfig> : MmkvCxxConfigurationBridging<MMKVConfig> {};
using MMKVConfig =
NativeMmkvConfiguration<std::string, std::optional<std::string>, std::optional<std::string>,
std::optional<NativeMmkvMode>>;
template <> struct Bridging<MMKVConfig> : NativeMmkvConfigurationBridging<MMKVConfig> {};

// The TurboModule itself
class NativeMmkvModule : public NativeMmkvCxxSpec<NativeMmkvModule> {
Expand Down

0 comments on commit 430c2f5

Please sign in to comment.