Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rn-screen-keyboard

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-screen-keyboard

React-Native Screen keyboard implementation

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
increased by87.5%
Maintainers
0
Weekly downloads
 
Created
Source

rn-screen-keyboard

A Customizable On-Screen Keyboard Component for React Native

This React Native component provides a user-friendly on-screen keyboard for various input scenarios. It offers customization options for styling, layout, and behavior, allowing you to tailor it to your specific needs.

Features:

  • Displays a standard numeric keyboard layout (rows 1-3, with 0 and a custom Backspace button in the footer).
  • Supports custom input of characters for flexibility.
  • Provides built-in Backspace functionality for single character deletion.
  • Allows for optional Left, Center, and Right components in the footer for additional features.
  • Includes customizable styling properties for cells, rows, and the overall keyboard.
  • Integrates with React Native's Pressable component for touch handling and optional ripple effects on Android (requires react-native-gesture-handler).

Installation:

npm install rn-screen-keyboard

Usage:

import RNScreenKeyboard from 'rn-screen-keyboard';
import {Text, View} from "react-native"

const MyComponent = () => {
  const [value, setValue] = useState('');

  const handleKeyPress = (data) => {
    setValue(data);
  };

  return (
    <View style={{ flex: 1 }}>
      <Text>{value}</Text>
      <RNScreenKeyboard
        value={value}
        onKeyPress={handleKeyPress}
        // Optional props for customization
        textStyle={{ fontSize: 20 }}
        cellStyle={{ backgroundColor: '#f0f0f0' }}
        BackSpaceComponent={<Text>DEL</Text>} // Custom Backspace component
        footerStyle={{ backgroundColor: '#e0e0e0' }}
        Left={<Text>.</Text>} // Custom left footer button
        Right={<Text>Done</Text>} // Custom right footer button
      />
    </View>
  );
};

Props:

Prop NameTypeDescriptionDefault Value
valuestringThe current value of the input field''
onKeyPress(key: string) => voidFunction to handle key press events-
textStyleobjectStyles applied to the text within each cell{}
cellStyleobjectStyles applied to each individual cell (button){}
rowStyleobjectStyles applied to each row of cells{}
BackSpaceComponentReact.ReactNodeCustom component to display for the Backspace button-
footerStyleobjectStyles applied to the footer container{}
LeftReact.ReactNodeCustom content to display in the left footer cell-
RightReact.ReactNodeCustom content to display in the right footer cell-
CenterReact.ReactNodeCustom content to display in the center footer cell-
backspaceTintstringTint color for the Backspace icon (if not using a custom BackSpaceComponent)'black'
textLengthnumber(Optional) Maximum allowed length of the input string0 (unlimited)
FooterReact.ReactNode(Optional) Custom component to replace the default footer-
rippleboolean(Optional) Enables a ripple effect on touch (Android)true
ripple_colorstring(Optional) Color for the ripple effectdefault_ripple_color (defined in styles)

Customization:

  • You can further customize the appearance and behavior of the keyboard by overriding styles in your own stylesheet. Refer to the styles.js file for available style properties.
  • The ripple prop allows you to enable an optional ripple effect on Android platforms for a more tactile user experience. This requires linking react-native-gesture-handler.

Keywords

FAQs

Package last updated on 31 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc