Commit de618f1d by 黄日华

收银程序横屏兼容

parent 75151180
......@@ -19,6 +19,18 @@ class HomeLayout extends Component {
source={require('../assets/Vertical/24h.png')}
/>
<Text style={styles.titleText}>{appName}</Text>
<View
style={{
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'flex-end',
paddingRight: 25,
}}>
<Text style={{fontSize: 12, color: '#ccc'}}>
{width} - {height}
</Text>
</View>
</View>
{this.props.children}
</View>
......
......@@ -11,11 +11,10 @@ const {width, height} = Dimensions.get('window');
class AuthPage extends Component {
state = {
isLandscape: false,
socket: '',
};
async componentDidMount() {
this.setState({isLandscape: width > height});
this.socket = io(axios.defaults.baseURL);
this.socket.on('storeAuth', this.handleLogin);
this.socket.on('connect', () => {
......@@ -33,16 +32,15 @@ class AuthPage extends Component {
};
render() {
const {socket, isLandscape} = this.state;
console.warn(width, height);
const {socket} = this.state;
return (
<HomeLayout>
<View style={styles.qrcode}>
<QRCode
size={isLandscape ? scaleSize(height * 0.35) : scaleSize(700)}
size={width > height ? scaleSize(height * 0.2) : scaleSize(700)}
logo={require('../assets/logo.png')}
backgroundColor="white"
value={`${config.qrHost}/#/store-auth-${socket}`}
value={`${config.qrHost}/#/store-auth-${socket || ''}`}
/>
</View>
</HomeLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment