Skip to content

Commit

Permalink
fix: Update cpp code to support React Native 0.75.1
Browse files Browse the repository at this point in the history
  • Loading branch information
davebray131 committed Aug 19, 2024
1 parent 8b5e9d0 commit 3d88b47
Show file tree
Hide file tree
Showing 2 changed files with 6 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
6 changes: 3 additions & 3 deletions package/cpp/NativeMmkvModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
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 3d88b47

Please sign in to comment.