diff --git a/ReactNativeClient/lib/components/global-style.js b/ReactNativeClient/lib/components/global-style.js index 9bf6bf730..7dff4c0e8 100644 --- a/ReactNativeClient/lib/components/global-style.js +++ b/ReactNativeClient/lib/components/global-style.js @@ -15,6 +15,7 @@ const globalStyle = { dividerColor: "#dddddd", selectedColor: '#e5e5e5', disabledOpacity: 0.2, + colorUrl: '#000CFF', raisedBackgroundColor: "#0080EF", raisedColor: "#003363", @@ -89,10 +90,17 @@ function addExtraStyles(style) { fontSize: style.fontSize, }; + style.urlText = { + color: style.colorUrl, + fontSize: style.fontSize, + }; + return style; } function themeStyle(theme) { + if (!theme) throw new Error('Theme not set'); + if (themeCache_[theme]) return themeCache_[theme]; let output = Object.assign({}, globalStyle); diff --git a/ReactNativeClient/lib/components/screens/dropbox-login.js b/ReactNativeClient/lib/components/screens/dropbox-login.js index 4d3dbdf82..42c31e755 100644 --- a/ReactNativeClient/lib/components/screens/dropbox-login.js +++ b/ReactNativeClient/lib/components/screens/dropbox-login.js @@ -1,5 +1,5 @@ const React = require('react'); const Component = React.Component; -const { View, Button, Text, TextInput, TouchableOpacity } = require('react-native'); +const { View, Button, Text, TextInput, TouchableOpacity, StyleSheet } = require('react-native'); const { connect } = require('react-redux'); const { ScreenHeader } = require('lib/components/screen-header.js'); const { _ } = require('lib/locale.js'); @@ -7,12 +7,15 @@ const { BaseScreenComponent } = require('lib/components/base-screen.js'); const DialogBox = require('react-native-dialogbox').default; const { dialogs } = require('lib/dialogs.js'); const Shared = require('lib/components/shared/dropbox-login-shared'); +const { themeStyle } = require('lib/components/global-style.js'); class DropboxLoginScreenComponent extends BaseScreenComponent { constructor() { super(); + this.styles_ = {}; + this.shared_ = new Shared( this, (msg) => dialogs.info(this, msg), @@ -24,22 +27,45 @@ class DropboxLoginScreenComponent extends BaseScreenComponent { this.shared_.refreshUrl(); } + styles() { + const themeId = this.props.theme; + const theme = themeStyle(themeId); + + if (this.styles_[themeId]) return this.styles_[themeId]; + this.styles_ = {}; + + let styles = { + container: { + padding: theme.margin, + }, + stepText: Object.assign({}, theme.normalText, { marginBottom: theme.margin }), + urlText: Object.assign({}, theme.urlText, { marginBottom: theme.margin }), + } + + this.styles_[themeId] = StyleSheet.create(styles); + return this.styles_[themeId]; + } + render() { + const theme = themeStyle(this.props.theme); + return ( - {_('To allow Joplin to synchronise with Dropbox, please follow the steps below:')} - {_('Step 1: Open this URL in your browser to authorise the application:')} - - - {this.state.loginUrl} - - - {_('Step 2: Enter the code provided by Dropbox:')} - + + {_('To allow Joplin to synchronise with Dropbox, please follow the steps below:')} + {_('Step 1: Open this URL in your browser to authorise the application:')} + + + {this.state.loginUrl} + + + {_('Step 2: Enter the code provided by Dropbox:')} + - + + { this.dialogbox = dialogbox }}/> @@ -48,10 +74,10 @@ class DropboxLoginScreenComponent extends BaseScreenComponent { } -const DropboxLoginScreen = connect( - (state) => { - return {}; - } -)(DropboxLoginScreenComponent) +const DropboxLoginScreen = connect((state) => { + return { + theme: state.settings.theme, + }; +})(DropboxLoginScreenComponent) module.exports = { DropboxLoginScreen }; \ No newline at end of file diff --git a/ReactNativeClient/lib/components/shared/dropbox-login-shared.js b/ReactNativeClient/lib/components/shared/dropbox-login-shared.js index d8cc66e53..8523ee38e 100644 --- a/ReactNativeClient/lib/components/shared/dropbox-login-shared.js +++ b/ReactNativeClient/lib/components/shared/dropbox-login-shared.js @@ -41,7 +41,6 @@ class Shared { this.comp_.props.dispatch({ type: 'NAV_BACK' }); reg.scheduleSync(); } catch (error) { - console.error(error); await showErrorMessageBox(_('Could not authorise application:\n\n%s\n\nPlease try again.', error.message)); } finally { this.comp_.setState({ checkingAuthToken: false });