Created
December 3, 2019 14:48
-
-
Save nastyakitsune/4bb8c166fc3091e8fa4a3b0d694974bc to your computer and use it in GitHub Desktop.
React Native Settings Component Layout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import {View, Text, TouchableOpacity, StyleSheet} from 'react-native'; | |
| import {SimpleLink, SectionTitle} from 'components'; | |
| import styles from './styles'; | |
| const SettingsView = ({ | |
| type = 'creator', | |
| email = '', | |
| minRate = 0, | |
| logout, | |
| onPasswordChange, | |
| onRateChange, | |
| onHelpOpen, | |
| onTermsOpen, | |
| onPrivacyOpen, | |
| onDeleteAccount, | |
| onBillingOpen, | |
| onNotificationsOpen, | |
| }) => ( | |
| <> | |
| <View style={styles.container}> | |
| <SectionTitle title={'Settings'} style={styles.titleContainer} /> | |
| <SimpleLink title={'Billing details'} action={onBillingOpen} /> | |
| {type === 'creator' && ( | |
| <SimpleLink | |
| title={'Minimum rate'} | |
| action={onRateChange} | |
| additional={`${minRate} USD`} | |
| /> | |
| )} | |
| <SectionTitle title={'App settings'} style={styles.titleContainer} /> | |
| <SimpleLink title={'Notifications'} action={onNotificationsOpen} /> | |
| <SimpleLink title={'Contact details'} action={onHelpOpen} /> | |
| <SimpleLink title={'Privacy policy'} action={onPrivacyOpen} /> | |
| <SimpleLink title={'Terms of use'} action={onTermsOpen} /> | |
| {type === config.userTypeMap.creator && ( | |
| <SimpleLink title={'Delete account'} action={onDeleteAccount} /> | |
| )} | |
| </View> | |
| <TouchableOpacity onPress={logout} style={styles.logoutBtn}> | |
| <Text style={styles.logoutBtnText}>Log out</Text> | |
| </TouchableOpacity> | |
| </> | |
| ); | |
| const styles = StyleSheet.create({ | |
| titleContainer: { | |
| width: '100%', | |
| paddingLeft: 16, | |
| borderBottomColor: AppColors.black4, | |
| borderBottomWidth: 0.5, | |
| paddingTop: 16, | |
| paddingBottom: 4, | |
| }, | |
| logoutBtn: { | |
| marginLeft: 16, | |
| paddingVertical: 13, | |
| borderBottomColor: AppColors.black4, | |
| borderBottomWidth: 0.5, | |
| borderTopColor: AppColors.black4, | |
| borderTopWidth: 0.5, | |
| // marginBottom: 34, | |
| }, | |
| logoutBtnText: { | |
| color: AppColors.blue, | |
| fontSize: 16, | |
| fontFamily: AppFonts.regular, | |
| }, | |
| container: { | |
| flex: 1, | |
| }, | |
| }); | |
| export default SettingsView; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment