Open sce9sc opened 8 years ago
If your example work on android try the ToolbarAndroid NavBar from this Icon-Set. There you can use a "go back" icon. Works fine for me.
import React, {
Component,
View,
StyleSheet,
ToolbarAndroid,
} from 'react-native';
var Icon = require('react-native-vector-icons/Ionicons');
import BarcodeScanner from 'react-native-barcodescanner';
class Scan extends Component {
constructor(props) {
super(props);
this.state = {
torchMode: 'off',
cameraType: 'back',
};
}
barcodeReceived(e) {
console.log('Barcode: ' + e.data);
console.log('Type: ' + e.type);
}
render() {
return (
<View style={{flex: 1}}>
<Icon.ToolbarAndroid
style={styles.toolbar}
titleColor='white'
title={this.props.title}
navIconName='android-arrow-back'
onIconClicked={this.props.navigator.pop}/>
<BarcodeScanner
onBarCodeRead={this.barcodeReceived}
style={{flex: 1}}
torchMode={this.state.torchMode}
cameraType={this.state.cameraType}/>
</View>
);
}
}
const styles = StyleSheet.create({
toolbar: {
height: 50,
backgroundColor: 'grey'
}
});
export default Scan;
I am trying the component but I can't seem to be able to close the camera when using react-native-router-flux .
Is it possible somehow to stop the camera and the capturing ?
I use router as such:
For the NavBar i Use
and barcode is as your example