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

react-native-auto-grow-textinput

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-auto-grow-textinput - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"name": "react-native-auto-grow-textinput",
"version": "1.0.0",
"version": "1.1.0",
"description": "This component allows to create auto grow text input for both platforms (iOS and Android).",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,4 +0,2 @@

/**
* @flow
*/
// @flow

@@ -17,2 +15,3 @@ import React, { Component } from 'react';

onResized?: () => void;
value: ?string;
};

@@ -22,6 +21,6 @@

limit: ?number;
text: string;
height: number;
};
export default class AutoGrowTextInput extends React.Component {

@@ -42,3 +41,2 @@ props: Props;

limit,
text: '',
height: 30,

@@ -52,3 +50,3 @@ };

const textInputStyle = {
height: this.state.height,
height: this.state.height
};

@@ -64,16 +62,3 @@

underlineColorAndroid='transparent'
onChange={ (event) => {
const { contentSize } = event.nativeEvent;
const allowResized = this.state.height !== contentSize.height;
const height = this._calcHeight(contentSize.height);
this.setState({
text: event.nativeEvent.text,
height,
});
if (allowResized && this.props.onResized) {
this.props.onResized();
}
}}
onContentSizeChange={ this._onContentSizeChange }
style={[ externalStyle, textInputStyle ]}

@@ -84,16 +69,16 @@ />

_calcHeight(actualHeight: number): number {
let result;
_onContentSizeChange = (event) => {
const { contentSize } = event.nativeEvent;
const height = _calcHeight(contentSize.height, this.state.limit);
if (this.state.limit) {
result = this.state.limit > actualHeight
? actualHeight
: this.state.limit;
if (height === this.state.height) {
return;
}
else {
result = Math.max(30, actualHeight);
}
this.setState({ height });
this.props.onResized && this.props.onResized();
}
return result;
}
};
const _calcHeight = (actualHeight: number, limit:? number) =>
limit ? Math.min(limit, actualHeight): Math.max(30, actualHeight);
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