7

A Virutal Screen keyboard implementation for React-Native

 2 years ago
source link: https://reactnativeexample.com/a-virutal-screen-keyboard-implementation-for-react-native/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Keyboard

A Virutal Screen keyboard implementation for React-Native

Sep 18, 2022 1 min read

React Native Screen Keyboard

demo.gif

React Native Screen Keyboard is a virutal screen keyboard implementation for React Native. It is fully customizable, the last row of the keys can be completely customized or changed to fit perfectly with your projects.

It support’s Expo

Installation

npm i rnscreenkeyboard
yarn add rnscreenkeyboard

Example

import React from "react";
import { StyleSheet, TextInput, View } from "react-native";
import RNScreenKeyboard from "rnscreenkeyboard";

export default function App() {
  const [value, setValue] = React.useState<string>("");
  return (
    <View style={styles.container}>
      <TextInput value={value} style={styles.input} />
      <RNScreenKeyboard
        textStyle={{ color: "gray" }}
        backspaceTint={"gray"}
        cellStyle={{
          borderRadius: 100,
          backgroundColor: "lightblue",
          margin: 5,
        }}
        value={value}
        onKeyPress={(val: string) => setValue(val)}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
  },
  input: {
    padding: 10,
    backgroundColor: "#ddd",
    width: "50%",
    borderRadius: 20,
    fontSize: 20,
    letterSpacing: 20,
    textAlign: "center",
  },
});

example.jpg

Props

Name Type Default Description
cellStyle ViewStyle
textStyle TextStyle
rowStyle ViewStyle
onKeyPress func
backspaceTint string black
BackSpaceComponent React.ReactNode backspace image
Left React.ReactNode
Center React.ReactNode
Right React.ReactNode

License

MIT License

Copyright (c) 2022 Usman Hassan

GitHub

View Github


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK