@teo-garcia/react-native-shared
v0.1.2
Published
Shared React Native and Expo helpers for the teo-garcia template portfolio
Downloads
260
Maintainers
Readme
@teo-garcia/react-native-shared
Shared React Native and Expo helpers for the teo-garcia template portfolio
Part of the @teo-garcia/templates ecosystem
Overview
This package is the mobile companion to @teo-garcia/react-shared. It keeps the
same category mindset, but only for React Native and Expo-friendly helpers.
It is intentionally adapter-based:
- platform helpers for native vs web detection and platform snapshots
- storage adapters plus persistent state hooks
- theme adapters plus mode resolution hooks
- debug hooks and native-friendly debug components
It does not try to mirror browser-only primitives like DOM portals, focus traps, or Tailwind-specific class merging.
Category Parity
| Category | react-shared examples | react-native-shared direction |
| -------- | ------------------------------------ | -------------------------------------------- |
| Platform | browser checks, SSR guards | native/web detection, platform snapshots |
| Storage | localStorage, sessionStorage | storage adapters, namespacing, persistence |
| Theme | color-scheme, media-query helpers | theme mode normalization, system resolution |
| Dev | DebugJSON, DevPanel, debug hooks | native debug cards, overlays, render tracing |
| Testing | web test wrappers | native test wrappers when needed |
The first four categories now have real APIs. Testing stays intentionally lightweight for now.
Exports
| Export | Description |
| -------------------------------------------- | ---------------- |
| @teo-garcia/react-native-shared | Package root |
| @teo-garcia/react-native-shared/components | Debug components |
| @teo-garcia/react-native-shared/dev | Debug hooks |
| @teo-garcia/react-native-shared/platform | Platform helpers |
| @teo-garcia/react-native-shared/storage | Storage helpers |
| @teo-garcia/react-native-shared/theme | Theme helpers |
Included APIs
Platform
normalizePlatformresolvePlatformFamilycreatePlatformInfoisWebPlatformisNativePlatformisMobilePlatform
Storage
createStorageKeycreateStorageKeyFromSegmentscreateMemoryStorageAdaptercreatePrefixedStorageAdapteruseStorageValuejsonStorageSerializerstringStorageSerializer
Theme
normalizeThemeModeresolveThemeModecreateMemoryThemeSystemuseThemeModeDEFAULT_THEME_STORAGE_KEY
Components
DebugJSONDevPanel
Dev Hooks
useRenderCountuseWhyDidYouRender
What Belongs Here
- React Native and Expo helpers that are useful across mobile templates
- Shared platform logic that can feed future native hooks and components
- Lightweight utilities that complement
@teo-garcia/react-shared - Adapter-based primitives that can be wired to Expo or app-specific storage
What Does Not Belong Here
- Browser-only DOM primitives
- Tailwind-specific class merging utilities
- Web-only hooks that depend on
window,document, orlocalStorage - General purpose language helpers that belong in
ts-core
License
MIT
