diff --git a/src/components/dropdownButton/view/dropdownButtonStyles.js b/src/components/dropdownButton/view/dropdownButtonStyles.js index 040547bb4..5a5014318 100644 --- a/src/components/dropdownButton/view/dropdownButtonStyles.js +++ b/src/components/dropdownButton/view/dropdownButtonStyles.js @@ -33,6 +33,9 @@ export default EStyleSheet.create({ iconWrapper: { justifyContent: 'center', alignItems: 'center', + flexDirection: 'row', + width: 40, + height: 40, }, dropdownText: { fontSize: 9, diff --git a/src/components/dropdownButton/view/dropdownButtonView.js b/src/components/dropdownButton/view/dropdownButtonView.js index 03e161d92..6ba1a79f2 100644 --- a/src/components/dropdownButton/view/dropdownButtonView.js +++ b/src/components/dropdownButton/view/dropdownButtonView.js @@ -1,6 +1,5 @@ import React from 'react'; import { View, Text, TouchableHighlight } from 'react-native'; -import { Dimensions } from 'react-native'; // External components import ModalDropdown from 'react-native-modal-dropdown'; @@ -9,9 +8,6 @@ import Ionicons from 'react-native-vector-icons/Ionicons'; // Styles import styles from './dropdownButtonStyles'; -// Constants -const DEVICE_HEIGHT = Dimensions.get('window').height; - /* Props TODO: Fill all description * ------------------------------------------------ * @prop { string } defaultText - Description.... @@ -38,15 +34,19 @@ const DropdownButtonView = ({ iconName, isHasChildIcon, onSelect, + dropdownStyle, + dropdownTextStyle, + dropdownButtonStyle, + textStyle, options, style, }) => ( - + onSelect && onSelect(e)} diff --git a/src/components/settingsItem/view/settingsItemStyles.js b/src/components/settingsItem/view/settingsItemStyles.js index feb93072d..3c8f25298 100644 --- a/src/components/settingsItem/view/settingsItemStyles.js +++ b/src/components/settingsItem/view/settingsItemStyles.js @@ -2,7 +2,7 @@ import EStyleSheet from 'react-native-extended-stylesheet'; export default EStyleSheet.create({ wrapper: { - marginHorizontal: 8, + marginVertical: 8, flexDirection: 'row', justifyContent: 'center', alignItems: 'center', @@ -13,4 +13,28 @@ export default EStyleSheet.create({ fontWeight: 'bold', flexGrow: 1, }, + dropdownText: { + fontSize: 14, + paddingLeft: 16, + paddingHorizontal: 14, + color: '$primaryDarkGray', + }, + dropdownStyle: { + width: 172, + }, + dropdownButtonStyle: { + backgroundColor: '$primaryGray', + height: 44, + width: 172, + borderRadius: 8, + }, + dropdown: { + flexGrow: 1, + }, + textStyle: { + color: '$primaryBlue', + }, + textButton: { + justifyContent: 'center', + }, }); diff --git a/src/components/settingsItem/view/settingsItemView.js b/src/components/settingsItem/view/settingsItemView.js index 879ad5a71..ed566d3b3 100644 --- a/src/components/settingsItem/view/settingsItemView.js +++ b/src/components/settingsItem/view/settingsItemView.js @@ -4,6 +4,8 @@ import { View, Text } from 'react-native'; // Constants // Components +import { DropdownButton } from '../../dropdownButton'; +import { TextButton } from '../../buttons'; // Styles import styles from './settingsItemStyles'; @@ -22,16 +24,57 @@ class SettingsItemView extends Component { // Component Life Cycles // Component Functions + _renderItem = () => { + const { + type, options, selectedOptionIndex, handleOnChange, text, + } = this.props; + + switch (type) { + case 'dropdown': + return ( + handleOnChange(e, type)} + /> + ); + + case 'toggle': + return ( + handleOnChange(e, type)} + /> + ); + + default: + return ( + handleOnChange(type)} + textStyle={styles.textStyle} + style={styles.textButton} + text={text} + /> + ); + } + }; render() { - // eslint-disable-next-line - const { title, children } = this.props; + const { title } = this.props; - // eslint-disable-next-line return ( {title} - {children} + {this._renderItem()} ); } diff --git a/src/screens/settings/screen/settingsScreen.js b/src/screens/settings/screen/settingsScreen.js index 0b4ee583c..f20886070 100644 --- a/src/screens/settings/screen/settingsScreen.js +++ b/src/screens/settings/screen/settingsScreen.js @@ -1,11 +1,12 @@ import React, { Component, Fragment } from 'react'; -import { ScrollView, Text } from 'react-native'; +import { ScrollView } from 'react-native'; // Constants // Components import { BasicHeader } from '../../../components/basicHeader'; import { SettingsItem } from '../../../components/settingsItem'; + // Styles import globalStyles from '../../../globalStyles'; @@ -23,6 +24,9 @@ class SettingsScreen extends Component { // Component Life Cycles // Component Functions + _handleOnChange = (action, type) => { + console.log(action + type); + }; render() { return ( @@ -30,9 +34,20 @@ class SettingsScreen extends Component { - - ugur - + + + );