npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@4j17h/react-native-phone-number-autofill

v0.1.0

Published

Android-only phone number autofill using deprecated Google Credentials API. Shows Google account phone numbers AND SIM numbers. Even though these APIs are deprecated, they still work in play-services-auth:20.7.0 and provide better UX than the new Phone Nu

Downloads

22

Readme

@4j17h/react-native-phone-number-autofill

Android-only phone number autofill using Google Credentials API. Shows Google account phone numbers AND SIM numbers for better UX.

Why This Library?

Google deprecated the old Credentials API in favor of the new Phone Number Hint API. However:

  • Old Credentials API (This Library): Shows Google account numbers + SIM numbers ✅
  • New Phone Number Hint API: Only shows SIM-based numbers ❌

This library uses the deprecated-but-working Credentials API (like Zomato does) to provide better UX.

Installation

npm install @4j17h/react-native-phone-number-autofill
# or
yarn add @4j17h/react-native-phone-number-autofill

Android Setup

Add to your project's android/build.gradle:

allprojects {
    configurations.all {
        resolutionStrategy {
            force 'com.google.android.gms:play-services-auth:20.7.0'
        }
    }
}

Usage

import { requestPhoneNumber } from '@4j17h/react-native-phone-number-autofill';

const handlePhoneNumberPicker = async () => {
  try {
    const phoneNumber = await requestPhoneNumber();
    console.log('Selected:', phoneNumber); // e.g., "+919876543210"
  } catch (error) {
    console.log('User cancelled or no numbers available');
  }
};

Example

import React, { useState } from 'react';
import { TextInput, Platform } from 'react-native';
import { requestPhoneNumber } from '@4j17h/react-native-phone-number-autofill';

const LoginScreen = () => {
  const [phone, setPhone] = useState('');

  const handleFocus = async () => {
    if (Platform.OS !== 'android') return;
    
    try {
      const number = await requestPhoneNumber();
      setPhone(number?.slice(-10) || ''); // Last 10 digits
    } catch (error) {
      // User cancelled
    }
  };

  return (
    <TextInput
      value={phone}
      onChangeText={setPhone}
      onFocus={handleFocus}
      placeholder="Phone Number"
      keyboardType="phone-pad"
    />
  );
};

API

requestPhoneNumber(): Promise<string>

Shows Google phone number picker (Android only).

Returns: Phone number in E.164 format (e.g., "+919876543210")

Error Codes:

  • ACTIVITY_NULL_ERROR - Activity not available
  • ACTIVITY_RESULT_NOOK_ERROR - User cancelled
  • NO_PHONE_NUMBERS_ERROR - No numbers found
  • SEND_INTENT_ERROR - Failed to show picker
  • IOS_NOT_SUPPORTED - Called on iOS

Platform Support

  • Android (minSdk 24+)
  • iOS (use textContentType="telephoneNumber" instead)

Requirements

  • React Native >= 0.60
  • Android minSdkVersion 24+
  • com.google.android.gms:play-services-auth:20.7.0

Technical Details

Uses deprecated Google Credentials API:

  • com.google.android.gms.auth.api.credentials.CredentialsClient
  • com.google.android.gms.auth.api.credentials.HintRequest

Even though deprecated, these APIs still work in play-services-auth:20.7.0 and provide better UX than the new API.

License

MIT

Credits

Inspired by phone number picker in Zomato and other popular apps.