Merge pull request #441 from esteemapp/bugfix/#381

Bugfix/#381
This commit is contained in:
Feruz M 2019-01-17 10:47:07 +02:00 committed by GitHub
commit a9a9fb50fb
5 changed files with 25 additions and 11 deletions

View File

@ -8,11 +8,6 @@ export default EStyleSheet.create({
alignSelf: 'flex-start',
height: 35,
},
// dropdownText: {
// fontSize: 9,
// color: '$primaryDarkGray',
// marginLeft: 25,
// },
dropdownIcon: {
fontSize: 22,
color: '$primaryDarkText',
@ -41,10 +36,10 @@ export default EStyleSheet.create({
fontSize: 10,
color: '$primaryDarkText',
padding: 5,
borderColor: '#e7e7e7',
borderColor: '$borderColor',
},
dropdownTextHighlight: {
backgroundColor: '#387be5',
backgroundColor: '$primaryBlue',
width: '$deviceWidth / 3',
},
button: {

View File

@ -26,8 +26,8 @@ export default EStyleSheet.create({
},
dropdownStyle: {
marginTop: 15,
minWidth: 172,
width: 172,
minWidth: 192,
width: 192,
},
dropdownButtonStyle: {
backgroundColor: '$primaryGray',
@ -38,6 +38,7 @@ export default EStyleSheet.create({
},
dropdown: {
flexGrow: 1,
width: 150,
},
textStyle: {
color: '$primaryBlue',

View File

@ -154,6 +154,7 @@ class SettingsContainer extends Component {
render() {
const { serverList } = this.state;
return (
<SettingsScreen
serverList={serverList}

View File

@ -2,6 +2,9 @@ import React, { PureComponent } from 'react';
import { ScrollView, View } from 'react-native';
import { injectIntl } from 'react-intl';
// Utils
import { groomingServerName } from '../../../utils/settings';
// Constants
import LANGUAGE, { VALUE as LANGUAGE_VALUE } from '../../../constants/options/language';
import CURRENCY, { VALUE as CURRENCY_VALUE } from '../../../constants/options/currency';
@ -75,9 +78,9 @@ class SettingsScreen extends PureComponent {
})}
type="dropdown"
actionType="api"
options={serverList}
options={serverList.map(serverName => groomingServerName(serverName))}
selectedOptionIndex={serverList.indexOf(selectedApi)}
defaultText={selectedApi}
defaultText={groomingServerName(selectedApi)}
handleOnChange={handleOnChange}
/>
<SettingsItem

14
src/utils/settings.js Normal file
View File

@ -0,0 +1,14 @@
export const groomingServerName = (serverName, prefix1) => {
const PREFIX1 = prefix1 || 'https://';
const PREFIX2 = 'https://';
if (!serverName) return null;
if (serverName.indexOf(PREFIX1) === 0) {
return serverName.substr(PREFIX1.length);
}
if (serverName.indexOf(PREFIX2) === 0) {
return serverName.substr(PREFIX2.length);
}
return serverName;
};