Skip to content
This repository was archived by the owner on Mar 10, 2023. It is now read-only.

Commit cea9d8d

Browse files
committed
Removed autoResize
removed autoResize prop following this: facebook/react-native@dabb78b
1 parent 1f5334f commit cea9d8d

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

components/CellInput.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,27 @@ const OFFSET = theme.value(10, 4);
1515

1616
class CellInput extends React.Component {
1717
static defaultProps = {
18-
rows: 1,
19-
minRows: 1
18+
rows: 1
2019
}
2120

2221
static propTypes = {
2322
...TextInput.propTypes,
24-
rows: PropTypes.number,
25-
minRows: PropTypes.number
23+
rows: PropTypes.number
2624
}
2725

2826
constructor(props) {
2927
super(props);
28+
29+
let height = BASE_HEIGHT;
30+
31+
// autorize is not yet supported in android (?)
32+
if (this.props.multiline) {
33+
height = Math.max(BASE_HEIGHT * this.props.rows, BASE_HEIGHT);
34+
}
35+
36+
this.state = {
37+
height
38+
}
3039
}
3140

3241
setNativeProps(props) {
@@ -49,12 +58,9 @@ class CellInput extends React.Component {
4958
selectionColor={theme.color.info}
5059
placeholderTextColor={this.props.placeholderTextColor || theme.color.muted}
5160
autoCapitalize="sentences"
52-
autoGrow
5361
{...this.props}
54-
style={[ styles.textInput, {
55-
minHeight: Math.max(BASE_HEIGHT + OFFSET, BASE_HEIGHT * this.props.minRows),
56-
maxHeight: Math.max(BASE_HEIGHT * this.props.rows, BASE_HEIGHT * this.props.minRows)
57-
}]}
62+
style={[ styles.textInput, { height: this.state.height + OFFSET } ]}
63+
onContentSizeChange={this.handleOnContentSizeChange}
5864
placeholder={this.props.multiline === true ? this.props.title || this.props.placeholder : this.props.placeholder}
5965
underlineColorAndroid="transparent"
6066
/>
@@ -82,13 +88,13 @@ const styles = StyleSheet.create({
8288
fontSize: theme.font.medium,
8389
textAlign: 'left',
8490
textAlignVertical: 'top',
85-
// minHeight: BASE_HEIGHT + OFFSET,
8691
flex: 1,
92+
height: BASE_HEIGHT,
8793
padding: 0
8894
},
8995
inputDisabled: {
9096
backgroundColor: theme.color.lightGrey
9197
}
9298
});
9399

94-
export default CellInput;
100+
export default CellInput;

0 commit comments

Comments
 (0)