mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 21:35:04 +03:00
defaulting post username to null
This commit is contained in:
parent
26262ecda0
commit
d7f555f2fb
@ -7,26 +7,32 @@ import { Icon } from '../../../icon';
|
||||
import globalStyles from '../../../../globalStyles';
|
||||
|
||||
import styles from './selectCommunityAreStyles';
|
||||
import { Separator } from '../../../basicUIElements';
|
||||
|
||||
const SelectCommunityAreaView = ({
|
||||
community,
|
||||
mode,
|
||||
currentAccount,
|
||||
selectedCommunity,
|
||||
selectedAccount,
|
||||
onPressIn,
|
||||
onPressOut,
|
||||
intl,
|
||||
}) => {
|
||||
let username = null;
|
||||
let title = intl.formatMessage({ id: 'editor.select_community' });
|
||||
if (selectedAccount) {
|
||||
username = selectedAccount.name;
|
||||
title = intl.formatMessage({ id: 'editor.my_blog' });
|
||||
} else if (selectedCommunity) {
|
||||
username = selectedCommunity.name;
|
||||
title = selectedCommunity.title;
|
||||
}
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
style={[globalStyles.containerHorizontal16, styles.selectCommunityAreaViewContainer]}
|
||||
onPressIn={onPressIn}
|
||||
onPressOut={onPressOut}
|
||||
>
|
||||
<UserAvatar username={mode === 'community' ? community.name : currentAccount.name} noAction />
|
||||
<Text style={[globalStyles.text, styles.chooseACommunityText]}>
|
||||
{mode === 'community' ? community.title : intl.formatMessage({ id: 'editor.my_blog' })}
|
||||
</Text>
|
||||
<UserAvatar username={username} noAction />
|
||||
<Text style={[globalStyles.text, styles.chooseACommunityText]}>{title}</Text>
|
||||
<Icon
|
||||
size={24}
|
||||
iconStyle={styles.leftIcon}
|
||||
|
@ -298,6 +298,7 @@
|
||||
"beneficiaries": "Beneficiaries",
|
||||
"options": "Options",
|
||||
"my_blog": "My Blog",
|
||||
"select_community":"Choose a community",
|
||||
"my_communities": "My Communities",
|
||||
"top_communities": "Top Communities",
|
||||
"schedule_modal_title": "Schedule Post",
|
||||
|
@ -53,6 +53,7 @@ class EditorScreen extends Component {
|
||||
},
|
||||
isCommunitiesListModalOpen: false,
|
||||
selectedCommunity: null,
|
||||
selectedAccount: null,
|
||||
};
|
||||
}
|
||||
|
||||
@ -230,6 +231,7 @@ class EditorScreen extends Component {
|
||||
|
||||
_handlePressCommunity = (community) => {
|
||||
const { fields, selectedCommunity } = this.state;
|
||||
const { currentAccount } = this.props;
|
||||
|
||||
if (community == null) {
|
||||
if (!isNull(selectedCommunity)) {
|
||||
@ -243,7 +245,12 @@ class EditorScreen extends Component {
|
||||
fields.tags.unshift(community.name);
|
||||
}
|
||||
|
||||
this.setState({ fields, isCommunitiesListModalOpen: false, selectedCommunity: community });
|
||||
this.setState({
|
||||
fields,
|
||||
isCommunitiesListModalOpen: false,
|
||||
selectedCommunity: community,
|
||||
selectedAccount: community ? null : currentAccount,
|
||||
});
|
||||
};
|
||||
|
||||
_getCommunity = (hive) => {
|
||||
@ -275,6 +282,7 @@ class EditorScreen extends Component {
|
||||
isRemoveTag,
|
||||
isCommunitiesListModalOpen,
|
||||
selectedCommunity,
|
||||
selectedAccount,
|
||||
} = this.state;
|
||||
const {
|
||||
handleOnImagePicker,
|
||||
@ -341,9 +349,8 @@ class EditorScreen extends Component {
|
||||
>
|
||||
{!isReply && !isEdit && (
|
||||
<SelectCommunityAreaView
|
||||
currentAccount={currentAccount}
|
||||
mode={!isNull(selectedCommunity) ? 'community' : 'user'}
|
||||
community={selectedCommunity}
|
||||
selectedAccount={selectedAccount}
|
||||
selectedCommunity={selectedCommunity}
|
||||
// because of the bug in react-native-modal
|
||||
// https://github.com/facebook/react-native/issues/26892
|
||||
onPressOut={() => this.setState({ isCommunitiesListModalOpen: true })}
|
||||
|
Loading…
Reference in New Issue
Block a user