mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 11:21:41 +03:00
fix conflict
This commit is contained in:
commit
cdc9075ae1
@ -27,6 +27,8 @@ const PostCardContainer = ({
|
||||
content,
|
||||
isHideImage,
|
||||
nsfw,
|
||||
imageHeight,
|
||||
setImageHeight,
|
||||
}) => {
|
||||
const [_content, setContent] = useState(content);
|
||||
const [reblogs, setReblogs] = useState([]);
|
||||
@ -139,6 +141,8 @@ const PostCardContainer = ({
|
||||
isNsfwPost={nsfw || '1'}
|
||||
reblogs={reblogs}
|
||||
activeVotes={activeVotes}
|
||||
imageHeight={imageHeight}
|
||||
setImageHeight={setImageHeight}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -37,9 +37,11 @@ const PostCardView = ({
|
||||
isNsfwPost,
|
||||
intl,
|
||||
activeVotes,
|
||||
imageHeight,
|
||||
setImageHeight,
|
||||
}) => {
|
||||
const [activeVotesCount, setActiveVotesCount] = useState(activeVotes.length || 0);
|
||||
const [calcImgHeight, setCalcImgHeight] = useState(300);
|
||||
const [calcImgHeight, setCalcImgHeight] = useState(imageHeight || 300);
|
||||
|
||||
// Component Functions
|
||||
|
||||
@ -98,7 +100,11 @@ const PostCardView = ({
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.postBodyWrapper}>
|
||||
<TouchableOpacity style={styles.hiddenImages} onPress={_handleOnContentPress}>
|
||||
<TouchableOpacity
|
||||
activeOpacity={1}
|
||||
style={styles.hiddenImages}
|
||||
onPress={_handleOnContentPress}
|
||||
>
|
||||
{!isHideImage && (
|
||||
<FastImage
|
||||
source={{ uri: images.image }}
|
||||
@ -115,9 +121,12 @@ const PostCardView = ({
|
||||
: FastImage.resizeMode.cover
|
||||
}
|
||||
onLoad={(evt) => {
|
||||
setCalcImgHeight(
|
||||
(evt.nativeEvent.height / evt.nativeEvent.width) * (dim.width - 18),
|
||||
);
|
||||
if (!imageHeight) {
|
||||
const height =
|
||||
(evt.nativeEvent.height / evt.nativeEvent.width) * (dim.width - 18);
|
||||
setCalcImgHeight(height);
|
||||
setImageHeight(content.author + content.permlink, height);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
@ -500,11 +500,7 @@ const PostsContainer = ({
|
||||
};
|
||||
|
||||
const _matchFreshPosts = async (posts, reducerFilter) => {
|
||||
let cachedPosts = cache.cachedData[reducerFilter].posts;
|
||||
|
||||
if (cachedPosts.length > 5) {
|
||||
cachedPosts = cachedPosts.slice(0, 5);
|
||||
}
|
||||
let cachedPosts = cache.cachedData[reducerFilter].posts.slice(0, 5);
|
||||
|
||||
let newPosts = [];
|
||||
posts.forEach((post, index) => {
|
||||
@ -522,9 +518,8 @@ const PostsContainer = ({
|
||||
: cache.currentFilter === reducerFilter;
|
||||
|
||||
if (newPosts.length > 0 && isRightFilter) {
|
||||
if (newPosts.length > 5) {
|
||||
newPosts = newPosts.slice(0, 5);
|
||||
}
|
||||
newPosts = newPosts.slice(0, 5);
|
||||
|
||||
setNewPostsPopupPictures(newPosts.map((post) => get(post, 'avatar', '')));
|
||||
} else {
|
||||
_scheduleLatestPostsCheck(posts[0]);
|
||||
@ -564,7 +559,7 @@ const PostsContainer = ({
|
||||
|
||||
const subfilter = selectedFeedSubfilterValue;
|
||||
let options = {};
|
||||
const limit = 5;
|
||||
const limit = isLatestPostCheck ? 5 : 20;
|
||||
let func = null;
|
||||
|
||||
if (
|
||||
|
@ -334,6 +334,7 @@ const PostsView = ({
|
||||
|
||||
{newPostsPopupPictures.map((url, index) => (
|
||||
<FastImage
|
||||
key={`image_bubble_${url}`}
|
||||
source={{ uri: url }}
|
||||
style={[styles.popupImage, { zIndex: 10 - index }]}
|
||||
/>
|
||||
|
@ -17,6 +17,8 @@ const postsListContainer = ({
|
||||
}:postsListContainerProps, ref) => {
|
||||
const flatListRef = useRef(null);
|
||||
|
||||
const [imageHeights, setImageHeights] = useState(new Map<string, number>());
|
||||
|
||||
const isHideImages = useSelector((state) => state.ui.hidePostsThumbnails);
|
||||
const posts = useSelector((state) => {
|
||||
return isFeedScreen
|
||||
@ -56,29 +58,50 @@ const postsListContainer = ({
|
||||
|
||||
}, [scrollPosition])
|
||||
|
||||
|
||||
const _setImageHeightInMap = (mapKey:string, height:number) => {
|
||||
if(mapKey && height){
|
||||
setImageHeights(imageHeights.set(mapKey, height));
|
||||
}
|
||||
}
|
||||
|
||||
const _renderItem = ({ item, index }:{item:any, index:number}) => {
|
||||
const e = [];
|
||||
|
||||
if (index % 3 === 0) {
|
||||
const ix = index / 3 - 1;
|
||||
if (promotedPosts[ix] !== undefined) {
|
||||
const p = promotedPosts[ix];
|
||||
if (get(p, 'author', null) && posts && posts.filter((x) => x.permlink === p.permlink).length <= 0) {
|
||||
|
||||
//get image height from cache if available
|
||||
const localId = p.author + p.permlink;
|
||||
const imgHeight = imageHeights.get(localId)
|
||||
|
||||
e.push(
|
||||
<PostCard
|
||||
key={`${p.author}-${p.permlink}-prom`}
|
||||
content={p}
|
||||
isHideImage={isHideImages}
|
||||
imageHeight={imgHeight}
|
||||
setImageHeight = {_setImageHeightInMap}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (get(item, 'author', null)) {
|
||||
//get image height from cache if available
|
||||
const localId = item.author + item.permlink;
|
||||
const imgHeight = imageHeights.get(localId)
|
||||
|
||||
e.push(
|
||||
<PostCard
|
||||
key={`${item.author}-${item.permlink}`}
|
||||
content={item}
|
||||
isHideImage={isHideImages}
|
||||
imageHeight={imgHeight}
|
||||
setImageHeight = {_setImageHeightInMap}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
@ -100,6 +123,7 @@ const postsListContainer = ({
|
||||
maxToRenderPerBatch={3}
|
||||
initialNumToRender={3}
|
||||
windowSize={5}
|
||||
extraData={imageHeights}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
|
@ -1,16 +1,9 @@
|
||||
import React, { PureComponent, Fragment } from 'react';
|
||||
import {
|
||||
View,
|
||||
Image,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
Dimensions,
|
||||
ActivityIndicator,
|
||||
Linking,
|
||||
} from 'react-native';
|
||||
import { View, Text, TouchableOpacity, Dimensions, ActivityIndicator, Linking } from 'react-native';
|
||||
import get from 'lodash/get';
|
||||
|
||||
// Constants
|
||||
import FastImage from 'react-native-fast-image';
|
||||
import LIGHT_COVER_IMAGE from '../../../assets/default_cover_image.png';
|
||||
import DARK_COVER_IMAGE from '../../../assets/dark_cover_image.png';
|
||||
|
||||
@ -134,9 +127,10 @@ class ProfileSummaryView extends PureComponent {
|
||||
) : null,
|
||||
)}
|
||||
</View>
|
||||
<Image
|
||||
<FastImage
|
||||
style={styles.longImage}
|
||||
source={coverImageUrl}
|
||||
resizeMode="cover"
|
||||
defaultSource={isDarkTheme ? DARK_COVER_IMAGE : LIGHT_COVER_IMAGE}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
|
@ -101,6 +101,8 @@ class EditorContainer extends Component {
|
||||
ImagePicker.openPicker({
|
||||
includeBase64: true,
|
||||
multiple: true,
|
||||
mediaType: 'photo',
|
||||
smartAlbums: ['UserLibrary', 'Favorites', 'PhotoStream', 'Panoramas', 'Bursts'],
|
||||
})
|
||||
.then((images) => {
|
||||
this._handleMediaOnSelected(images);
|
||||
@ -113,6 +115,7 @@ class EditorContainer extends Component {
|
||||
_handleOpenCamera = () => {
|
||||
ImagePicker.openCamera({
|
||||
includeBase64: true,
|
||||
mediaType: 'photo',
|
||||
})
|
||||
.then((image) => {
|
||||
this._handleMediaOnSelected(image);
|
||||
|
@ -24,6 +24,7 @@ export const parsePost = (post, currentUserName, isPromoted, isList = false) =>
|
||||
if (!post) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (currentUserName === post.author) {
|
||||
post.markdownBody = post.body;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user