post card image size set

This commit is contained in:
feruz 2021-01-16 14:51:12 +02:00
parent 6515c0b5c3
commit c170cf6203
5 changed files with 15 additions and 8 deletions

View File

@ -714,4 +714,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 1f30c7da5061dbc47185442a6ab4a3c95ac48c04
COCOAPODS: 1.10.0
COCOAPODS: 1.9.3

View File

@ -14,7 +14,7 @@ export default EStyleSheet.create({
color: '$primaryBlack',
backgroundColor: '$primaryBackgroundColor',
// fontFamily: '$editorFont',
//textAlignVertical: 'top',
// textAlignVertical: 'top',
},
previewContainer: {
flex: 1,

View File

@ -44,6 +44,7 @@ const MarkdownEditorView = ({
const [text, setText] = useState(draftBody || '');
const [selection, setSelection] = useState({ start: 0, end: 0 });
const [editable, setEditable] = useState(true);
const [height, setHeight] = useState(0);
const inputRef = useRef(null);
const galleryRef = useRef(null);
@ -260,7 +261,7 @@ const MarkdownEditorView = ({
<TextInput
multiline
autoCorrect={true}
autoFocus={false}
autoFocus={isReply ? true : false}
onChangeText={_changeText}
onSelectionChange={_handleOnSelectionChange}
placeholder={intl.formatMessage({

View File

@ -32,8 +32,8 @@ export default EStyleSheet.create({
margin: 0,
alignItems: 'center',
alignSelf: 'center',
height: 200,
width: '$deviceWidth - 16',
//height: 200,
//width: '$deviceWidth - 16',
borderRadius: 8,
backgroundColor: '$primaryLightGray',
},

View File

@ -1,6 +1,6 @@
import React, { Component, useState, useEffect } from 'react';
import get from 'lodash/get';
import { TouchableOpacity, Text, View } from 'react-native';
import { TouchableOpacity, Text, View, Dimensions } from 'react-native';
import FastImage from 'react-native-fast-image';
import { injectIntl } from 'react-intl';
@ -21,6 +21,8 @@ import styles from './postCardStyles';
import DEFAULT_IMAGE from '../../../assets/no_image.png';
import NSFW_IMAGE from '../../../assets/nsfw.png';
const { width } = Dimensions.get('window');
const PostCardView = ({
handleOnUserPress,
handleOnContentPress,
@ -36,6 +38,7 @@ const PostCardView = ({
}) => {
const [rebloggedBy, setRebloggedBy] = useState(get(content, 'reblogged_by[0]', null));
const [activeVot, setActiveVot] = useState(activeVotes);
const [calcImgHeight, setCalcImgHeight] = useState(0);
//console.log(activeVotes);
// Component Functions
@ -103,10 +106,13 @@ const PostCardView = ({
<TouchableOpacity style={styles.hiddenImages} onPress={_handleOnContentPress}>
{!isHideImage && (
<FastImage
style={[styles.thumbnail, { width: width - 16, height: calcImgHeight }]}
source={_image}
resizeMode={FastImage.resizeMode.contain}
style={styles.thumbnail}
resizeMode={FastImage.resizeMode.cover}
defaultSource={DEFAULT_IMAGE}
onLoad={(evt) =>
setCalcImgHeight((evt.nativeEvent.height / evt.nativeEvent.width) * width)
}
/>
)}
<View style={[styles.postDescripton]}>