@mauur/components
Style-agnostic React Native contact input and pure contact helpers, shared across mauurda projects (pergy, takehub).
Install
npm install @mauur/components
react and react-native are peer dependencies.
API
Pure helpers (no React):
detectInputType(text) → "email" | "phone" | "undetermined"
formatPhoneNumber(text, country?, previousText?) — as-you-type formatting (default country "US")
validatePhone(phone, country?)
toE164(phone, country?) → E.164 string or null
validateEmail(email)
formatPhoneForDisplay(phone) — national format for display
normalizeToE164(phone) — server-friendly E.164 normalizer with naive fallback
Component:
<ContactField /> — a TextInput that formats phone numbers as you type and reports the detected input type. Styling is the caller's.
import { ContactField } from "@mauur/components";
<ContactField
value={value}
onChangeText={setValue}
onDetectType={(type) => console.log(type)}
placeholder="Phone or email"
/>;