summaryrefslogtreecommitdiff
path: root/src/Components/Settings.tsx
blob: ca481a9e1b3d72d65a94f574e0005c48856a1f63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React, { Component, PureComponent } from 'react';
import { StyleSheet, View, Text, GestureResponderEvent, ActivityIndicator, Slider, SafeAreaView } from 'react-native';
// import { Button } from 'react-native-vector-icons/FontAwesome';
import { getStatusBarHeight } from '../helper';
import { connect } from 'react-redux';
import actions from '../Actions/actions';
import { Portal } from '../Api/types';
import { bindActionCreators } from 'redux';

type Props = {
    guid: string
    portal?: Portal
}

class Settings extends PureComponent<Props> {
    static navigationOptions = ({ navigation }) => {
        return {
            title: 'Настройки',
        };
    };

    render() {
        const { filterLevel } = this.props.settings
        return (
            <SafeAreaView style={styles.overlay}>
                <Text>Мин. Ур.: {filterLevel[0]}</Text>
                <Slider
                    style={{ width: 150, height: 40 }}
                    minimumValue={0}
                    maximumValue={filterLevel[1]}
                    value={filterLevel[0]}
                    step={1}
                    minimumTrackTintColor="#028ce3"
                    maximumTrackTintColor="#000000"
                    onSlidingComplete={this.props.setLevelFrom}
                />
                <Text>Макс. Ур.: {filterLevel[1]}</Text>
                <Slider
                    style={{ width: 150, height: 40 }}
                    minimumValue={filterLevel[0]}
                    maximumValue={8}
                    value={filterLevel[1]}
                    step={1}
                    minimumTrackTintColor="#028ce3"
                    maximumTrackTintColor="#000000"
                    onSlidingComplete={this.props.setLevelTo}
                />
            </SafeAreaView>
        );
    }
}

export default connect((store) => ({ settings: store.settings }), (dispatch) => bindActionCreators(actions, dispatch))(Settings)

const styles = StyleSheet.create({
    overlay: {
        flex: 1,
        padding: 8,
    },
    title: {
        fontWeight: 'bold',
        fontSize: 22,
    },
    subtitle: {
        fontWeight: 'normal',
        fontSize: 18,
    }
});