Skip to content
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
18 changes: 18 additions & 0 deletions example/src/getTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2585,6 +2585,24 @@ export function getTests(
.didNotThrow()
.equals(true)
),
createTest(
'NitroModules.createHybridObject(...) error names registerAllNatives()',
() =>
it(() => {
try {
NitroModules.createHybridObject('__MissingHybridObjectForTest__')
return false
} catch (error) {
return (
error instanceof Error &&
error.message.includes('registerAllNatives()') &&
!error.message.includes('::registerNatives()')
)
}
})
.didNotThrow()
.equals(true)
),
createTest('NitroModules.isHybridObject(testObject) to be true', () =>
it(() => {
return NitroModules.isHybridObject(testObject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ${createFileMetadataString(`${autolinkingClassName}.hpp`)}

namespace ${cxxNamespace} {

[[deprecated("Use registerNatives() instead.")]]
[[deprecated("Use registerAllNatives() instead.")]]
int initialize(JavaVM* vm);

/**
Expand All @@ -94,7 +94,7 @@ namespace ${cxxNamespace} {
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
* return facebook::jni::initialize(vm, []() {
* // register all ${cppLibName} HybridObjects
* ${cxxNamespace}::registerNatives();
* ${cxxNamespace}::registerAllNatives();
* // any other custom registrations go here.
* });
* }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ std::shared_ptr<HybridObject> HybridObjectRegistry::createHybridObject(const std
"- If you use Nitrogen, make sure your library (*Package.kt)/app (MainApplication.kt) calls "
"`$$androidCxxLibName$$OnLoad.initializeNative()` somewhere on app-startup.\n"
"- If you use Nitrogen, make sure your `cpp-adapter.cpp`/`OnLoad.cpp` calls "
"`margelo::nitro::$$cxxNamespace$$::registerNatives()` inside `facebook::jni::initialize(...)`.\n"
"`margelo::nitro::$$cxxNamespace$$::registerAllNatives()` inside `facebook::jni::initialize(...)`.\n"
"- If you use Nitrogen, inspect the generated `$$androidCxxLibName$$OnLoad.cpp` file.\n"
"- If you don't use Nitrogen, make sure you called `HybridObjectRegistry.registerHybridObject(...)`."
"- All registered HybridObjects: [" +
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace margelo::nitro::test {

[[deprecated("Use registerNatives() instead.")]]
[[deprecated("Use registerAllNatives() instead.")]]
int initialize(JavaVM* vm);

/**
Expand All @@ -23,7 +23,7 @@ namespace margelo::nitro::test {
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
* return facebook::jni::initialize(vm, []() {
* // register all NitroTest HybridObjects
* margelo::nitro::test::registerNatives();
* margelo::nitro::test::registerAllNatives();
* // any other custom registrations go here.
* });
* }
Expand Down
Loading