Skip to content

Rn77 new arch fixes 2 #3772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: v8
Choose a base branch
from
Open
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
10 changes: 1 addition & 9 deletions android/app/src/main/java/com/rnuilib/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,5 @@ class MainApplication : NavigationApplication() {

override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
}

}
2 changes: 1 addition & 1 deletion docs/getting-started/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ These packages are required for basic functionality:
Install these based on the components you plan to use:
```bash
"@react-native-community/blur": ">=4.4.1"
"@react-native-community/datetimepicker": "^3.4.6"
"@react-native-community/datetimepicker": "^8.2.0"
"@react-native-community/netinfo": "^5.6.2" # Required for ConnectionStatusBar
```

Expand Down
68 changes: 34 additions & 34 deletions ios/rnuilib.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
0025F6AE1371A21B7A28048F /* libPods-rnuilib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B8ED5E0C1BDBAE86825D1D25 /* libPods-rnuilib.a */; };
10C29C812DCE637B0050BB15 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 10C29C802DCE637B0050BB15 /* AppDelegate.mm */; };
10C29C832DCE7AE00050BB15 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 10C29C822DCE7AE00050BB15 /* AppDelegate.mm */; };
10C29C852DCE7AED0050BB15 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 10C29C842DCE7AED0050BB15 /* main.m */; };
Expand All @@ -16,7 +17,6 @@
8E8B0D662744D9CD0026B520 /* void.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E8B0D652744D9CD0026B520 /* void.swift */; };
8EA1FC8C2519E7F7008B4B36 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8EA1FC8B2519E7F7008B4B36 /* LaunchScreen.storyboard */; };
BD943D6D9239B59015528C14 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = DED5A85D4BF49DFA47437893 /* PrivacyInfo.xcprivacy */; };
C2BFF53A3D9C89E8C38C119D /* libPods-rnuilib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B1BEF55D1269FAD80AF15FA /* libPods-rnuilib.a */; };
C41C90B146B08809BC045295 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 411699F1CD4A37F8779A4620 /* PrivacyInfo.xcprivacy */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -49,16 +49,16 @@
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = rnuilib/Info.plist; sourceTree = "<group>"; };
2D02E47B1E0B4A5D006451C7 /* rnuilib-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "rnuilib-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2D02E4901E0B4A5D006451C7 /* rnuilib-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "rnuilib-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
3092D044D40F28F133D81A80 /* Pods-rnuilib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-rnuilib.release.xcconfig"; path = "Target Support Files/Pods-rnuilib/Pods-rnuilib.release.xcconfig"; sourceTree = "<group>"; };
3B1BEF55D1269FAD80AF15FA /* libPods-rnuilib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-rnuilib.a"; sourceTree = BUILT_PRODUCTS_DIR; };
411699F1CD4A37F8779A4620 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = rnuilib/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
8E52CBDE2887DD21009D5EC5 /* DesignTokens.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DesignTokens.xcassets; sourceTree = "<group>"; };
8E8B0D652744D9CD0026B520 /* void.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = void.swift; sourceTree = "<group>"; };
8EA1FC8B2519E7F7008B4B36 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = rnuilib/LaunchScreen.storyboard; sourceTree = "<group>"; };
961D3F437C09AAFC776D80CB /* Pods-rnuilib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-rnuilib.debug.xcconfig"; path = "Target Support Files/Pods-rnuilib/Pods-rnuilib.debug.xcconfig"; sourceTree = "<group>"; };
B8ED5E0C1BDBAE86825D1D25 /* libPods-rnuilib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-rnuilib.a"; sourceTree = BUILT_PRODUCTS_DIR; };
DED5A85D4BF49DFA47437893 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = rnuilib/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
F3B5DA6EFA700534B83CFD2F /* Pods-rnuilib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-rnuilib.release.xcconfig"; path = "Target Support Files/Pods-rnuilib/Pods-rnuilib.release.xcconfig"; sourceTree = "<group>"; };
F9327185F12A295616AF2661 /* Pods-rnuilib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-rnuilib.debug.xcconfig"; path = "Target Support Files/Pods-rnuilib/Pods-rnuilib.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -73,7 +73,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C2BFF53A3D9C89E8C38C119D /* libPods-rnuilib.a in Frameworks */,
0025F6AE1371A21B7A28048F /* libPods-rnuilib.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -117,7 +117,7 @@
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
ED2971642150620600B7C4FE /* JavaScriptCore.framework */,
3B1BEF55D1269FAD80AF15FA /* libPods-rnuilib.a */,
B8ED5E0C1BDBAE86825D1D25 /* libPods-rnuilib.a */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -158,8 +158,8 @@
D99C980AB24A05601E0007F9 /* Pods */ = {
isa = PBXGroup;
children = (
961D3F437C09AAFC776D80CB /* Pods-rnuilib.debug.xcconfig */,
3092D044D40F28F133D81A80 /* Pods-rnuilib.release.xcconfig */,
F9327185F12A295616AF2661 /* Pods-rnuilib.debug.xcconfig */,
F3B5DA6EFA700534B83CFD2F /* Pods-rnuilib.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -189,14 +189,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "rnuilib" */;
buildPhases = (
1948831A105FB85C7FF19246 /* [CP] Check Pods Manifest.lock */,
6BCBA2C4A6DF73CFB61A89F8 /* [CP] Check Pods Manifest.lock */,
FD10A7F022414F080027D42C /* Start Packager */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
2304E9EEAAF1BDEF6BC7EBEB /* [CP] Embed Pods Frameworks */,
668BE1E2EE321ADFA49231D6 /* [CP] Copy Pods Resources */,
072B17D178A7108519128960 /* [CP] Embed Pods Frameworks */,
9EAD34A4665B9A7233E02B45 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -345,61 +345,61 @@
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
};
1948831A105FB85C7FF19246 /* [CP] Check Pods Manifest.lock */ = {
072B17D178A7108519128960 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-rnuilib/Pods-rnuilib-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-rnuilib-checkManifestLockResult.txt",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-rnuilib/Pods-rnuilib-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
2304E9EEAAF1BDEF6BC7EBEB /* [CP] Embed Pods Frameworks */ = {
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-rnuilib/Pods-rnuilib-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
name = "Bundle React Native Code And Images";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-rnuilib/Pods-rnuilib-frameworks.sh\"\n";
showEnvVarsInLog = 0;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
};
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
6BCBA2C4A6DF73CFB61A89F8 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
name = "Bundle React Native Code And Images";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-rnuilib-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
668BE1E2EE321ADFA49231D6 /* [CP] Copy Pods Resources */ = {
9EAD34A4665B9A7233E02B45 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -562,7 +562,7 @@
};
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 961D3F437C09AAFC776D80CB /* Pods-rnuilib.debug.xcconfig */;
baseConfigurationReference = F9327185F12A295616AF2661 /* Pods-rnuilib.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -594,7 +594,7 @@
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3092D044D40F28F133D81A80 /* Pods-rnuilib.release.xcconfig */;
baseConfigurationReference = F3B5DA6EFA700534B83CFD2F /* Pods-rnuilib.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
Expand Down
30 changes: 0 additions & 30 deletions ios/rnuilib/AppDelegate.swift

This file was deleted.

41 changes: 24 additions & 17 deletions lib/components/SafeArea/SafeAreaInsetsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
import _ from 'lodash';
import {NativeModules, DeviceEventEmitter} from 'react-native';

type SafeAreaInsetsType = { top: number; left: number; bottom: number; right: number; } | null;
export type SafeAreaInsetsType = {top: number; left: number; bottom: number; right: number} | null;
export type SafeAreaChangedDelegateType = {
onSafeAreaInsetsDidChangeEvent?: (insets: SafeAreaInsetsType) => void;
};

let SafeAreaInsetsCache: SafeAreaInsetsType = null;

class SafeAreaInsetsManager {
_defaultInsets: SafeAreaInsetsType = {top: 47, left: 0, bottom: 34, right: 0}; // Common iPhone safe area values
_safeAreaInsets: SafeAreaInsetsType = {top: 47, left: 0, bottom: 34, right: 0};
_safeAreaChangedDelegates: Array<any> = [];
_safeAreaInsets: SafeAreaInsetsType;
_safeAreaChangedDelegates: Array<SafeAreaChangedDelegateType> = [];
_nativeModule: any = null;

constructor() {
// Initialize with default values
this._safeAreaInsets = this._defaultInsets;

// Try to connect to native module
this.setupNativeConnection();
}
Expand All @@ -25,12 +28,12 @@ class SafeAreaInsetsManager {
try {
// Access the native module directly without causing getConstants
this._nativeModule = NativeModules.SafeAreaManager;
if (this._nativeModule) {

if (this._nativeModule) {
// Set up event listener using DeviceEventEmitter instead of NativeEventEmitter
// This avoids getConstants issues
this.setupEventListener();

// Get initial safe area insets
this.getInitialInsets();
} else {
Expand All @@ -43,8 +46,8 @@ class SafeAreaInsetsManager {

setupEventListener() {
try {
// Use DeviceEventEmitter instead of NativeEventEmitter to avoid getConstants
DeviceEventEmitter.addListener('SafeAreaInsetsDidChangeEvent', (data) => {
// Use DeviceEventEmitter instead of NativeEventEmitter to avoid getConstants
DeviceEventEmitter.addListener('SafeAreaInsetsDidChangeEvent', (data: SafeAreaInsetsType) => {
if (data) {
SafeAreaInsetsCache = data;
this._safeAreaInsets = data;
Expand All @@ -63,7 +66,6 @@ class SafeAreaInsetsManager {

try {
const insets = await this._nativeModule.getSafeAreaInsets();

if (insets) {
SafeAreaInsetsCache = insets;
this._safeAreaInsets = insets;
Expand All @@ -75,7 +77,7 @@ class SafeAreaInsetsManager {
}

notifyDelegates(insets: SafeAreaInsetsType) {
_.forEach(this._safeAreaChangedDelegates, (delegate) => {
_.forEach(this._safeAreaChangedDelegates, (delegate: SafeAreaChangedDelegateType) => {
if (delegate.onSafeAreaInsetsDidChangeEvent) {
delegate.onSafeAreaInsetsDidChangeEvent(insets);
}
Expand All @@ -85,8 +87,13 @@ class SafeAreaInsetsManager {
async _updateInsets() {
if (this._nativeModule && SafeAreaInsetsCache === null) {
try {
SafeAreaInsetsCache = await this._nativeModule.getSafeAreaInsets();
this._safeAreaInsets = SafeAreaInsetsCache;
const insets = await this._nativeModule.getSafeAreaInsets();
if (insets) {
SafeAreaInsetsCache = insets;
this._safeAreaInsets = SafeAreaInsetsCache;
} else {
this._safeAreaInsets = this._defaultInsets;
}
} catch (error) {
console.warn('SafeAreaInsetsManager: Failed to get native insets:', error);
this._safeAreaInsets = this._defaultInsets;
Expand All @@ -103,12 +110,12 @@ class SafeAreaInsetsManager {
return this._safeAreaInsets;
}

addSafeAreaChangedDelegate(delegate: any) {
addSafeAreaChangedDelegate(delegate: SafeAreaChangedDelegateType) {
this._safeAreaChangedDelegates.push(delegate);
}

removeSafeAreaChangedDelegate(delegateToRemove: any) {
_.remove(this._safeAreaChangedDelegates, (currentDelegate) => {
removeSafeAreaChangedDelegate(delegateToRemove: SafeAreaChangedDelegateType) {
_.remove(this._safeAreaChangedDelegates, (currentDelegate: SafeAreaChangedDelegateType) => {
return currentDelegate === delegateToRemove;
});
}
Expand All @@ -122,7 +129,7 @@ class SafeAreaInsetsManager {
const previousInsets = this._safeAreaInsets;
SafeAreaInsetsCache = null; // Force refresh
await this._updateInsets();

// Notify delegates if insets changed
if (!_.isEqual(previousInsets, this._safeAreaInsets)) {
this.notifyDelegates(this._safeAreaInsets);
Expand Down
Loading