Added RNFS and refactor image upload to use it
This commit is contained in:
@@ -29,6 +29,7 @@ import { api } from "../API"
|
||||
import "url-search-params-polyfill"
|
||||
import { config } from "../config"
|
||||
import { workItemTypeEnum, formatLatLng, parseLatLng } from "../util"
|
||||
import PropTypes from "prop-types"
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
@@ -50,6 +51,10 @@ const styles = StyleSheet.create({
|
||||
})
|
||||
|
||||
export class WorkItem extends React.Component {
|
||||
static propTypes = {
|
||||
history: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
||||
}
|
||||
|
||||
static bindings = {
|
||||
header: {
|
||||
noValue: true,
|
||||
@@ -65,6 +70,7 @@ export class WorkItem extends React.Component {
|
||||
isReadOnly: true,
|
||||
},
|
||||
photos: {
|
||||
initValue: [],
|
||||
isValid: (r, v) => v && v.length > 0,
|
||||
},
|
||||
details: {
|
||||
@@ -270,6 +276,13 @@ export class WorkItem extends React.Component {
|
||||
this.setState({ progressModal: null })
|
||||
}
|
||||
|
||||
@autobind
|
||||
handleAddActivity() {
|
||||
if (this.history) {
|
||||
this.history.push(`/activity?workItemId=${this.binder._id}`)
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
binder,
|
||||
@@ -360,6 +373,26 @@ export class WorkItem extends React.Component {
|
||||
onUploadProgress={this.handleUploadProgress}
|
||||
/>
|
||||
</View>
|
||||
{api.loggedInUser.administrator &&
|
||||
binder._id && (
|
||||
<View style={styles.panel}>
|
||||
<TouchableOpacity
|
||||
onPress={this.handleAddActivity}
|
||||
style={{
|
||||
alignSelf: "center",
|
||||
backgroundColor: "blue",
|
||||
justifyContent: "center",
|
||||
paddingHorizontal: 10,
|
||||
height: 40,
|
||||
width: "100%",
|
||||
backgroundColor: "#3BB0FD",
|
||||
}}>
|
||||
<Text style={{ alignSelf: "center", color: "black" }}>
|
||||
Add Activity
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
)}
|
||||
{isIphoneX ? <View style={{ height: 30, width: "100%" }} /> : null}
|
||||
</ScrollView>
|
||||
<ProgressModal
|
||||
|
||||
Reference in New Issue
Block a user