From 97f8d681fb733461d6c4002f5e93e934295980a1 Mon Sep 17 00:00:00 2001 From: ardijax Date: Thu, 19 May 2016 06:56:40 +0700 Subject: [PATCH 1/6] Re-calculate underline width if layout changed --- lib/Underline.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Underline.js b/lib/Underline.js index 1651edd..7ad853a 100644 --- a/lib/Underline.js +++ b/lib/Underline.js @@ -47,6 +47,13 @@ export default class Underline extends Component { } = this.props; return ( { + const measuredWidth = event.nativeEvent.layout.width; + if (!measuredWidth) { + return; + } + this.wrapperWidth = measuredWidth; + }} style={[styles.underlineWrapper, { backgroundColor: borderColor }]} From d7914b52d2f9d857456b0eafbae7f86761bc4800 Mon Sep 17 00:00:00 2001 From: ardijax Date: Thu, 19 May 2016 09:25:56 +0700 Subject: [PATCH 2/6] change input width to 40 Affect on Android 5+ --- lib/TextField.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/TextField.js b/lib/TextField.js index 4f25809..9063534 100644 --- a/lib/TextField.js +++ b/lib/TextField.js @@ -118,7 +118,7 @@ const styles = StyleSheet.create({ }, textInput: { fontSize: 16, - height: 34, + height: 40, lineHeight: 34 }, denseTextInput: { From 70f1d5ddad3413d3a91a724e70e563d78050ccfe Mon Sep 17 00:00:00 2001 From: ajaxangular Date: Thu, 19 May 2016 10:04:10 +0700 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71b4c6d..77e3750 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ React Native TextInput styled with Material Design. ## Installation ``` -npm install react-native-md-textinput +npm install https://github.com/ajaxangular/react-native-md-textinput --save ``` ## Usage From 9597824c38fb87ba048734463303f8d41636eda7 Mon Sep 17 00:00:00 2001 From: ardijax Date: Mon, 25 Jul 2016 14:07:04 +0700 Subject: [PATCH 4/6] Customize to combine with tcomb lib --- lib/TextField.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/TextField.js b/lib/TextField.js index 9063534..18c3d5c 100644 --- a/lib/TextField.js +++ b/lib/TextField.js @@ -111,8 +111,8 @@ const styles = StyleSheet.create({ position: 'relative' }, denseWrapper: { - height: 60, - paddingTop: 28, + height: 40, + paddingTop: 30, paddingBottom: 4, position: 'relative' }, @@ -123,7 +123,7 @@ const styles = StyleSheet.create({ }, denseTextInput: { fontSize: 13, - height: 27, + height: 37, lineHeight: 24, paddingBottom: 3 } From d10136190d0d5add3acda97a80d615f231fd35c6 Mon Sep 17 00:00:00 2001 From: ardijax Date: Thu, 1 Sep 2016 08:57:18 +0700 Subject: [PATCH 5/6] Separate react from react-native --- lib/FloatingLabel.js | 5 ++--- lib/TextField.js | 5 ++--- lib/Underline.js | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/FloatingLabel.js b/lib/FloatingLabel.js index 4d06928..d1689c0 100644 --- a/lib/FloatingLabel.js +++ b/lib/FloatingLabel.js @@ -2,10 +2,9 @@ /* @flow */ import React, { - Component, + Component, PropTypes } from 'react'; import { StyleSheet, - Animated, - PropTypes + Animated } from 'react-native'; export default class FloatingLabel extends Component { diff --git a/lib/TextField.js b/lib/TextField.js index 18c3d5c..4c484fc 100644 --- a/lib/TextField.js +++ b/lib/TextField.js @@ -2,11 +2,10 @@ /* @flow */ import React, { - Component, + Component, PropTypes } from 'react'; import { View, TextInput, - StyleSheet, - PropTypes + StyleSheet } from 'react-native'; import Underline from './Underline'; diff --git a/lib/Underline.js b/lib/Underline.js index 7ad853a..4e34965 100644 --- a/lib/Underline.js +++ b/lib/Underline.js @@ -2,11 +2,10 @@ /* @flow */ import React, { - Component, + Component, PropTypes } from 'react'; import { View, StyleSheet, - Animated, - PropTypes + Animated } from 'react-native'; export default class Underline extends Component { From 3839a9bd0c65f6bd0b44f6f4d5deb337aec2368c Mon Sep 17 00:00:00 2001 From: ardijax Date: Thu, 27 Oct 2016 16:05:26 +0700 Subject: [PATCH 6/6] tcomb need this fix update bistip job filter @ardi : tolong react-native-md-textinputnya di update, soalnya ada bug. tambahin metode ini di lib text inputnya, ini penyebab value nggak berubah walau sudah di update lewat state --- lib/TextField.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/TextField.js b/lib/TextField.js index 4c484fc..ee8663a 100644 --- a/lib/TextField.js +++ b/lib/TextField.js @@ -19,6 +19,19 @@ export default class TextField extends Component { text: props.value }; } + + componentWillReceiveProps(nextProps: Object){ + if(this.props.text !== nextProps.value){ + nextProps.value.length !== 0 ? + this.refs.floatingLabel.floatLabel() + : this.refs.floatingLabel.sinkLabel(); + this.setState({text: nextProps.value}); + } + if(this.props.height !== nextProps.height){ + this.setState({height: nextProps.height}); + } + } + focus() { this.refs.input.focus(); }