Skip to content

Conversation

@transphorm
Copy link
Member

@transphorm transphorm commented Jan 7, 2026

Motivation

  • Consolidate bottom-safe-area handling by using the widely-adopted react-native-safe-area-context API instead of the custom useSafeBottomPadding hook.
  • Remove a small, device-height-based heuristic hook to reduce duplication and simplify SDK surface area.
  • Ensure app screens and SDK flows compute bottom padding consistently with system safe areas.
  • Keep the SDK build and test configurations consistent with the removal of the hook export.

Description

  • Replaced imports/usages of useSafeBottomPadding with useSafeAreaInsets and the pattern const { bottom } = useSafeAreaInsets(); const padding = bottom + ... in app screens and SDK flow (app/src/..., packages/mobile-sdk-alpha/src/flows/onboarding/confirm-identification.tsx).
  • Deleted the hook implementation and its index export: packages/mobile-sdk-alpha/src/hooks/useSafeBottomPadding.ts and packages/mobile-sdk-alpha/src/hooks/index.ts were removed.
  • Removed the hook entries from the SDK build entries and exports (packages/mobile-sdk-alpha/tsup.config.ts and packages/mobile-sdk-alpha/package.json) and added react-native-safe-area-context to the SDK peerDependencies and dependencies list as appropriate.
  • Cleaned up app test mapping for the removed hooks path in app/jest.config.cjs and added react-native-safe-area-context to the SDK externals in tsup.config.ts so bundling treats it correctly.

Testing

  • No automated tests were run as part of this change in this environment.
  • Recommended validation before merge: run yarn nice, yarn types, yarn test and yarn build across affected workspaces, and let CI run its full pipeline (including E2E where applicable).
  • The changes are limited to imports/usage and build/export configuration to minimize runtime risk; CI type-check and test runs are expected to catch any remaining issues.
  • If publishing the SDK, run the package validation steps: yarn build and yarn validate:exports.

Codex Task

Summary by CodeRabbit

Release Notes

  • Refactor
    • Updated bottom padding calculations across multiple screens to use device-aware safe area insets instead of custom helpers.
    • Improved compatibility with devices featuring notches, home indicators, and other display variations.
    • Modernized safe area handling implementation to leverage platform-standard approaches for more consistent and reliable spacing behavior throughout the application.

✏️ Tip: You can customize this high-level summary in your review settings.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR removes the custom useSafeBottomPadding hook from the mobile-sdk-alpha package and replaces all usages with useSafeAreaInsets from the standard react-native-safe-area-context library. Package exports, Jest mappings, and build configuration are updated accordingly.

Changes

Cohort / File(s) Summary
Hook Removal & Package Configuration
packages/mobile-sdk-alpha/src/hooks/useSafeBottomPadding.ts, packages/mobile-sdk-alpha/src/hooks/index.ts
Deleted custom useSafeBottomPadding hook (34 lines) and its barrel export.
Package Metadata
packages/mobile-sdk-alpha/package.json
Removed exports for ./hooks and ./hooks/useSafeBottomPadding; added react-native-safe-area-context ^5.6.1 as dependency and peer dependency.
Build Configuration
packages/mobile-sdk-alpha/tsup.config.ts
Removed hooks/index and hooks/useSafeBottomPadding from entry points; externalized react-native-safe-area-context.
App Screen Updates
app/src/screens/dev/DevSettingsScreen.tsx, app/src/screens/home/HomeScreen.tsx, app/src/screens/documents/aadhaar/AadhaarUploadErrorScreen.tsx, app/src/screens/documents/aadhaar/AadhaarUploadScreen.tsx, app/src/screens/documents/aadhaar/AadhaarUploadedSuccessScreen.tsx
Replaced useSafeBottomPadding(x) with useSafeAreaInsets().bottom + x across all 5 screens.
SDK Flow Update
packages/mobile-sdk-alpha/src/flows/onboarding/confirm-identification.tsx
Replaced useSafeBottomPadding(20) with useSafeAreaInsets().bottom + 20 for BottomSection padding.
Jest Configuration
app/jest.config.cjs
Removed moduleNameMapper alias for @selfxyz/mobile-sdk-alpha/hooks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

The changes follow a consistent, repetitive pattern across multiple files—straightforward hook replacement with clear intent. Homogeneous edits minimizing per-file reasoning overhead, though spread across 11 files requires verification that all usages are correctly migrated.

Possibly related PRs

  • #1359 — Directly modifies the same hooks exports and SDK entries that are being removed in this PR.
  • #1348 — Modifies confirm-identification.tsx to adjust bottom padding logic in the same component.
  • #1508 — Replaces custom safe-area hooks with react-native-safe-area-context across the codebase.

Suggested reviewers

  • aaronmgdr

Poem

A custom hook bids its farewell, 📦
Replaced by the standard way—
useSafeAreaInsets now will tell,
Where safe edges play. ✨

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e01b3c and 471bb9d.

📒 Files selected for processing (11)
  • app/jest.config.cjs
  • app/src/screens/dev/DevSettingsScreen.tsx
  • app/src/screens/documents/aadhaar/AadhaarUploadErrorScreen.tsx
  • app/src/screens/documents/aadhaar/AadhaarUploadScreen.tsx
  • app/src/screens/documents/aadhaar/AadhaarUploadedSuccessScreen.tsx
  • app/src/screens/home/HomeScreen.tsx
  • packages/mobile-sdk-alpha/package.json
  • packages/mobile-sdk-alpha/src/flows/onboarding/confirm-identification.tsx
  • packages/mobile-sdk-alpha/src/hooks/index.ts
  • packages/mobile-sdk-alpha/src/hooks/useSafeBottomPadding.ts
  • packages/mobile-sdk-alpha/tsup.config.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@transphorm transphorm closed this Jan 7, 2026
@transphorm transphorm deleted the codex/update-imports-for-safe-area-insets branch January 14, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants