2018-08-10 17:26:36 +00:00
|
|
|
import React from 'react';
|
2018-09-25 19:28:42 +00:00
|
|
|
import {
|
2021-09-14 22:33:44 +00:00
|
|
|
View, Text, Image
|
2018-09-25 19:28:42 +00:00
|
|
|
} from 'react-native';
|
2018-08-10 17:26:36 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2019-03-12 16:23:06 +00:00
|
|
|
import Orientation from 'react-native-orientation-locker';
|
2018-08-10 17:26:36 +00:00
|
|
|
|
|
|
|
import I18n from '../../i18n';
|
2020-03-30 19:20:50 +00:00
|
|
|
import Button from '../../containers/Button';
|
2018-08-10 17:26:36 +00:00
|
|
|
import styles from './styles';
|
2020-03-30 19:20:50 +00:00
|
|
|
import { isTablet } from '../../utils/deviceInfo';
|
2019-12-04 16:39:53 +00:00
|
|
|
import { themes } from '../../constants/colors';
|
|
|
|
import { withTheme } from '../../theme';
|
2020-03-30 19:20:50 +00:00
|
|
|
import FormContainer, { FormContainerInner } from '../../containers/FormContainer';
|
2020-07-22 19:31:38 +00:00
|
|
|
import { logEvent, events } from '../../utils/log';
|
2018-08-10 17:26:36 +00:00
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
class OnboardingView extends React.Component {
|
2020-06-15 14:00:46 +00:00
|
|
|
static navigationOptions = {
|
|
|
|
headerShown: false
|
|
|
|
};
|
2018-10-23 21:39:48 +00:00
|
|
|
|
2018-08-10 17:26:36 +00:00
|
|
|
static propTypes = {
|
2019-03-12 16:23:06 +00:00
|
|
|
navigation: PropTypes.object,
|
2019-12-04 16:39:53 +00:00
|
|
|
theme: PropTypes.string
|
2018-08-10 17:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
constructor(props) {
|
2019-05-28 13:03:08 +00:00
|
|
|
super(props);
|
2019-11-25 20:01:17 +00:00
|
|
|
if (!isTablet) {
|
|
|
|
Orientation.lockToPortrait();
|
|
|
|
}
|
2018-08-10 17:26:36 +00:00
|
|
|
}
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
shouldComponentUpdate(nextProps) {
|
|
|
|
const { theme } = this.props;
|
|
|
|
if (theme !== nextProps.theme) {
|
|
|
|
return true;
|
|
|
|
}
|
2018-12-21 10:55:35 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-10-23 21:39:48 +00:00
|
|
|
connectServer = () => {
|
2020-07-30 13:26:17 +00:00
|
|
|
logEvent(events.ONBOARD_JOIN_A_WORKSPACE);
|
2020-03-30 19:20:50 +00:00
|
|
|
const { navigation } = this.props;
|
|
|
|
navigation.navigate('NewServerView');
|
2018-08-10 17:26:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2019-12-04 16:39:53 +00:00
|
|
|
const { theme } = this.props;
|
2018-08-10 17:26:36 +00:00
|
|
|
return (
|
2020-05-20 16:33:40 +00:00
|
|
|
<FormContainer theme={theme} testID='onboarding-view'>
|
2020-03-30 19:20:50 +00:00
|
|
|
<FormContainerInner>
|
2021-01-13 14:11:31 +00:00
|
|
|
<Image style={styles.onboarding} source={require('../../static/images/logo.png')} fadeDuration={0} />
|
2020-03-30 19:20:50 +00:00
|
|
|
<Text style={[styles.title, { color: themes[theme].titleText }]}>{I18n.t('Onboarding_title')}</Text>
|
|
|
|
<Text style={[styles.subtitle, { color: themes[theme].controlText }]}>{I18n.t('Onboarding_subtitle')}</Text>
|
|
|
|
<Text style={[styles.description, { color: themes[theme].auxiliaryText }]}>{I18n.t('Onboarding_description')}</Text>
|
|
|
|
<View style={styles.buttonsContainer}>
|
|
|
|
<Button
|
|
|
|
title={I18n.t('Onboarding_join_workspace')}
|
|
|
|
type='primary'
|
|
|
|
onPress={this.connectServer}
|
|
|
|
theme={theme}
|
2020-05-20 16:33:40 +00:00
|
|
|
testID='join-workspace'
|
2020-03-30 19:20:50 +00:00
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</FormContainerInner>
|
|
|
|
</FormContainer>
|
2018-08-10 17:26:36 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-08-07 13:51:34 +00:00
|
|
|
|
2021-01-15 17:49:00 +00:00
|
|
|
export default withTheme(OnboardingView);
|