-
Notifications
You must be signed in to change notification settings - Fork 16
feat: bump react-native to 0.76.6 on example app #73
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
base: main
Are you sure you want to change the base?
Changes from all commits
27aa3a4
954911d
4d4e591
38bfbb1
cfd6382
0a36f0d
d7dac2b
a258381
e4dfbde
102ac6f
ce7edd2
955edf4
a8e9199
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,20 +19,74 @@ explicit BigNumberCppAdapter() { | |
} | ||
|
||
void install(jsi::Runtime& runtime, std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker) { | ||
auto workerQueue = std::make_shared<margelo::DispatchQueue::dispatch_queue>("Margelo MGBigNumber Thread"); | ||
auto hostObject = std::make_shared<margelo::MGBigNumberHostObject>(jsCallInvoker, workerQueue); | ||
auto object = jsi::Object::createFromHostObject(runtime, hostObject); | ||
runtime.global().setProperty(runtime, "__BigNumberProxy", std::move(object)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am getting a SIGSEGV here, check https://github.com/margelo/react-native-bignumber/blob/a8e9199da407b7cdf36e8b9cb6d557ed0194a22d/example/android/crash-log.txt There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's migrate it to Nitro after we made the RN 76 upgrade. WIth Nitro, we no longer need any of this |
||
try { | ||
if (!jsCallInvoker) { | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "jsCallInvoker is null in install"); | ||
return; | ||
} | ||
|
||
auto workerQueue = std::make_shared<margelo::DispatchQueue::dispatch_queue>("Margelo MGBigNumber Thread"); | ||
if (!workerQueue) { | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "Failed to create worker queue"); | ||
return; | ||
} | ||
|
||
auto hostObject = std::make_shared<margelo::MGBigNumberHostObject>(jsCallInvoker, workerQueue); | ||
|
||
if (!hostObject) { | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "Host object creation failed"); | ||
return; | ||
} | ||
|
||
auto object = jsi::Object::createFromHostObject(runtime, hostObject); | ||
|
||
// try { | ||
// auto propNames = object.getPropertyNames(runtime); | ||
// __android_log_print(ANDROID_LOG_INFO, "BigNumber", "Host object has %d properties", propNames.size(runtime)); | ||
// } catch (const jsi::JSError& e) { | ||
// __android_log_print(ANDROID_LOG_ERROR, "BigNumber", "Error inspecting host object: %s", e.what()); | ||
// return; | ||
// } | ||
|
||
try { | ||
runtime.global().setProperty(runtime, "__BigNumberProxy", std::move(object)); | ||
__android_log_print(ANDROID_LOG_INFO, "BigNumber", "Property set successfully"); | ||
} catch (const jsi::JSError& e) { | ||
jni::throwNewJavaException("java/lang/IllegalStateException", "JSI Error setting property: %s", e.what()); | ||
} catch (const std::exception& e) { | ||
jni::throwNewJavaException("java/lang/IllegalStateException", "Exception setting property: %s", e.what()); | ||
} catch (...) { | ||
jni::throwNewJavaException("java/lang/IllegalStateException", "Unknown exception setting property"); | ||
} | ||
} catch (const std::exception& e) { | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "Exception in install: %s", e.what()); | ||
} catch (...) { | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "Unknown exception in install"); | ||
} | ||
} | ||
|
||
void nativeInstall(jlong jsiPtr, jni::alias_ref<facebook::react::CallInvokerHolder::javaobject> | ||
jsCallInvokerHolder) { | ||
__android_log_print(ANDROID_LOG_INFO, "BigNumber", "nativeInstall called"); | ||
|
||
if (!jsCallInvokerHolder) { | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "jsCallInvokerHolder is null"); | ||
return; | ||
} | ||
|
||
auto jsCallInvoker = jsCallInvokerHolder->cthis()->getCallInvoker(); | ||
if (!jsCallInvoker) { | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "jsCallInvoker is null"); | ||
return; | ||
} | ||
|
||
auto runtime = reinterpret_cast<jsi::Runtime*>(jsiPtr); | ||
if (runtime) { | ||
install(*runtime, jsCallInvoker); | ||
} else { | ||
// if runtime was nullptr, MGBigNumber will not be installed. This should only happen while Remote Debugging (Chrome), but will be weird either way. | ||
__android_log_print(ANDROID_LOG_ERROR, "BigNumber", "Runtime pointer is null"); | ||
} | ||
// if runtime was nullptr, MGBigNumber will not be installed. This should only happen while Remote Debugging (Chrome), but will be weird either way. | ||
} | ||
|
||
static void registerNatives() { | ||
|
@@ -47,7 +101,9 @@ friend HybridBase; | |
}; | ||
|
||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { | ||
__android_log_print(ANDROID_LOG_INFO, "BigNumber", "JNI_OnLoad called"); | ||
return facebook::jni::initialize(vm, [] { | ||
__android_log_print(ANDROID_LOG_INFO, "BigNumber", "Registering natives"); | ||
BigNumberCppAdapter::registerNatives(); | ||
}); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
source 'https://rubygems.org' | ||
|
||
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version | ||
ruby '>= 2.6.10' | ||
|
||
gem 'cocoapods', '>= 1.11.3' | ||
ruby ">= 2.6.10" | ||
|
||
# Exclude problematic versions of cocoapods and activesupport that causes build failures. | ||
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1' | ||
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0' | ||
gem 'xcodeproj', '< 1.26.0' |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch is pulled out from #72, it makes this library compile for RN 76 on Android, but it still does not work for the new architecure.
Seems like the library is not linked properly when fabric is enabled.