Skip to content

Conversation

Copy link

Copilot AI commented Oct 28, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>NativeModules.SensitiveInfo is null — missing RCT_EXTERN_MODULE export in Swift bridge (v5.6.0)</issue_title>
<issue_description>It seems that the iOS native module for react-native-sensitive-info is not being correctly exposed to the React Native bridge in version 5.6.0.

In the library index.ts:

import { NativeModules } from 'react-native';

function getNativeModule() {
  try {
    return NativeModules.SensitiveInfo;
  } catch {
    return null;
  }
}

NativeModules.SensitiveInfo is always null, which suggests the native side is not being properly exported to the bridge.

⚙️ Technical Details

React Native version: 0.82

react-native-sensitive-info version: 5.6.0

🔥 Actual Behavior

Everything appears to work correctly at build time and runtime — there are no compilation errors and no crashes. However, the data store does not persist any data because the library falls back to a non-native implementation.
This happens since NativeModules.SensitiveInfo is null, and the fallback logic is triggered instead of using the native keychain/secure storage.

🧠 What I Found

In recent React Native versions, Swift-based modules must include an Objective-C file that explicitly declares the module using the RCT_EXTERN_MODULE macro.
For example:

#import <React/RCTBridgeModule.h>

@interface RCT_EXTERN_MODULE(SensitiveInfo, NSObject)
@end

Without this declaration, the Swift class won’t be registered with the React Native bridge, resulting in NativeModules.SensitiveInfo being undefined or null.

After inspecting the react-native-sensitive-info iOS sources, it looks like such a file (e.g. SensitiveInfo.m) is missing — which could explain the issue.

🧪 Steps to Reproduce

Install [email protected]

Run pod install inside the ios directory

Build the iOS app

Try to access NativeModules.SensitiveInfo in JS — it returns null

✅ Expected Behavior

NativeModules.SensitiveInfo should return a valid native module instance, exposing the expected methods (e.g., getItem, setItem, etc.).</issue_description>

Comments on the Issue (you are @copilot in this section)

@mCodex @gbettinazzi thanks for you PR. I'll check it soon 😄

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NativeModules.SensitiveInfo is null — missing RCT_EXTERN_MODULE export in Swift bridge (v5.6.0)

2 participants