diff --git a/screen/settings/electrumSettings.js b/screen/settings/electrumSettings.js index 94fd5702d..f9f9ac46d 100644 --- a/screen/settings/electrumSettings.js +++ b/screen/settings/electrumSettings.js @@ -4,77 +4,21 @@ import { View, TextInput, StyleSheet } from 'react-native'; import { AppStorage } from '../../class'; import AsyncStorage from '@react-native-community/async-storage'; import { ScrollView } from 'react-native-gesture-handler'; -import { BlueLoading, BlueSpacing20, BlueButton, SafeBlueArea, BlueCard, BlueText, BlueNavigationStyle, BlueButtonLink } from '../../BlueComponents'; +import { + BlueLoading, + BlueSpacing20, + BlueButton, + SafeBlueArea, + BlueCard, + BlueText, + BlueNavigationStyle, + BlueButtonLink, +} from '../../BlueComponents'; import { BlueCurrentTheme } from '../../components/themes'; +import PropTypes from 'prop-types'; import loc from '../../loc'; const BlueElectrum = require('../../blue_modules/BlueElectrum'); -const styles = StyleSheet.create({ - root: { - flex: 1, - }, - status: { - textAlign: 'center', - color: BlueCurrentTheme.colors.feeText, - marginBottom: 4, - }, - connectWrap: { - width: 'auto', - height: 34, - flexWrap: 'wrap', - justifyContent: 'center', - flexDirection: 'row', - }, - container: { - paddingTop: 6, - paddingBottom: 6, - paddingLeft: 16, - paddingRight: 16, - borderRadius: 20, - }, - containerConnected: { - backgroundColor: BlueCurrentTheme.colors.feeLabel, - }, - containerDisconnected: { - backgroundColor: '#F8D2D2', - }, - textConnected: { - color: BlueCurrentTheme.colors.feeValue, - fontWeight: 'bold', - }, - textDisconnected: { - color: '#D0021B', - fontWeight: 'bold', - }, - hostname: { - textAlign: 'center', - color: BlueCurrentTheme.colors.foregroundColor, - }, - explain: { - color: BlueCurrentTheme.colors.feeText, - marginBottom: -24, - }, - inputWrap: { - flexDirection: 'row', - borderColor: BlueCurrentTheme.colors.formBorder, - borderBottomColor: BlueCurrentTheme.colors.formBorder, - borderWidth: 1, - borderBottomWidth: 0.5, - backgroundColor: BlueCurrentTheme.colors.inputBackgroundColor, - minHeight: 44, - height: 44, - alignItems: 'center', - borderRadius: 4, - }, - inputText: { - flex: 1, - marginHorizontal: 8, - minHeight: 36, - color: '#81868e', - height: 36, - }, -}); - export default class ElectrumSettings extends Component { constructor(props) { super(props); @@ -147,10 +91,10 @@ export default class ElectrumSettings extends Component { }); }; - onBarScanned = (value) => { + onBarScanned = value => { var [host, port, type] = value.split(':'); this.setState({ host: host }); - ( type == "s" ) ? this.setState({ sslPort: port }) : this.setState({ port: port }); + type === 's' ? this.setState({ sslPort: port }) : this.setState({ port: port }); }; importScan = () => { @@ -239,7 +183,83 @@ export default class ElectrumSettings extends Component { } } +ElectrumSettings.propTypes = { + navigation: PropTypes.shape({ + navigate: PropTypes.func, + goBack: PropTypes.func, + }), + route: PropTypes.shape({ + name: PropTypes.string, + }), +}; + ElectrumSettings.navigationOptions = () => ({ ...BlueNavigationStyle(), title: loc.settings.electrum_settings, }); + +const styles = StyleSheet.create({ + root: { + flex: 1, + }, + status: { + textAlign: 'center', + color: BlueCurrentTheme.colors.feeText, + marginBottom: 4, + }, + connectWrap: { + width: 'auto', + height: 34, + flexWrap: 'wrap', + justifyContent: 'center', + flexDirection: 'row', + }, + container: { + paddingTop: 6, + paddingBottom: 6, + paddingLeft: 16, + paddingRight: 16, + borderRadius: 20, + }, + containerConnected: { + backgroundColor: BlueCurrentTheme.colors.feeLabel, + }, + containerDisconnected: { + backgroundColor: '#F8D2D2', + }, + textConnected: { + color: BlueCurrentTheme.colors.feeValue, + fontWeight: 'bold', + }, + textDisconnected: { + color: '#D0021B', + fontWeight: 'bold', + }, + hostname: { + textAlign: 'center', + color: BlueCurrentTheme.colors.foregroundColor, + }, + explain: { + color: BlueCurrentTheme.colors.feeText, + marginBottom: -24, + }, + inputWrap: { + flexDirection: 'row', + borderColor: BlueCurrentTheme.colors.formBorder, + borderBottomColor: BlueCurrentTheme.colors.formBorder, + borderWidth: 1, + borderBottomWidth: 0.5, + backgroundColor: BlueCurrentTheme.colors.inputBackgroundColor, + minHeight: 44, + height: 44, + alignItems: 'center', + borderRadius: 4, + }, + inputText: { + flex: 1, + marginHorizontal: 8, + minHeight: 36, + color: '#81868e', + height: 36, + }, +});