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