2021-05-24 13:19:19 +02:00
|
|
|
import React from "react";
|
|
|
|
import {
|
|
|
|
StyleSheet,
|
|
|
|
Text,
|
2021-07-22 18:39:02 +02:00
|
|
|
View,
|
|
|
|
TextInput,
|
2021-05-24 13:19:19 +02:00
|
|
|
ActivityIndicator,
|
|
|
|
} from "react-native";
|
2021-07-22 18:39:02 +02:00
|
|
|
|
2021-05-24 13:19:19 +02:00
|
|
|
import SetupView from '../components/SetupView';
|
2021-07-22 18:39:02 +02:00
|
|
|
import EvilIcon from "react-native-vector-icons/EvilIcons";
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { changeSwimTrackerHostname } from '../state/Reducer';
|
2021-05-24 13:19:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
function ConnectingView(props) {
|
|
|
|
|
2021-07-22 18:39:02 +02:00
|
|
|
let onHostnameChange = newHostName => {
|
|
|
|
props.dispatch(changeSwimTrackerHostname(newHostName));
|
|
|
|
};
|
|
|
|
|
2021-05-24 13:19:19 +02:00
|
|
|
return (
|
|
|
|
<SetupView
|
|
|
|
headerText="Connecting..."
|
|
|
|
lowerLeftButtonText="Advanced Setup"
|
|
|
|
lowerRightButtonText="Need help?"
|
|
|
|
>
|
|
|
|
<ActivityIndicator size="large" color="#ffffff" />
|
|
|
|
<Text style={styles.subtext}>
|
|
|
|
Please connect your phone to the WiFi of your SwimTracker
|
2021-07-22 18:39:02 +02:00
|
|
|
</Text>
|
|
|
|
<View style={styles.row}>
|
|
|
|
<EvilIcon name="archive" style={styles.hostIcon}></EvilIcon>
|
|
|
|
<TextInput
|
|
|
|
onChangeText={onHostnameChange}
|
|
|
|
value={props.swimTrackerHost}
|
|
|
|
style={styles.hostnameInput}
|
|
|
|
placeholder="Hostname/IP"
|
|
|
|
placeholderTextColor="rgba(255,255,255,0.5)"
|
|
|
|
></TextInput>
|
|
|
|
</View>
|
2021-05-24 13:19:19 +02:00
|
|
|
</SetupView>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
subtext: {
|
|
|
|
color: "rgba(255,255,255,1)",
|
2021-07-22 18:39:02 +02:00
|
|
|
textAlign: "center",
|
2021-05-24 13:19:19 +02:00
|
|
|
fontSize: 18,
|
|
|
|
lineHeight: 25,
|
|
|
|
width: "80%",
|
2021-07-22 18:39:02 +02:00
|
|
|
},
|
|
|
|
row: {
|
|
|
|
backgroundColor: "rgba(255,255,255,0.4)",
|
|
|
|
borderRadius: 5,
|
|
|
|
width: "80%",
|
|
|
|
height: 50,
|
|
|
|
flexDirection: "row",
|
|
|
|
alignItems: "center",
|
|
|
|
marginTop: 60,
|
|
|
|
marginBottom: 5,
|
|
|
|
},
|
|
|
|
hostIcon: {
|
|
|
|
fontSize: 25,
|
|
|
|
color: "rgba(255,255,255,1)",
|
|
|
|
marginLeft: 15,
|
|
|
|
marginRight: 15,
|
|
|
|
},
|
|
|
|
hostnameInput: {
|
|
|
|
height: 30,
|
|
|
|
color: "rgba(255,255,255,1)",
|
|
|
|
width: "80%",
|
|
|
|
fontSize: 18,
|
2021-05-24 13:19:19 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-07-22 18:39:02 +02:00
|
|
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
return { swimTrackerHost: state.settings.swimTrackerHost };
|
|
|
|
};
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(ConnectingView);
|