提交 49a78d8a 编写于 作者: ItbGcthate's avatar ItbGcthate

304_change code

上级 56983137
import React, {Component} from 'react';
import { View, StyleSheet, Dimensions, Image, ToastAndroid, Platform, BackHandler } from "react-native";
import {
View,
StyleSheet,
Image,
ToastAndroid,
Platform,
BackHandler,
} from 'react-native';
import Img1 from './img/img1.png';
import Img2 from './img/img2.png';
import MyButton from '../MyButton';
import {websocket} from '../MyUtilities';
const {width, height} = Dimensions.get('window');
class TwoPlayerPKHome extends Component {
constructor() {
super();
......
......@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
import Clock from './img/clock1.png';
import Searching from './img/searching1.png';
const {width, height} = Dimensions.get('window');
const {height} = Dimensions.get('window');
class TwoPlayerPKState extends Component {
constructor() {
......
......@@ -22,7 +22,7 @@ import {
sno,
} from '../MyUtilities';
const {width, height} = Dimensions.get('window');
const {height} = Dimensions.get('window');
/**
* 标语风格切换共使用了组件:
* 1. GlobalSetting(引入global变量global.bannerStyle,来控制标语风格)
......@@ -57,6 +57,7 @@ class TwoPlayerPKStudy extends Component {
duration: -1,
timeInTheMatch: -1,
},
isGoBack: false,
victories: 0,
isStarted: false,
timeInTheGame: 0,
......@@ -97,8 +98,11 @@ class TwoPlayerPKStudy extends Component {
}
backEvent = () => {
this.finish();
return true;
if (!this.state.isGoBack) {
this.finish();
return true;
}
return false;
};
resolveMessage = msg => {
......@@ -185,6 +189,7 @@ class TwoPlayerPKStudy extends Component {
// console.log('点击确定');
websocket.disconnect();
clearInterval(this.timer);
this.setState({isGoBack: true});
this.props.navigation.goBack();
},
},
......
import React, {Component} from 'react';
import {View, StyleSheet, Dimensions} from 'react-native';
import {View, StyleSheet} from 'react-native';
import MyButton from '../MyButton';
import {bannerStyle} from '../GlobalSetting';
const {width, height} = Dimensions.get('window');
class BannerStyle extends Component {
constructor() {
super();
......
......@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import MyButton from '../MyButton';
import {bannerStyle} from '../GlobalSetting';
const {width, height} = Dimensions.get('window');
const {height} = Dimensions.get('window');
class MyBanner extends Component {
constructor() {
......@@ -87,16 +87,16 @@ class MyBanner extends Component {
disabled,
};
const container = {...styles.container, ...containerStyle};
const bannerStyle = this.chooseBannerStyle();
const bannerContent = this.chooseBannerStyle();
const banner = {
containerStyle: styles.containerStyle,
textEnabled: bannerStyle.textEnabled,
textDisabled: bannerStyle.textDisabled,
textEnabled: bannerContent.textEnabled,
textDisabled: bannerContent.textDisabled,
textStyle: styles.textStyle,
buttonEnabled: bannerStyle.buttonEnabled,
buttonDisabled: bannerStyle.buttonDisabled,
buttonEnabled: bannerContent.buttonEnabled,
buttonDisabled: bannerContent.buttonDisabled,
buttonStyle: styles.buttonStyle,
title: bannerStyle.title,
title: bannerContent.title,
};
return (
<View style={container}>
......
......@@ -8,7 +8,7 @@ import {
} from 'react-native';
import PropTypes from 'prop-types';
const {width, height} = Dimensions.get('window');
const {height} = Dimensions.get('window');
class MyButton extends Component {
constructor() {
......
......@@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {View, Text, StyleSheet, Dimensions, Pressable} from 'react-native';
import PropTypes from 'prop-types';
const {width, height} = Dimensions.get('window');
const {height} = Dimensions.get('window');
class MyStatistics extends Component {
constructor() {
......
......@@ -11,8 +11,8 @@ export function login() {
sno: sno.get(),
password: password.get(),
};
const resolveData = data => {
console.log(data);
const resolveData = r => {
console.log(r);
};
// console.log('[Login] sno: ' + data.sno + ' password: ' + data.password);
post(URL_LOGIN, data).then(resolveData).catch();
......
......@@ -2,7 +2,7 @@ import React, {Component} from 'react';
import {Text, StyleSheet, Dimensions, View} from 'react-native';
import PropTypes from 'prop-types';
const {width, height} = Dimensions.get('window');
const {height} = Dimensions.get('window');
class MyTitle extends Component {
constructor() {
......
import React, {Component} from 'react';
import {View, StyleSheet, Dimensions, Image, Pressable} from 'react-native';
import {View, StyleSheet, Image, Pressable} from 'react-native';
import {login, logout} from '../MyTest';
const {width, height} = Dimensions.get('window');
class OnlineStudyHome extends Component {
constructor() {
super();
......@@ -62,7 +60,7 @@ const styles = StyleSheet.create({
textAlign: 'center',
},
button: {
flex: 0.5,
flex: 1,
borderRadius: 50,
},
image: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册