fixed merge conflicts.

This commit is contained in:
Marcus Andersson
2018-01-08 21:12:39 +01:00
116 changed files with 18372 additions and 327 deletions
+38 -73
View File
@@ -1,11 +1,5 @@
import React from 'react';
import {
Image,
StatusBar,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native';
import { Image, StatusBar, StyleSheet, TouchableOpacity, View } from 'react-native';
import Camera from 'react-native-camera';
const styles = StyleSheet.create({
@@ -68,37 +62,39 @@ export default class Example extends React.Component {
orientation: Camera.constants.Orientation.auto,
flashMode: Camera.constants.FlashMode.auto,
},
isRecording: false
isRecording: false,
};
}
takePicture = () => {
if (this.camera) {
this.camera.capture()
.then((data) => console.log(data))
this.camera
.capture()
.then(data => console.log(data))
.catch(err => console.error(err));
}
}
};
startRecording = () => {
if (this.camera) {
this.camera.capture({mode: Camera.constants.CaptureMode.video})
.then((data) => console.log(data))
.catch(err => console.error(err));
this.camera
.capture({ mode: Camera.constants.CaptureMode.video })
.then(data => console.log(data))
.catch(err => console.error(err));
this.setState({
isRecording: true
isRecording: true,
});
}
}
};
stopRecording = () => {
if (this.camera) {
this.camera.stopCapture();
this.setState({
isRecording: false
isRecording: false,
});
}
}
};
switchType = () => {
let newType;
@@ -116,7 +112,7 @@ export default class Example extends React.Component {
type: newType,
},
});
}
};
get typeIcon() {
let icon;
@@ -149,7 +145,7 @@ export default class Example extends React.Component {
flashMode: newFlashMode,
},
});
}
};
get flashIcon() {
let icon;
@@ -169,12 +165,9 @@ export default class Example extends React.Component {
render() {
return (
<View style={styles.container}>
<StatusBar
animated
hidden
/>
<StatusBar animated hidden />
<Camera
ref={(cam) => {
ref={cam => {
this.camera = cam;
}}
style={styles.preview}
@@ -187,62 +180,34 @@ export default class Example extends React.Component {
defaultTouchToFocus
mirrorImage={false}
cropToPreview={false}
permissionDialogTitle="Sample title"
permissionDialogMessage="Sample dialog message"
/>
<View style={[styles.overlay, styles.topOverlay]}>
<TouchableOpacity
style={styles.typeButton}
onPress={this.switchType}
>
<Image
source={this.typeIcon}
/>
<TouchableOpacity style={styles.typeButton} onPress={this.switchType}>
<Image source={this.typeIcon} />
</TouchableOpacity>
<TouchableOpacity
style={styles.flashButton}
onPress={this.switchFlash}
>
<Image
source={this.flashIcon}
/>
<TouchableOpacity style={styles.flashButton} onPress={this.switchFlash}>
<Image source={this.flashIcon} />
</TouchableOpacity>
</View>
<View style={[styles.overlay, styles.bottomOverlay]}>
{
!this.state.isRecording
&&
<TouchableOpacity
style={styles.captureButton}
onPress={this.takePicture}
>
<Image
source={require('./assets/ic_photo_camera_36pt.png')}
/>
{(!this.state.isRecording && (
<TouchableOpacity style={styles.captureButton} onPress={this.takePicture}>
<Image source={require('./assets/ic_photo_camera_36pt.png')} />
</TouchableOpacity>
||
null
}
)) ||
null}
<View style={styles.buttonsSpace} />
{
!this.state.isRecording
&&
<TouchableOpacity
style={styles.captureButton}
onPress={this.startRecording}
>
<Image
source={require('./assets/ic_videocam_36pt.png')}
/>
</TouchableOpacity>
||
<TouchableOpacity
style={styles.captureButton}
onPress={this.stopRecording}
>
<Image
source={require('./assets/ic_stop_36pt.png')}
/>
</TouchableOpacity>
}
{(!this.state.isRecording && (
<TouchableOpacity style={styles.captureButton} onPress={this.startRecording}>
<Image source={require('./assets/ic_videocam_36pt.png')} />
</TouchableOpacity>
)) || (
<TouchableOpacity style={styles.captureButton} onPress={this.stopRecording}>
<Image source={require('./assets/ic_stop_36pt.png')} />
</TouchableOpacity>
)}
</View>
</View>
);