react-native-picture-selector 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,15 @@ add_library(${CMAKE_PROJECT_NAME} SHARED)
10
10
  # Autolinking cmake handles: find_package, target_sources, target_link_libraries
11
11
  include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroPictureSelector+autolinking.cmake)
12
12
 
13
+ # cpp-adapter.cpp defines JNI_OnLoad — the entry point called by the JVM when
14
+ # System.loadLibrary("NitroPictureSelector") is invoked from Kotlin.
15
+ # It calls facebook::jni::initialize(vm, ...) and then registerAllNatives(),
16
+ # which inserts "PictureSelector" into Nitro's HybridObjectRegistry.
17
+ # Without this file the library loads silently but nothing gets registered.
18
+ target_sources(${CMAKE_PROJECT_NAME} PRIVATE
19
+ src/main/cpp/cpp-adapter.cpp
20
+ )
21
+
13
22
  # Directly link libNitroModules.so from its stable cmake build output path.
14
23
  # The prefab for react-native-nitro-modules is header-only at CMake configure
15
24
  # time (fix-prefab.gradle updates it only after native build), so we link
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// cpp-adapter.cpp
3
+ /// Entry point for the NitroPictureSelector shared library.
4
+ ///
5
+ /// Defines JNI_OnLoad so that when Kotlin calls
6
+ /// System.loadLibrary("NitroPictureSelector")
7
+ /// the JVM invokes this function with the JavaVM*, which:
8
+ /// 1. Initialises fbjni (facebook::jni::initialize)
9
+ /// 2. Calls registerAllNatives() — which registers JNI methods and
10
+ /// inserts "PictureSelector" into Nitro's HybridObjectRegistry.
11
+ ///
12
+ /// Without this entry point System.loadLibrary succeeds silently but
13
+ /// nothing ever gets registered, so every call to
14
+ /// NitroModules.createHybridObject("PictureSelector")
15
+ /// throws "It has not yet been registered in the HybridObjectRegistry".
16
+ ///
17
+
18
+ #include <jni.h>
19
+ #include <fbjni/fbjni.h>
20
+ #include "NitroPictureSelectorOnLoad.hpp"
21
+
22
+ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
23
+ return facebook::jni::initialize(vm, []() {
24
+ margelo::pictureselector::registerAllNatives();
25
+ });
26
+ }
@@ -62,8 +62,9 @@ namespace margelo::pictureselector {
62
62
  void loadHybridMethods() override;
63
63
 
64
64
  protected:
65
- // Tag for logging
66
- static constexpr auto TAG = "HybridPictureSelector";
65
+ // Tag for logging — must match the key used in registerHybridObjectConstructor()
66
+ // and in NitroModules.createHybridObject() on the JS side ("PictureSelector").
67
+ static constexpr auto TAG = "PictureSelector";
67
68
  };
68
69
 
69
70
  } // namespace margelo::pictureselector
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-picture-selector",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "High-performance photo/video picker for React Native using Nitro Modules",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",