forked from GeekyAnts/NativeBase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathText.js
More file actions
31 lines (25 loc) · 809 Bytes
/
Text.js
File metadata and controls
31 lines (25 loc) · 809 Bytes
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
import React, { Component } from "react";
import PropTypes from "prop-types";
import { Text as RNText } from "react-native";
import _ from "lodash";
import { connectStyle } from "native-base-shoutem-theme";
import mapPropsToStyleNames from "../Utils/mapPropsToStyleNames";
class Text extends Component {
render() {
return (
<RNText ref={c => (this._root = c)} {...this.props}>
{this.props.uppercase ? _.toUpper(this.props.children) : this.props.children}
</RNText>
);
}
}
Text.propTypes = {
...RNText.propTypes,
uppercase: PropTypes.bool,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
};
Text.defaultProps = {
uppercase: false,
};
const StyledText = connectStyle("NativeBase.Text", {}, mapPropsToStyleNames)(Text);
export { StyledText as Text };