Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -81,6 +81,7 @@ Pod::Spec.new do |s|
add_dependency(s, "React-FabricComponents", :additional_framework_paths => [
"react/renderer/textlayoutmanager/platform/ios",
"react/renderer/components/textinput/platform/ios",
"react/renderer/components/modal/platform/ios",
]);

add_dependency(s, "React-nativeconfig")
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 @@ -14,6 +14,10 @@
#include <folly/dynamic.h>
#endif

#if defined(__APPLE__) && TARGET_OS_IOS
#include "ModalHostViewUtils.h"
#endif
Comment on lines 17 to 19
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can find a way to avoid this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cipolleschi Emm, perhaps we should not share a common ModalHostViewState and instead have separate ModalHostViewStates for different platforms?


namespace facebook::react {

/*
Expand All @@ -23,7 +27,16 @@ class ModalHostViewState final {
public:
using Shared = std::shared_ptr<const ModalHostViewState>;

ModalHostViewState(){};
#if defined(__APPLE__) && TARGET_OS_IOS
static Size getScreenSize() {
auto screenSize = RCTModalHostViewScreenSize();
return {screenSize.width, screenSize.height};
}
ModalHostViewState() : screenSize(getScreenSize()) {
#else
ModalHostViewState(){
#endif
};
ModalHostViewState(Size screenSize_) : screenSize(screenSize_){};

#ifdef ANDROID
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
CGFloat width;
CGFloat height;
} RCTSize;

RCTSize RCTModalHostViewScreenSize(void);

#ifdef __cplusplus
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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.
*/

#import "ModalHostViewUtils.h"
#import <Foundation/Foundation.h>
#import <React/RCTUtils.h>

extern "C" {

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

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

} // namespace facebook::react