Files
flipper/react-native/react-native-flipper/windows/ReactNativeFlipper/ReactNativeModule.h
Lorenzo Blasa 57e6662a46 Folly/Boost integration
Summary:
This change brings in Folly and Boost into our solution.

Boost is resolved with NuGet. Folly is resolved by re-using the RNW integration.

For reference:

Flipper depends on Folly. Folly depends on a few things:
- Boost
- FMT
- Glog
- Double-Conversion

Folly from RNW uses some stubs to resolve fmt, glog, and double-conversion. That's OK.

Only Boost needs resolving.

On Visual Studio, we can use the following package managers: NuGet and vcpkg.

Boost can be resolved using either.

Using NuGet as otherwise vcpkg needs to be run locally by anybody wanting to build the solution. NuGet makes things easier.

Reviewed By: aigoncharov

Differential Revision: D36759384

fbshipit-source-id: 31a9a398ce5c5dc2f3def02689ae4bb8c42fbb99
2022-07-14 06:59:11 -07:00

45 lines
1.2 KiB
C++

/*
* 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 <folly/json.h>
#include "JSValue.h"
#include "NativeModules.h"
using namespace winrt::Microsoft::ReactNative;
namespace winrt::ReactNativeFlipper {
REACT_MODULE(ReactNativeModule, L"ReactNativeFlipper")
struct ReactNativeModule {
// See https://microsoft.github.io/react-native-windows/docs/native-modules
// for details on writing native modules
REACT_INIT(Initialize)
void Initialize(ReactContext const& reactContext) noexcept {
m_reactContext = reactContext;
}
REACT_METHOD(sampleMethod)
void sampleMethod(
std::string stringArgument,
int numberArgument,
std::function<void(std::string)>&& callback) noexcept {
// TODO: Implement some actually useful functionality
callback(
"Received numberArgument: " + std::to_string(numberArgument) +
" stringArgument: " + stringArgument);
}
private:
ReactContext m_reactContext{nullptr};
};
} // namespace winrt::ReactNativeFlipper