Added work item details to activity

This commit is contained in:
John Lyon-Smith
2018-06-04 16:29:58 -07:00
parent 4ebb4341b7
commit cffa0734b8
9 changed files with 81 additions and 38 deletions

View File

@@ -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>
)

View File

@@ -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>
)

View File

@@ -39,6 +39,7 @@ export class FormStaticInput extends React.Component {
underlineColorAndroid="white"
value={value}
/>
<Text>&nbsp;</Text>
</View>
)
}

View 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>&nbsp;</Text>
</View>
)
}
}

View File

@@ -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,

View File

@@ -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"