Skip to content

feat(mobile): implement NFC tag writing support to share DevCards#348

Open
JavaProgswing wants to merge 1 commit into
Dev-Card:mainfrom
JavaProgswing:feat/mobile-nfc-tag-writing
Open

feat(mobile): implement NFC tag writing support to share DevCards#348
JavaProgswing wants to merge 1 commit into
Dev-Card:mainfrom
JavaProgswing:feat/mobile-nfc-tag-writing

Conversation

@JavaProgswing
Copy link
Copy Markdown

Description

This PR introduces the ability to write a DevCard profile link directly to a physical NFC tag, enabling a seamless one-tap sharing experience on the mobile app.

Fixes #347

Changes Included

  • Dependencies: Added react-native-nfc-manager to @devcard/mobile to handle cross-platform NFC interactions.
  • Permissions: Configured necessary NFC permissions for both iOS (NFCReaderUsageDescription in Info.plist) and Android (android.permission.NFC in AndroidManifest.xml).
  • UI & Functionality:
    • Added a "Physical Cards" section to the SettingsScreen.
    • Added a "Write to NFC Card" button that securely fetches the user's NDEF URI payload from the existing /api/nfc/payload backend endpoint.
    • Interfaced with NfcManager to write the fetched URI record securely to a scanned physical NFC tag.

Testing Instructions

  1. Run pnpm install from the repository root to ensure the new react-native-nfc-manager dependency is linked.
  2. Ensure you have physical devices connected, as NFC emulation does not behave reliably on standard simulators.
  3. Build and run the app on Android (pnpm --filter @devcard/mobile run android) or iOS (pnpm --filter @devcard/mobile run ios).
  4. Navigate to the Settings screen.
  5. Tap "Write to NFC Card" under the "Physical Cards" section.
  6. Hold your device near a writable NFC tag when prompted.
  7. Verify that tapping the successfully written NFC tag with any smartphone opens the DevCard profile in the default web browser.

Copilot AI review requested due to automatic review settings May 26, 2026 15:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adds NFC writing support in the mobile app, allowing users to write a “DevCard” link from Settings to an NFC tag/card, along with the required platform configuration.

Changes:

  • Adds NFC write flow in SettingsScreen (fetch payload, request NDEF tech, write tag).
  • Introduces react-native-nfc-manager dependency for NFC support.
  • Updates iOS Info.plist and adds an Android manifest with NFC permission/feature flags.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
apps/mobile/src/screens/SettingsScreen.tsx Adds UI + async logic to fetch an NFC payload and write it to an NDEF tag.
apps/mobile/package.json Adds react-native-nfc-manager dependency.
apps/mobile/ios/DevCard/Info.plist Adds NFC usage description required for iOS permission prompt.
apps/mobile/android/app/src/main/AndroidManifest.xml Adds Android NFC permission/feature declarations and app/activity manifest.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +70 to +72
NfcManager.cancelTechnologyRequest();
setWritingNfc(false);
}
Comment on lines +1 to +4
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="false" />
Comment on lines +58 to +65
const bytes = Ndef.encodeMessage([
Ndef.uriRecord(data.payload),
]);

if (bytes) {
await NfcManager.ndefHandler.writeNdefMessage(bytes);
Alert.alert('Success', 'Successfully wrote DevCard to NFC tag!');
}
Comment on lines +168 to +179
<TouchableOpacity
style={styles.settingRow}
onPress={writeNfcTag}
disabled={writingNfc}>
<View style={styles.settingRowLeft}>
<Text style={styles.settingRowIcon}>💳</Text>
<Text style={styles.settingRowText}>
{writingNfc ? 'Writing to NFC...' : 'Write to NFC Card'}
</Text>
</View>
<Text style={styles.settingRowArrow}>→</Text>
</TouchableOpacity>
@Harxhit Harxhit added the gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. label May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][Mobile] Implement NFC Tag Writing Support to share DevCards

3 participants