// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {Component} from 'react';
import {
Image,
Keyboard,
KeyboardAvoidingView,
Platform,
TouchableWithoutFeedback,
View
} from 'react-native';
import Button from 'react-native-button';
import ErrorText from 'app/components/error_text';
import FormattedText from 'app/components/formatted_text';
import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_localized_placeholder';
import {GlobalStyles} from 'app/styles';
import logo from 'assets/images/logo.png';
import Client from 'service/client';
import RequestStatus from 'service/constants/request_status';
export default class SelectServer extends Component {
static propTypes = {
serverUrl: React.PropTypes.string.isRequired,
server: React.PropTypes.object.isRequired,
actions: React.PropTypes.object.isRequired
};
onClick = () => {
Client.setUrl(this.props.serverUrl);
this.props.actions.getPing().then(() => {
if (this.props.server.status === RequestStatus.SUCCESS) {
Keyboard.dismiss();
this.props.actions.goToLogin();
}
});
};
inputRef = (ref) => {
this.textInput = ref;
};
blur = () => {
this.textInput.refs.wrappedInstance.blur();
};
render() {
const scene = (
);
if (Platform.OS === 'android') {
return scene;
}
return (
{scene}
);
}
}