From e4f3bd47589c6278bb8b27d93ab97b0dcb7228f9 Mon Sep 17 00:00:00 2001 From: ue Date: Thu, 5 Sep 2019 23:35:42 +0300 Subject: [PATCH] wip on profile edit form fields --- .../avatarHeader/avatarHeaderStyles.js | 15 ++++++++ .../avatarHeader/avatarHeaderView.js | 14 +++++-- .../formInput/view/formInputStyles.js | 3 +- .../formInput/view/formInputView.js | 18 ++++----- src/components/index.js | 4 +- .../profileEditForm/profileEditFormStyles.js | 14 +++++++ .../profileEditForm/profileEditFormView.js | 38 +++++++++++++++++++ .../textInput/view/textInputView.js | 4 +- .../userAvatar/view/userAvatarView.js | 4 +- src/screens/login/screen/loginScreen.js | 2 +- src/screens/login/screen/loginStyles.js | 5 +++ .../profileEdit/screen/profileEditScreen.js | 10 +++++ 12 files changed, 110 insertions(+), 21 deletions(-) create mode 100644 src/components/profileEditForm/profileEditFormStyles.js create mode 100644 src/components/profileEditForm/profileEditFormView.js diff --git a/src/components/avatarHeader/avatarHeaderStyles.js b/src/components/avatarHeader/avatarHeaderStyles.js index d7f8ac8ac..1840141d8 100644 --- a/src/components/avatarHeader/avatarHeaderStyles.js +++ b/src/components/avatarHeader/avatarHeaderStyles.js @@ -28,4 +28,19 @@ export default EStyleSheet.create({ fontSize: 12, marginTop: 4, }, + addIcon: { + color: '$white', + textAlign: 'center', + }, + addButton: { + backgroundColor: '$iconColor', + width: 20, + height: 20, + borderRadius: 20 / 2, + borderColor: '$white', + borderWidth: 1, + position: 'absolute', + bottom: 0, + left: 45, + }, }); diff --git a/src/components/avatarHeader/avatarHeaderView.js b/src/components/avatarHeader/avatarHeaderView.js index e9268599f..d3eb1673f 100644 --- a/src/components/avatarHeader/avatarHeaderView.js +++ b/src/components/avatarHeader/avatarHeaderView.js @@ -9,7 +9,7 @@ import { IconButton } from '../iconButton'; // Styles import styles from './avatarHeaderStyles'; -const TooltipView = ({ username, name, reputation, navigation }) => ( +const AvatarHeader = ({ username, name, reputation, navigation, avatarUrl }) => ( ( size={25} /> - + + alert('upload')} + size={15} + /> {name} {`@${username} (${reputation})`} @@ -35,4 +43,4 @@ const TooltipView = ({ username, name, reputation, navigation }) => ( ); -export default withNavigation(TooltipView); +export default withNavigation(AvatarHeader); diff --git a/src/components/formInput/view/formInputStyles.js b/src/components/formInput/view/formInputStyles.js index 0783a4745..c595c6686 100644 --- a/src/components/formInput/view/formInputStyles.js +++ b/src/components/formInput/view/formInputStyles.js @@ -4,8 +4,7 @@ export default EStyleSheet.create({ wrapper: { borderTopLeftRadius: 8, borderTopRightRadius: 8, - marginHorizontal: 30, - marginVertical: 10, + marginTop: 16, flexDirection: 'row', backgroundColor: '$primaryGray', height: 60, diff --git a/src/components/formInput/view/formInputView.js b/src/components/formInput/view/formInputView.js index 15df144ec..d511ce610 100644 --- a/src/components/formInput/view/formInputView.js +++ b/src/components/formInput/view/formInputView.js @@ -30,17 +30,10 @@ class FormInputView extends Component { value: '', inputBorderColor: '#c1c5c7', isValid: true, - formInputWidth: '99%', }; } // Component Life Cycles - componentWillMount() { - setTimeout(() => { - this.setState({ formInputWidth: '100%' }); - }, 100); - } - componentWillReceiveProps(nextProps) { const { isValid } = this.props; @@ -65,7 +58,7 @@ class FormInputView extends Component { }; render() { - const { inputBorderColor, isValid, value, formInputWidth } = this.state; + const { inputBorderColor, isValid, value } = this.state; const { placeholder, type, @@ -75,6 +68,8 @@ class FormInputView extends Component { rightIconName, secureTextEntry, iconType, + wrapperStyle, + height, } = this.props; return ( {isFirstImage && value && value.length > 2 ? ( @@ -97,19 +93,21 @@ class FormInputView extends Component { /> ) : ( - + rightIconName && ( + + ) )} this._handleOnFocus()} autoCapitalize="none" secureTextEntry={secureTextEntry} + height={height} placeholder={placeholder} editable={isEditable || true} textContentType={type} onChangeText={val => this._handleOnChange(val)} value={value} - style={{ width: formInputWidth }} /> diff --git a/src/components/index.js b/src/components/index.js index cf074dd38..e2e1f7ee7 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -10,6 +10,7 @@ import { TextInput } from './textInput'; import ScaleSlider from './scaleSlider/scaleSliderView'; import UserListItem from './basicUIElements/view/userListItem/userListItem'; import PostButton from './postButton/postButtonView'; +import ProfileEditForm from './profileEditForm/profileEditFormView'; export { CircularButton, @@ -20,10 +21,11 @@ export { Modal, NumericKeyboard, PinAnimatedInput, + PostButton, + ProfileEditForm, ScaleSlider, SideMenu, TextButton, TextInput, UserListItem, - PostButton, }; diff --git a/src/components/profileEditForm/profileEditFormStyles.js b/src/components/profileEditForm/profileEditFormStyles.js new file mode 100644 index 000000000..dd5fb8acd --- /dev/null +++ b/src/components/profileEditForm/profileEditFormStyles.js @@ -0,0 +1,14 @@ +import EStyleSheet from 'react-native-extended-stylesheet'; + +export default EStyleSheet.create({ + container: { + paddingHorizontal: 32, + paddingVertical: 16, + backgroundColor: '$primaryBackgroundColor', + flex: 1, + }, + formStyle: { + backgroundColor: '$white', + height: 30, + }, +}); diff --git a/src/components/profileEditForm/profileEditFormView.js b/src/components/profileEditForm/profileEditFormView.js new file mode 100644 index 000000000..9f968d9a9 --- /dev/null +++ b/src/components/profileEditForm/profileEditFormView.js @@ -0,0 +1,38 @@ +import React from 'react'; +import { withNavigation } from 'react-navigation'; +import { View, Text, Platform } from 'react-native'; +import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; + +// Components +import { FormInput } from '../formInput'; + +// Styles +import styles from './profileEditFormStyles'; + +const ProfileEditFormView = ({ avatarUrl, coverUrl, name, about, location, website }) => ( + + + Profile picture URL + alert('changed')} + placeholder="profile picture url" + isEditable + type="username" + isFirstImage + value="sex" + /> + + +); + +export default withNavigation(ProfileEditFormView); + +// placeholder={intl.formatMessage({ +// id: 'login.username', +// })} diff --git a/src/components/textInput/view/textInputView.js b/src/components/textInput/view/textInputView.js index 97c571e19..09f19b977 100644 --- a/src/components/textInput/view/textInputView.js +++ b/src/components/textInput/view/textInputView.js @@ -5,9 +5,9 @@ import { connect } from 'react-redux'; // Styles import styles from './textInputStyles'; -const TextInputView = ({ isDarkTheme, innerRef, ...props }) => ( +const TextInputView = ({ isDarkTheme, innerRef, height, ...props }) => ( this.setState({ keyboardIsOpen: true })} onKeyboardWillHide={() => this.setState({ keyboardIsOpen: false })} enableAutoAutomaticScroll={Platform.OS === 'ios'} - contentContainerStyle={{ flexGrow: 1 }} + contentContainerStyle={styles.formWrapper} > + )}