rn-code-input
Advanced tools
Comparing version 0.0.3 to 0.0.4
import React from "react"; | ||
import { RNCodeInputProps } from "./types"; | ||
declare const RnCodeInput: ({ onChange, value, length, showSoftInputOnFocus, style, ...props }: RNCodeInputProps) => React.JSX.Element; | ||
declare const RnCodeInput: ({ onChange, value, length, showSoftInputOnFocus, style, inputProps, ...props }: RNCodeInputProps) => React.JSX.Element; | ||
export default RnCodeInput; |
import React from "react"; | ||
import { TextInput, View, Text } from "react-native"; | ||
import styles from "./style"; | ||
const RnCodeInput = ({ onChange, value, length = 6, showSoftInputOnFocus = false, style, ...props }) => { | ||
const RnCodeInput = ({ onChange, value, length = 6, showSoftInputOnFocus = false, style, inputProps, ...props }) => { | ||
const getValue = React.useCallback((index) => value[index] || "", [value]); | ||
return (React.createElement(View, { style: [styles.container, style] }, | ||
Array.from({ length }).map((_, index) => (React.createElement(CodeBox, { key: index, index: index, value: getValue(index), values: value, ...props }))), | ||
React.createElement(TextInput, { keyboardType: "number-pad", style: styles.input, showSoftInputOnFocus: showSoftInputOnFocus, onChangeText: onChange, value: value, maxLength: length }))); | ||
React.createElement(TextInput, { keyboardType: "number-pad", style: styles.input, showSoftInputOnFocus: showSoftInputOnFocus, onChangeText: onChange, value: value, maxLength: length, ...inputProps }))); | ||
}; | ||
@@ -10,0 +10,0 @@ export default RnCodeInput; |
@@ -1,2 +0,2 @@ | ||
import { TextStyle, ViewStyle } from "react-native"; | ||
import { TextInputProps, TextStyle, ViewStyle } from "react-native"; | ||
export interface RNCodeInputProps { | ||
@@ -15,2 +15,3 @@ value: string; | ||
style?: ViewStyle; | ||
inputProps?: Partial<Omit<TextInputProps, "onChange" | "value" | "maxLength">>; | ||
} | ||
@@ -17,0 +18,0 @@ export interface CodeBoxProps extends Partial<RNCodeInputProps> { |
{ | ||
"name": "rn-code-input", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "React-Native Code input implementation", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16239
238