Added work item details to activity
This commit is contained in:
@@ -85,10 +85,9 @@ export class BoundInput extends React.Component {
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 12,
|
||||
display: valid ? "none" : "flex",
|
||||
color: "red",
|
||||
}}>
|
||||
{message}
|
||||
{valid ? " " : message}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -55,10 +55,9 @@ export class BoundOptionStrip extends React.Component {
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 12,
|
||||
display: valid ? "none" : "flex",
|
||||
color: "red",
|
||||
}}>
|
||||
{message}
|
||||
{valid ? " " : message}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -39,6 +39,7 @@ export class FormStaticInput extends React.Component {
|
||||
underlineColorAndroid="white"
|
||||
value={value}
|
||||
/>
|
||||
<Text> </Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
33
mobile/src/ui/FormStaticOptionStrip.js
Normal file
33
mobile/src/ui/FormStaticOptionStrip.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { Text, View, Platform } from "react-native"
|
||||
import { OptionStrip } from "."
|
||||
|
||||
export class FormStaticOptionStrip extends React.Component {
|
||||
static propTypes = {
|
||||
label: PropTypes.string,
|
||||
options: PropTypes.arrayOf(
|
||||
PropTypes.shape({ value: PropTypes.string, text: PropTypes.string })
|
||||
).isRequired,
|
||||
value: PropTypes.string,
|
||||
}
|
||||
|
||||
render() {
|
||||
const { label, value, options } = this.props
|
||||
|
||||
return (
|
||||
<View style={{ width: "100%" }}>
|
||||
<Text
|
||||
style={{
|
||||
color: "black",
|
||||
fontSize: 14,
|
||||
marginBottom: 5,
|
||||
}}>
|
||||
{label}
|
||||
</Text>
|
||||
<OptionStrip value={value} readOnly options={options} />
|
||||
<Text> </Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ export class OptionStrip extends Component {
|
||||
PropTypes.shape({ value: PropTypes.string, text: PropTypes.string })
|
||||
).isRequired,
|
||||
value: PropTypes.string,
|
||||
readOnly: PropTypes.bool,
|
||||
onValueChanged: PropTypes.func,
|
||||
}
|
||||
|
||||
@@ -41,14 +42,15 @@ export class OptionStrip extends Component {
|
||||
handlePress(option) {
|
||||
const { onValueChanged } = this.props
|
||||
|
||||
this.setState({ selectedOption: option })
|
||||
if (onValueChanged) {
|
||||
onValueChanged(option.value)
|
||||
} else if (!this.props.readOnly) {
|
||||
this.setState({ selectedOption: option })
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { style, options, value } = this.props
|
||||
const { style, options, value, readOnly } = this.props
|
||||
const { selectedOption } = this.state
|
||||
|
||||
// TODO: Handle visible, disabled & read-only
|
||||
@@ -58,6 +60,7 @@ export class OptionStrip extends Component {
|
||||
{options.map((option, index) => (
|
||||
<TouchableHighlight
|
||||
key={index}
|
||||
disabled={readOnly}
|
||||
underlayColor="#3BB0FD"
|
||||
style={[
|
||||
{
|
||||
@@ -65,7 +68,11 @@ export class OptionStrip extends Component {
|
||||
flexBasis: 0,
|
||||
height: 40,
|
||||
backgroundColor:
|
||||
option === selectedOption ? "#3BB0FD" : "#EEEEEE",
|
||||
option !== selectedOption
|
||||
? "#EEEEEE"
|
||||
: readOnly
|
||||
? "#AAAAAA"
|
||||
: "#3BB0FD",
|
||||
},
|
||||
index === 0 && {
|
||||
borderTopLeftRadius: 6,
|
||||
|
||||
@@ -7,6 +7,7 @@ export { Geolocation } from "./Geolocation"
|
||||
export { BoundSwitch } from "./BoundSwitch"
|
||||
export { BoundInput } from "./BoundInput"
|
||||
export { FormStaticInput } from "./FormStaticInput"
|
||||
export { FormStaticOptionStrip } from "./FormStaticOptionStrip"
|
||||
export { BoundButton } from "./BoundButton"
|
||||
export { BoundOptionStrip } from "./BoundOptionStrip"
|
||||
export { BoundHeader } from "./BoundHeader"
|
||||
|
||||
Reference in New Issue
Block a user