-
Notifications
You must be signed in to change notification settings - Fork 2
[MOO-2265] - Update deprecated apis #40
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
YogendraShelke
wants to merge
8
commits into
main
Choose a base branch
from
moo/MOO-2265-update-deprecated-apis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2de9294
refactor: replace RedBoxHelper with RCTExceptionsManager for error ha…
YogendraShelke 5be47a7
refactor: implement typed constants spec
YogendraShelke a8e2c86
refactor: update deprecated ReactNativeHost usage to ReactHost across…
YogendraShelke c6e2530
refactor: enhance NativeDownloadModule to support download progress e…
YogendraShelke 54358b3
chore: update MendixNative version to 0.5.1 in Podfile.lock
YogendraShelke 6123968
refactor: update getConstants and getTypedExportedConstants to use nu…
YogendraShelke 908ddc6
refactor: fix tests
YogendraShelke 72bcf30
refactor: increase Node.js memory limit for E2E tests
YogendraShelke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 17 additions & 28 deletions
45
android/src/main/java/com/mendix/mendixnative/react/MxConfiguration.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 36 additions & 2 deletions
38
android/src/main/java/com/mendix/mendixnative/react/NativeErrorHandler.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,47 @@ | ||
| package com.mendix.mendixnative.react | ||
|
|
||
| import com.facebook.common.logging.FLog | ||
| import com.facebook.react.ReactApplication | ||
| import com.facebook.react.bridge.Arguments | ||
| import com.facebook.react.bridge.ReactApplicationContext | ||
| import com.facebook.react.bridge.ReadableArray | ||
| import com.facebook.react.modules.core.ExceptionsManagerModule | ||
| import com.facebook.react.bridge.ReadableMap | ||
| import com.facebook.react.devsupport.StackTraceHelper | ||
|
|
||
| class NativeErrorHandler(val reactContext: ReactApplicationContext) { | ||
| fun handle(message: String?, stackTrace: ReadableArray?) { | ||
| reactContext.nativeModule<ExceptionsManagerModule>(ExceptionsManagerModule.NAME)?.reportSoftException(message, stackTrace, 0.0) | ||
| FLog.e(javaClass, "Received JS exception: $message") | ||
| // In bridgeless mode, use DevSupportManager directly for proper error display | ||
| val reactHost = (reactContext.applicationContext as? ReactApplication)?.reactHost | ||
| reactHost?.devSupportManager?.showNewJSError(message, sanitize(stackTrace), -1) | ||
| } | ||
|
|
||
| /** | ||
| * Filter out invalid stack frames to prevent parsing errors. | ||
| * | ||
| * React Native's StackTraceHelper.convertJsStackTrace() uses requireNotNull() for | ||
| * methodName and file. Invalid frames cause secondary errors that break RedBox and reload. | ||
| * | ||
| * Simply skip frames that don't have the required non-null fields. | ||
| */ | ||
| private fun sanitize(stackTrace: ReadableArray?): ReadableArray { | ||
| val filtered = Arguments.createArray() | ||
| if (stackTrace == null) return filtered | ||
| (0 until stackTrace.size()) | ||
| .mapNotNull { stackTrace.getMap(it) } | ||
| .filter { isValidFrame(it) } | ||
| .forEach { filtered.pushMap(it) } | ||
|
|
||
| return filtered | ||
| } | ||
|
|
||
| /** | ||
| * Check if a stack frame has the required non-null fields for StackTraceHelper. | ||
| * Uses React Native's own key constants to match their validation logic. | ||
| */ | ||
| private fun isValidFrame(frame: ReadableMap): Boolean { | ||
| return arrayOf(StackTraceHelper.FILE_KEY, StackTraceHelper.METHOD_NAME_KEY).all { | ||
| frame.hasKey(it) && !frame.isNull(it) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.