mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 04:41:43 +03:00
added body in text input and bodyDiff in renderPostBody
This commit is contained in:
parent
3aab1e5a7c
commit
29891cb238
@ -11,7 +11,7 @@ import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { BasicHeader, Icon, PostBody } from '../../components';
|
||||
import { BasicHeader, Icon, PostBody, TextInput } from '../../components';
|
||||
import { diff_match_patch } from 'diff-match-patch';
|
||||
|
||||
// styles
|
||||
@ -145,35 +145,34 @@ const EditHistoryScreen = ({ navigation }) => {
|
||||
);
|
||||
|
||||
const _renderDiff = (item: CommentHistoryListItemDiff) => {
|
||||
const previewTitle = renderPostBody(item.titleDiff, true, Platform.OS === 'ios' ? false : true);
|
||||
const previewTags = renderPostBody(item.tagsDiff, true, Platform.OS === 'ios' ? false : true);
|
||||
const previewBody = renderPostBody(item.bodyDiff, true, Platform.OS === 'ios' ? false : true);
|
||||
return (
|
||||
<View style={styles.diffContainer}>
|
||||
<Text style={styles.titleDiff}>{item.titleDiff}</Text>
|
||||
<PostBody body={previewTitle} />
|
||||
<View style={styles.tagsContainer}>
|
||||
<Icon style={styles.tagIcon} iconType="AntDesign" name={'tag'} />
|
||||
<Text style={styles.tags}>{item.tagsDiff}</Text>
|
||||
<PostBody body={previewTags} width={screenWidth - 50} />
|
||||
</View>
|
||||
<Text style={styles.bodyDiff}>{item.bodyDiff}</Text>
|
||||
|
||||
<PostBody body={previewBody} />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const _renderPreview = (selectedItem: CommentHistoryListItemDiff) => {
|
||||
const previewBody = renderPostBody(
|
||||
selectedItem.body,
|
||||
true,
|
||||
Platform.OS === 'ios' ? false : true,
|
||||
);
|
||||
const _renderPlainBody = (selectedItem: CommentHistoryListItemDiff) => {
|
||||
return (
|
||||
<>
|
||||
<View style={styles.postHeaderContainer}>
|
||||
<Text style={styles.postHeaderTitle}>{selectedItem.title}</Text>
|
||||
<TextInput value={selectedItem.title} style={styles.postHeaderTitle} multiline={true} />
|
||||
<View style={styles.tagsContainer}>
|
||||
<Icon style={styles.tagIcon} iconType="AntDesign" name={'tag'} />
|
||||
<Text style={styles.tags}>{selectedItem.tags}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.bodyContainer}>
|
||||
<PostBody body={previewBody} onLoadEnd={() => setIsLoading(false)} width={screenWidth} />
|
||||
<TextInput value={selectedItem.body} style={styles.postBodyText} multiline={true} />
|
||||
</View>
|
||||
</>
|
||||
);
|
||||
@ -189,7 +188,7 @@ const EditHistoryScreen = ({ navigation }) => {
|
||||
style={[styles.previewScroll]}
|
||||
contentContainerStyle={styles.previewScrollContentContainer}
|
||||
>
|
||||
{showDiff ? _renderDiff(selectedItem) : _renderPreview(selectedItem)}
|
||||
{showDiff ? _renderDiff(selectedItem) : _renderPlainBody(selectedItem)}
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
@ -44,6 +44,13 @@ export default EStyleSheet.create({
|
||||
fontFamily: '$primaryFont',
|
||||
marginBottom: 11,
|
||||
},
|
||||
postBodyText:{
|
||||
fontSize: 16,
|
||||
color: '$primaryBlack',
|
||||
fontWeight: 'bold',
|
||||
fontFamily: '$primaryFont',
|
||||
marginBottom: 12,
|
||||
},
|
||||
tagsContainer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
@ -52,10 +59,10 @@ export default EStyleSheet.create({
|
||||
fontSize: 14,
|
||||
color: '$primaryBlack',
|
||||
fontFamily: '$primaryFont',
|
||||
marginLeft: 12,
|
||||
},
|
||||
tagIcon: {
|
||||
color: '$primaryDarkGray'
|
||||
color: '$primaryDarkGray',
|
||||
marginRight: 12,
|
||||
},
|
||||
rightIcon: {
|
||||
backgroundColor: '$primaryDarkGray',
|
||||
|
Loading…
Reference in New Issue
Block a user