Merge branch 'development' of github.com:esteemapp/esteem-mobile into bugfix/post-display

This commit is contained in:
Mustafa Buyukcelebi 2019-11-20 18:12:33 +03:00
commit 42ef794f01
24 changed files with 84 additions and 87 deletions

View File

@ -1,6 +1,5 @@
import SummaryArea from './summaryArea/view/summaryAreaView'; import SummaryArea from './summaryArea/view/summaryAreaView';
import TagArea from './tagArea/view/tagAreaView'; import TagArea from './tagArea/view/tagAreaView';
import TextArea from './textArea/view/textAreaView';
import TitleArea from './titleArea/view/titleAreaView'; import TitleArea from './titleArea/view/titleAreaView';
export { SummaryArea, TagArea, TextArea, TitleArea }; export { SummaryArea, TagArea, TitleArea };

View File

@ -1,8 +0,0 @@
import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
container: {
flex: 1,
marginTop: 16,
},
});

View File

@ -1,25 +0,0 @@
import React, { PureComponent } from 'react';
// Constants
// Components
import { MarkdownEditor } from '../../../markdownEditor';
export default class TextAreaView extends PureComponent {
/* Props
* ------------------------------------------------
* @prop { type } name - Description....
*/
constructor(props) {
super(props);
this.state = {};
}
// Component Life Cycles
// Component Functions
render() {
return <MarkdownEditor {...this.props} />;
}
}

View File

@ -8,5 +8,6 @@ export default EStyleSheet.create({
fontFamily: '$editorFont', fontFamily: '$editorFont',
textAlignVertical: 'top', textAlignVertical: 'top',
paddingVertical: 0, paddingVertical: 0,
backgroundColor: '$primaryBackgroundColor',
}, },
}); });

View File

@ -30,4 +30,7 @@ export default EStyleSheet.create({
marginBottom: 10, marginBottom: 10,
fontFamily: '$primaryFont', fontFamily: '$primaryFont',
}, },
listContentContainer: {
paddingBottom: 60,
},
}); });

View File

