攝像機檢視 react-native-camera 手機開發工具
阿新 • • 發佈:2019-01-24
https://github.com/lwansbrough/react-native-camera
react-native-camera 是 React Native 的攝像頭 viewport。這個模組應用於開發的早期階段,它支援攝像頭的轉換和基本圖片捕捉。
使用示例:
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
var Camera = require('react-native-camera');
var cameraApp = React.createClass({
render: function () {
return (
<View>
<TouchableHighlight onPress={this._switchCamera}>
<View>
<Camera
ref="cam"
aspect="Stretch"
orientation="PortraitUpsideDown"
style=
/>
</View >
</TouchableHighlight>
</View>
);
},
_switchCamera: function() {
this.refs.cam.switch();
}
});
AppRegistry.registerComponent('cameraApp', () => cameraApp);