Skip to content

Commit

Permalink
Change to C function
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwuzw committed Apr 9, 2024
1 parent 383d77f commit a6e5702
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/react-native/React/React-RCTFabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Pod::Spec.new do |s|
add_dependency(s, "React-Fabric", :additional_framework_paths => [
"react/renderer/textlayoutmanager/platform/ios",
"react/renderer/components/textinput/platform/ios",
"react/renderer/components/modal/platform/ios",
"react/renderer/components/view/platform/cxx",
"react/renderer/imagemanager/platform/ios",
])
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/ReactCommon/React-Fabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Pod::Spec.new do |s|
header_search_path = header_search_path + [
"\"$(PODS_TARGET_SRCROOT)/react/renderer/textlayoutmanager/platform/ios\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/components/textinput/platform/ios\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/components/modal/platform/ios\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/components/view/platform/cxx\"",
]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if ENV['USE_FRAMEWORKS']
"\"$(PODS_TARGET_SRCROOT)\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/textlayoutmanager/platform/ios\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/components/textinput/platform/ios\"",
"\"$(PODS_TARGET_SRCROOT)/react/renderer/components/modal/platform/ios\"",
# "\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCodegen/ReactCodegen.framework/Headers\"",
]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class ModalHostViewState final {
using Shared = std::shared_ptr<const ModalHostViewState>;

#if defined(__APPLE__) && TARGET_OS_IOS
ModalHostViewState() : screenSize(RCTModalHostViewScreenSize()) {
static Size getScreenSize() {
auto screenSize = RCTModalHostViewScreenSize();
return {screenSize.width, screenSize.height};
}
ModalHostViewState() : screenSize(getScreenSize()) {
#else
ModalHostViewState(){
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@

#pragma once

#include <react/renderer/core/graphicsConversions.h>
#ifdef __cplusplus
extern "C" {
#endif

namespace facebook::react {
typedef struct {
CGFloat width;
CGFloat height;
} RCTSize;

Size RCTModalHostViewScreenSize(void);
RCTSize RCTModalHostViewScreenSize(void);

} // namespace facebook::react
#ifdef __cplusplus
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
#import <Foundation/Foundation.h>
#import <React/RCTUtils.h>

namespace facebook::react {
extern "C" {

Size RCTModalHostViewScreenSize(void)
RCTSize RCTModalHostViewScreenSize(void)
{
CGSize screenSize = RCTScreenSize();

return {screenSize.width, screenSize.height};
}

Expand Down

0 comments on commit a6e5702

Please sign in to comment.