@ -70,6 +70,7 @@ class LeaderboardView extends PureComponent {
ListEmptyComponent={<ListPlaceHolder />} ListEmptyComponent={<ListPlaceHolder />}
onRefresh={() => fetchLeaderBoard()} onRefresh={() => fetchLeaderBoard()}
renderItem={({ item, index }) => this._renderItem(item, index)} renderItem={({ item, index }) => this._renderItem(item, index)}
contentContainerStyle={styles.listContentContainer}
/> />
</View> </View>
</Fragment> </Fragment>

View File

@ -14,6 +14,7 @@ export default EStyleSheet.create({
paddingBottom: 0, // On android side, textinput has default padding paddingBottom: 0, // On android side, textinput has default padding
paddingHorizontal: 16, paddingHorizontal: 16,
color: '$primaryBlack', color: '$primaryBlack',
backgroundColor: '$primaryBackgroundColor',
fontFamily: '$editorFont', fontFamily: '$editorFont',
textAlignVertical: 'top', textAlignVertical: 'top',
}, },

View File

@ -1,7 +1,6 @@
import EStyleSheet from 'react-native-extended-stylesheet'; import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({ export default EStyleSheet.create({
view: {},
codeBlock: { codeBlock: {
fontFamily: 'Courier', fontFamily: 'Courier',
fontWeight: '500', fontWeight: '500',

View File

@ -18,4 +18,7 @@ export default EStyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
flex: 1, flex: 1,
}, },
listContentContainer: {
paddingBottom: 60,
},
}); });

View File

@ -175,6 +175,7 @@ class NotificationView extends PureComponent {
onEndReached={() => getActivities(null, selectedFilter, true)} onEndReached={() => getActivities(null, selectedFilter, true)}
ListFooterComponent={this._renderFooterLoading} ListFooterComponent={this._renderFooterLoading}
ListEmptyComponent={<ListPlaceHolder />} ListEmptyComponent={<ListPlaceHolder />}
contentContainerStyle={styles.listContentContainer}
refreshControl={ refreshControl={
<RefreshControl <RefreshControl
refreshing={isNotificationRefreshing} refreshing={isNotificationRefreshing}

View File

@ -119,8 +119,9 @@ export default EStyleSheet.create({
}, },
scrollContainer: { scrollContainer: {
flex: 1, flex: 1,
backgroundColor: '$primaryBackgroundColor', },
marginBottom: 60, scrollContentContainer: {
paddingBottom: 60,
}, },
popoverDetails: { popoverDetails: {
flexDirection: 'row', flexDirection: 'row',

View File

@ -101,6 +101,7 @@ class PointsView extends Component {
<ScrollView <ScrollView
style={styles.scrollContainer} style={styles.scrollContainer}
refreshControl={this.refreshControl({ isDarkTheme })} refreshControl={this.refreshControl({ isDarkTheme })}
contentContainerStyle={styles.scrollContentContainer}
> >
<View style={styles.pointsWrapper}> <View style={styles.pointsWrapper}>
<Text onPress={this._showDropdown} style={styles.pointText}> <Text onPress={this._showDropdown} style={styles.pointText}>

View File

@ -32,4 +32,7 @@ export default EStyleSheet.create({
width: 193, width: 193,
height: 189, height: 189,
}, },
placeholderWrapper: {
flex: 1,
},
}); });

View File

@ -51,6 +51,9 @@ const PostsView = ({
const [isNoPost, setIsNoPost] = useState(false); const [isNoPost, setIsNoPost] = useState(false);
const [promotedPosts, setPromotedPosts] = useState([]); const [promotedPosts, setPromotedPosts] = useState([]);
const [scrollOffsetY, setScrollOffsetY] = useState(0); const [scrollOffsetY, setScrollOffsetY] = useState(0);
const [selectedFilterValue, setSelectedFilterValue] = useState(
filterOptionsValue && filterOptionsValue[selectedFilterIndex],
);
const intl = useIntl(); const intl = useIntl();
useEffect(() => { useEffect(() => {
@ -62,8 +65,6 @@ const PostsView = ({
}; };
fetchPromotePost(); fetchPromotePost();
_loadPosts(); _loadPosts();
setRefreshing(false);
setIsLoading(false);
} }
}, [ }, [
_getPromotePosts, _getPromotePosts,
@ -81,8 +82,6 @@ const PostsView = ({
setPosts([]); setPosts([]);
setStartAuthor(''); setStartAuthor('');
setStartPermlink(''); setStartPermlink('');
setRefreshing(false);
setIsLoading(false);
setSelectedFilterIndex(selectedOptionIndex || 0); setSelectedFilterIndex(selectedOptionIndex || 0);
setIsNoPost(false); setIsNoPost(false);
@ -102,20 +101,21 @@ const PostsView = ({
useEffect(() => { useEffect(() => {
if (!startAuthor && !startPermlink) { if (!startAuthor && !startPermlink) {
_loadPosts( _loadPosts(selectedFilterValue);
filterOptions && filterOptions.length > 0 && filterOptionsValue[selectedFilterIndex],
);
} }
}, [ }, [
_loadPosts, _loadPosts,
filterOptions, filterOptions,
filterOptionsValue, filterOptionsValue,
selectedFilterIndex, selectedFilterValue,
startAuthor, startAuthor,
startPermlink, startPermlink,
]); ]);
const _handleOnDropdownSelect = async index => { const _handleOnDropdownSelect = async index => {
if (filterOptions && filterOptions.length > 0) {
await setSelectedFilterValue(filterOptionsValue[index]);
}
setSelectedFilterIndex(index); setSelectedFilterIndex(index);
setPosts([]); setPosts([]);
setStartPermlink(''); setStartPermlink('');
@ -145,25 +145,26 @@ const PostsView = ({
}, [currentAccountUsername]); }, [currentAccountUsername]);
const _loadPosts = useCallback( const _loadPosts = useCallback(
async type => { type => {
if (isLoading) { if (
isLoading ||
!isConnected ||
(!isLoggedIn && type === 'feed') ||
(!isLoggedIn && type === 'blog')
) {
return; return;
} else {
setIsLoading(true);
} }
const filter = if (!isConnected && (refreshing || isLoading)) {
type ||
(filterOptions && filterOptions.length > 0 && filterOptionsValue[selectedFilterIndex]);
let options;
const limit = 3;
if (!isConnected) {
setRefreshing(false); setRefreshing(false);
setIsLoading(false); setIsLoading(false);
return null; return;
} }
const filter = type || selectedFilterValue;
let options;
const limit = 3;
if (filter === 'feed' || filter === 'blog' || getFor === 'blog' || filter === 'reblogs') { if (filter === 'feed' || filter === 'blog' || getFor === 'blog' || filter === 'reblogs') {
options = { options = {
tag, tag,
@ -202,7 +203,7 @@ const PostsView = ({
} }
} }
if (posts.length < 5) { if (posts.length < 5 && pageType !== 'profiles') {
setFeedPosts(_posts); setFeedPosts(_posts);
} }
@ -233,8 +234,7 @@ const PostsView = ({
} }
// Promoted post end // Promoted post end
if (refreshing) { if (!refreshing) {
} else if (!refreshing) {
setStartAuthor(result[result.length - 1] && result[result.length - 1].author); setStartAuthor(result[result.length - 1] && result[result.length - 1].author);
setStartPermlink(result[result.length - 1] && result[result.length - 1].permlink); setStartPermlink(result[result.length - 1] && result[result.length - 1].permlink);
} }
@ -252,16 +252,16 @@ const PostsView = ({
}, },
[ [
currentAccountUsername, currentAccountUsername,
filterOptions,
filterOptionsValue,
getFor, getFor,
isConnected, isConnected,
isLoading, isLoading,
isLoggedIn,
nsfw, nsfw,
pageType,
posts, posts,
promotedPosts, promotedPosts,
refreshing, refreshing,
selectedFilterIndex, selectedFilterValue,
setFeedPosts, setFeedPosts,
startAuthor, startAuthor,
startPermlink, startPermlink,
@ -295,7 +295,7 @@ const PostsView = ({
}; };
const _renderEmptyContent = () => { const _renderEmptyContent = () => {
if (getFor === 'feed' && isLoginDone && !isLoggedIn) { if ((selectedFilterValue === 'feed' || selectedFilterValue === 'blog') && !isLoggedIn) {
return ( return (
<NoPost <NoPost
imageStyle={styles.noImage} imageStyle={styles.noImage}
@ -324,10 +324,10 @@ const PostsView = ({
} }
return ( return (
<Fragment> <View style={styles.placeholderWrapper}>
<PostCardPlaceHolder /> <PostCardPlaceHolder />
<PostCardPlaceHolder /> <PostCardPlaceHolder />
</Fragment> </View>
); );
}; };
@ -369,7 +369,7 @@ const PostsView = ({
) )
} }
keyExtractor={(content, i) => `${get(content, 'permlink', '')}${i.toString()}`} keyExtractor={(content, i) => `${get(content, 'permlink', '')}${i.toString()}`}
onEndReached={_loadPosts} onEndReached={() => _loadPosts()}
removeClippedSubviews removeClippedSubviews
refreshing={refreshing} refreshing={refreshing}
onRefresh={_handleOnRefreshPosts} onRefresh={_handleOnRefreshPosts}

View File

@ -60,4 +60,7 @@ export default EStyleSheet.create({
paddingHorizontal: 16, paddingHorizontal: 16,
paddingVertical: 5, paddingVertical: 5,
}, },
scrollContentContainer: {
paddingBottom: 60,
},
}); });

View File

@ -197,7 +197,10 @@ class ProfileView extends PureComponent {
style={styles.commentsTabBar} style={styles.commentsTabBar}
> >
{comments && comments.length > 0 ? ( {comments && comments.length > 0 ? (
<ScrollView onScroll={this._handleOnScroll}> <ScrollView
onScroll={this._handleOnScroll}
contentContainerStyle={styles.scrollContentContainer}
>
<Comments <Comments
isProfilePreview isProfilePreview
comments={comments} comments={comments}

View File

@ -12,9 +12,10 @@ export default EStyleSheet.create({
alignItems: 'center', alignItems: 'center',
}, },
count: { count: {
fontSize: 72, fontSize: 60,
fontWeight: '700', fontWeight: '700',
color: '$primaryDarkGray', color: '$primaryDarkGray',
height: 60,
}, },
countDesc: { countDesc: {
color: '$primaryDarkGray', color: '$primaryDarkGray',

View File

@ -15,6 +15,5 @@ export default EStyleSheet.create({
input: { input: {
flex: 1, flex: 1,
minHeight: 50, minHeight: 50,
backgroundColor: '$primaryWhiteLightBackground',
}, },
}); });

View File

@ -213,12 +213,16 @@ class UpvoteView extends Component {
} = this.props; } = this.props;
const { isVoting, amount, sliderValue, isVoted, isShowDetails, downvote } = this.state; const { isVoting, amount, sliderValue, isVoted, isShowDetails, downvote } = this.state;
let iconName = 'ios-arrow-dropup'; let iconName = 'upcircleo';
let iconType; let iconType = 'AntDesign';
let downVoteIconName = 'downcircleo';
if (isVoted) { if (isVoted) {
iconName = 'upcircle'; iconName = 'upcircle';
iconType = 'AntDesign'; }
if (isDownVoted) {
downVoteIconName = 'downcircle';
} }
const _percent = `${downvote ? '-' : ''}${(sliderValue * 100).toFixed(0)}%`; const _percent = `${downvote ? '-' : ''}${(sliderValue * 100).toFixed(0)}%`;
@ -253,8 +257,8 @@ class UpvoteView extends Component {
<Icon <Icon
style={[styles.upvoteIcon, isDownVoted && { color: '#ec8b88' }]} style={[styles.upvoteIcon, isDownVoted && { color: '#ec8b88' }]}
active={!isLoggedIn} active={!isLoggedIn}
iconType={isDownVoted ? 'AntDesign' : iconType} iconType={iconType}
name={isDownVoted ? 'downcircle' : iconName} name={isDownVoted ? downVoteIconName : iconName}
/> />
</View> </View>
)} )}
@ -328,7 +332,7 @@ class UpvoteView extends Component {
size={20} size={20}
style={[styles.upvoteIcon, { color: '#007ee5' }]} style={[styles.upvoteIcon, { color: '#007ee5' }]}
active={!isLoggedIn} active={!isLoggedIn}
iconType={iconType} iconType="AntDesign"
name={iconName} name={iconName}
/> />
</TouchableOpacity> </TouchableOpacity>
@ -356,7 +360,7 @@ class UpvoteView extends Component {
style={[styles.upvoteIcon, { color: '#ec8b88' }]} style={[styles.upvoteIcon, { color: '#ec8b88' }]}
active={!isLoggedIn} active={!isLoggedIn}
iconType="AntDesign" iconType="AntDesign"
name="downcircle" name={downVoteIconName}
/> />
</TouchableOpacity> </TouchableOpacity>
</Fragment> </Fragment>

View File

@ -38,4 +38,7 @@ export default EStyleSheet.create({
scrollView: { scrollView: {
backgroundColor: '$primaryLightBackground', backgroundColor: '$primaryLightBackground',
}, },
scrollContentContainer: {
paddingBottom: 60,
},
}); });

View File

@ -73,6 +73,7 @@ class WalletView extends PureComponent {
colors={['#fff']} colors={['#fff']}
/> />
} }
contentContainerStyle={styles.scrollContentContainer}
> >
{!walletData ? ( {!walletData ? (
<Fragment> <Fragment>

View File

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import 'react-native-gesture-handler';
import { Provider, connect } from 'react-redux'; import { Provider, connect } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react'; import { PersistGate } from 'redux-persist/integration/react';
import { IntlProvider } from 'react-intl'; import { IntlProvider } from 'react-intl';
import { useScreens } from 'react-native-screens'; import { useScreens } from 'react-native-screens';
import { flattenMessages } from './utils/flattenMessages'; import { flattenMessages } from './utils/flattenMessages';
import messages from './config/locales'; import messages from './config/locales';

View File

@ -96,9 +96,9 @@ class EditorContainer extends Component {
this.setState({ this.setState({
isEdit, isEdit,
draftPost: { draftPost: {
title: post.title, title: get(post, 'title', ''),
body: post.markdownBody, body: get(post, 'markdownBody', ''),
tags: post.json_metadata.tags, tags: get(post, 'json_metadata.tags', []),
}, },
}); });
} }
@ -129,9 +129,9 @@ class EditorContainer extends Component {
if (result) { if (result) {
this.setState({ this.setState({
draftPost: { draftPost: {
body: result.body, body: get(result, 'body', ''),
title: result.title, title: get(result, 'title', ''),
tags: result.tags.split(','), tags: get(result, 'tags', '').split(','),
}, },
}); });
} }

View File

@ -14,6 +14,7 @@ import {
TextArea, TextArea,
SummaryArea, SummaryArea,
PostForm, PostForm,
MarkdownEditor,
} from '../../../components'; } from '../../../components';
// Styles // Styles
@ -73,7 +74,9 @@ class EditorScreen extends Component {
isRemoveTag: true, isRemoveTag: true,
}); });
if (initialEditor) initialEditor(); if (initialEditor) {
initialEditor();
}
}; };
_handleOnPressPreviewButton = () => { _handleOnPressPreviewButton = () => {
@ -229,7 +232,7 @@ class EditorScreen extends Component {
intl={intl} intl={intl}
/> />
)} )}
<TextArea <MarkdownEditor
componentID="body" componentID="body"
draftBody={fields && fields.body} draftBody={fields && fields.body}
handleOnTextChange={this._setWordsCount} handleOnTextChange={this._setWordsCount}