@acusti/input-text
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -33,3 +33,5 @@ import * as React from 'react'; | ||
}; | ||
declare const InputText: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>; | ||
declare const InputText: React.ForwardRefExoticComponent< | ||
Props & React.RefAttributes<HTMLInputElement> | ||
>; | ||
export default InputText; |
@@ -21,5 +21,9 @@ import * as React from 'react'; | ||
const input = inputRef.current; | ||
if (!multiLine || !input) | ||
if (!input) | ||
return; | ||
input.style.height = ''; | ||
if (input.style.height) { | ||
input.style.height = ''; | ||
} | ||
if (!multiLine) | ||
return; | ||
const height = Math.min(input.scrollHeight, typeof maxHeight === 'string' ? parseFloat(maxHeight) : maxHeight); | ||
@@ -29,3 +33,3 @@ input.style.height = `${height}px`; | ||
// Initialize input height in useEffect | ||
useEffect(setInputHeight, []); | ||
useEffect(setInputHeight, [setInputHeight]); | ||
// NOTE Selecting the contents of the input onFocus makes for the best UX, | ||
@@ -32,0 +36,0 @@ // but it doesn’t work in Safari, so we use the initial onSelect event instead |
{ | ||
"name": "@acusti/input-text", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "React component that renders a semi-controlled input with multiLine and selectTextOnFocus support", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
17196
253