Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
rn-code-input
Advanced tools
This package provides a React Native component for creating a secure and customizable code input field. It allows users to enter a series of digits or characters and provides visual feedback as they type.
activeBoxStyle
, inActiveBoxStyle
, textStyle
, and boxStyle
.length
prop.showSoftInputOnFocus
prop.npm install rn-code-input
or
yarn add rn-code-input
Import the RNCodeInput
component in your React Native project:
import RNCodeInput from "rn-code-input";
Basic Usage:
import React, { useState } from "react";
import { View } from "react-native";
import RNCodeInput from "rn-code-input";
const App = () => {
const [value, setValue] = useState("");
const handleChange = (text) => setValue(text);
return (
<View>
<RNCodeInput value={value} length={6} onChange={handleChange} />
</View>
);
};
export default App;
RNCodeInput Props:
value
: (string) - The current entered code.onChange
: (function) - Callback function triggered when the code changes.length
: (number) - (Optional) The desired number of code boxes (default: 6).hide
: (boolean) - (Optional) Whether to display a mask over the entered characters (default: false).showSoftInputOnFocus
: (boolean) - (Optional) Whether to show the soft keyboard automatically when the component receives focus (default: false).activeBoxStyle
: (ViewStyle) - (Optional) Styles applied to the active code box (e.g., when focused).inActiveBoxStyle
: (ViewStyle) - (Optional) Styles applied to inactive code boxes.mask
: (string) - (Optional) The character to display as a mask for entered characters (default: ●).textStyle
: (TextStyle) - (Optional) Styles applied to the text displayed within the code boxes.boxStyle
: (ViewStyle) - (Optional) Styles applied to individual code boxes.style
: (ViewStyle) - (Optional) Styles applied to the overall container view.CodeBox Props: (These props are passed internally and not intended for direct use)
value
: (string) - The character entered in this specific code box.values
: (string) - The entire entered code value.index
: (number) - The index of this specific code box within the group.hide
: (boolean) - Whether to display a mask in this code box.activeBoxStyle
: (ViewStyle) - Styles applied to the active code box.inActiveBoxStyle
: (ViewStyle) - Styles applied to the inactive code box.filledBoxStyle
: (ViewStyle) - Styles applied to the filled boxes.mask
: (string) - The character to display as a mask.textStyle
: (TextStyle) - Styles applied to the text displayed within the code box.boxStyle
: (ViewStyle) - Styles applied to this specific code box.This example demonstrates a basic code input with a custom active box style:
import React, { useState } from "react";
import { View } from "react-native";
import RNCodeInput from "rn-code-input";
const App = () => {
const [value, setValue] = useState("");
const handleChange = (text) => setValue(text);
return (
<View>
<RNCodeInput
value={value}
length={5}
onChange={handleChange}
activeBoxStyle={{ borderColor: "red" }}
inActiveBoxStyle={{ borderColor: "gray" }}
filledBoxStyle={{ borderColor: "green" }}
boxStyle={{ borderRadius: 99, marginHorizontal: 5 }}
hide
/>
</View>
);
};
export default App;
Feel free to submit pull requests for bug fixes or improvements to this package.
FAQs
React-Native Code input implementation
The npm package rn-code-input receives a total of 3 weekly downloads. As such, rn-code-input popularity was classified as not popular.
We found that rn-code-input demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.