-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathField.js
50 lines (41 loc) · 1000 Bytes
/
Field.js
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
44
45
46
47
48
49
50
'use strict';
import React from 'react';
import PropTypes from 'prop-types';
import {HelpText} from './HelpText';
let { View, StyleSheet, Text, TouchableHighlight} = require('react-native');
export class Field extends React.Component{
render(){
let fieldHelpText =
this.props.helpTextComponent
|| ((this.props.helpText)
? <HelpText text={this.props.helpText} />
: null);
if(this.props.onPress){
return <TouchableHighlight onPress={this.props.onPress}>
<View>
{this.props.children}
{fieldHelpText}
</View>
</TouchableHighlight>
}
return <View>
{this.props.children}
{fieldHelpText}
</View>;
}
}
Field.propTypes = {
helpTextComponent: PropTypes.element,
helpText: PropTypes.string
}
let formStyles = StyleSheet.create({
helpTextContainer:{
marginTop:9,
marginBottom: 25,
paddingLeft: 20,
paddingRight: 20,
},
helpText:{
color: '#7a7a7a'
}
});