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