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 🙏

© 2024 – Pkg Stats / Ryan Hefner

expo-clear-input

v0.1.94

Published

A cross-platform clear button to use in text inputs for React Native apps built with Expo.

Downloads

56

Readme

This is not an official Expo SDK package.

❎ Expo Clear Input 📝

npm version npm downloads

supports iOS supports Android supports web

A cross-platform clear button to use in a TextInput for React Native apps built with Expo.

📲 Demo

Demo in Expo Snack

🔬 Why This Library?

The TextInput component has a clearButtonMode prop but it only support ios and not android. In addition to that, it only works in single-line mode and not multiline.

This library is a solution to the above by working on any platform (web, ios, android) and in both single and muilti line <TextInput>s.

☑️ Prerequisites

📠 Installation

npm install expo-clear-input

📎 Usage

import React from 'react';
import { StyleSheet, SafeAreaView, View } from 'react-native';
import { ClearControlTextInput } from 'expo-clear-input';

export default function App() {
    const [ text, setText ] = React.useState('');

    return (
        <SafeAreaView style={{ flex: 1, backgroundColor: '#000', alignItems: 'center', justifyContent: 'center', }}>
            <View style={{ marginHorizontal: 20, marginBottom: 20, width: "80%" }}>
            <ClearControlTextInput
                textInputProps={{
                    onChangeText: (text) => setText(text),
                    value: text,
                    placeholder: 'enter search...',
                    returnKeyType: 'done',
                }}
                showButtonMode={'always'}
            />
            </View>
        </SafeAreaView>
    );
}

Supports custom icon for the button or use the default(recommended)

// this is the default icon used
<Octicons name="x-circle-fill" size={16} color="#ccc8c8" />

🎛️ Options

| Prop | Type | Description | Default | | ----------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | | textInputProps | AccessibilityProps & Partial<TextInputProps> | All cross-platform-compatible props from TextInputProps except for style, which is handled by this component | same defaults as <TextInput> | | textColor | string | The color of the text | "#fff" | | backgroundColor | string | The background color of the input field | "#252326" | | verticalPlacement | 'top''center''bottom' | The vertical placement of the input field (always on the right side) | 'center' | | showButtonNode | boolean | Whether to show the button node; always: visible whether or not its in focus. while-editing: visible only when the input is in focus. unless-editing: visible only when the input is not in focus | while-editing | | icon | ReactNode | The icon to be displayed | <Octicons name="x-circle-fill" size={16} color="#ccc8c8" /> |

👥 Contributing

  • Please create your own branch off of main to get started
  • Then develop, build, test, and create a Pull Request to main to trigger a review.

Pre-requisites

  • must be on WSL, Linux, or mac for local development or else you won't be able to run the scripts
  • Node.js version 18 or higher

Development

  • during development of your new code, you may want to have an example app up in parrallel to view your changes in real time.
  • YMMV but the recommended approach to this is to create a local expo project using expo-template-blank-typescript and import your ./src/* files into its App.tsx.
    • Then view your changes in real time.

Test Locally

  • After you've finished your changes, test that the packaged module works as expected.
    • Set up the testing suite with a local package of the module with your changes:
      • run from project root: npm run setuptest
    • once that runs successfuly, start up the test:
      • run from project root: npm run test

Before Submitting a Pull Request

  • No PR will be accepted without a copy of the testing report
  • Please ensure you add new tests if applicable for your new feature.