-
Notifications
You must be signed in to change notification settings - Fork 454
Expand file tree
/
Copy pathTextInput.js
More file actions
43 lines (37 loc) · 1.13 KB
/
TextInput.js
File metadata and controls
43 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import PropTypes from "prop-types";
import React, { Component } from "react";
import { TextInput as RNTextInput } from "react-native";
import { connectStyle } from "@shoutem/theme";
import { connectAnimation } from "@shoutem/animation";
class TextInput extends Component {
render() {
const { props } = this;
const style = {
...props.style
};
delete style.placeholderTextColor;
delete style.selectionColor;
delete style.underlineColorAndroid;
return (
<RNTextInput
{...props}
style={style}
ref={input => {
if (typeof this.props.inputRef === "function") {
this.props.inputRef(input);
}
}}
placeholderTextColor={props.style.placeholderTextColor}
selectionColor={props.style.selectionColor}
underlineColorAndroid={props.style.underlineColorAndroid}
/>
);
}
}
TextInput.propTypes = {
...RNTextInput.propTypes,
style: PropTypes.object
};
const AnimatedTextInput = connectAnimation(TextInput);
const StyledTextInput = connectStyle("shoutem.ui.TextInput")(AnimatedTextInput);
export { StyledTextInput as TextInput };