diff --git a/package.json b/package.json index c02fd7bb1..aa3d99b4f 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@esteemapp/react-native-slider": "^0.12.0", "@hiveio/dhive": "^1.0.1", "@native-html/iframe-plugin": "^2.6.1", + "@native-html/table-plugin": "^5.3.1", "@react-native-community/async-storage": "^1.11.0", "@react-native-community/cameraroll": "^1.3.0", "@react-native-community/cli-platform-ios": "^4.10.1", diff --git a/src/components/comment/view/commentView.tsx b/src/components/comment/view/commentView.tsx index b4e136efd..90c1d6074 100644 --- a/src/components/comment/view/commentView.tsx +++ b/src/components/comment/view/commentView.tsx @@ -233,7 +233,7 @@ const CommentView = ({ onPress={() => handleOnEditPress && handleOnEditPress(comment)} iconType="MaterialIcons" /> - {!childCount && !activeVotes.length && ( + {!childCount && !activeVotes.length && comment.isDeletable && ( { if (!data) { return; @@ -221,6 +224,21 @@ export const PostHtmlRenderer = memo( }; + //based on number of columns a table have, sets scroll enabled or disable, also adjust table full width + const _tableRenderer = ({TDefaultRenderer, ...props}:CustomRendererProps) => { + const tableProps = useHtmlTableProps(props); + + const isScrollable = tableProps.numOfColumns > 3; + const _tableWidth = isScrollable ? tableProps.numOfColumns * _minTableColWidth: contentWidth; + props.style = {width:_tableWidth}; + + return ( + + + + )} + + // iframe renderer for rendering iframes in body const _iframeRenderer = function IframeRenderer(props) { const iframeProps = useHtmlIframeProps(props); @@ -237,7 +255,6 @@ export const PostHtmlRenderer = memo( ) }else{ return ( - , json_metadata?:any, + isDeletable?:boolean, created?:string, //handle created and updated separatly updated?:string, expiresAt?:number, diff --git a/src/screens/editor/children/thumbSelectionContent.tsx b/src/screens/editor/children/thumbSelectionContent.tsx index c5e87f64c..407bdb3e6 100644 --- a/src/screens/editor/children/thumbSelectionContent.tsx +++ b/src/screens/editor/children/thumbSelectionContent.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useState } from 'react'; import { useIntl } from 'react-intl'; -import { Alert, Text, View } from 'react-native'; +import { Text, TouchableOpacity, View } from 'react-native'; import FastImage from 'react-native-fast-image'; -import { FlatList, TouchableOpacity } from 'react-native-gesture-handler'; +import { FlatList } from 'react-native-gesture-handler'; import { extractImageUrls } from '../../../utils/editor'; import styles from './styles'; diff --git a/src/screens/editor/children/thumbSelectionModal.tsx b/src/screens/editor/children/thumbSelectionModal.tsx index 9d063883c..0e23b8fdf 100644 --- a/src/screens/editor/children/thumbSelectionModal.tsx +++ b/src/screens/editor/children/thumbSelectionModal.tsx @@ -1,12 +1,12 @@ import React, { useImperativeHandle, useRef, useState } from 'react'; -import { FlatList, TouchableOpacity } from 'react-native-gesture-handler'; +import { FlatList } from 'react-native-gesture-handler'; import ActionSheet from 'react-native-actions-sheet'; import EStyleSheet from 'react-native-extended-stylesheet'; import styles from './styles'; import { extractImageUrls } from '../../../utils/editor'; import FastImage from 'react-native-fast-image'; import { forwardRef } from 'react'; -import { View, Text, Alert } from 'react-native'; +import { View, Text, Alert, TouchableOpacity } from 'react-native'; import { useIntl } from 'react-intl'; diff --git a/src/utils/postParser.tsx b/src/utils/postParser.tsx index dbbbbb81f..98f3c281e 100644 --- a/src/utils/postParser.tsx +++ b/src/utils/postParser.tsx @@ -165,6 +165,8 @@ export const parseComment = (comment:any) => { comment.total_payout = totalPayout; + comment.isDeletable = !(comment.active_votes?.length > 0 ||comment.children > 0 || comment.net_rshares > 0 || comment.is_paidout); + //stamp comments with fetched time; comment.post_fetched_at = new Date().getTime(); diff --git a/yarn.lock b/yarn.lock index c4f8ef782..a4fd6d26e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1138,7 +1138,7 @@ resolved "https://registry.yarnpkg.com/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz#2dc8c57044de0340eb53a7ba602e59abf80dc799" integrity sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ== -"@formidable-webview/webshell@^2.6.0": +"@formidable-webview/webshell@2.6.0", "@formidable-webview/webshell@^2.6.0": version "2.6.0" resolved "https://registry.yarnpkg.com/@formidable-webview/webshell/-/webshell-2.6.0.tgz#64704c0b513206e71b23118b3c9d096f0d545005" integrity sha512-FwQQDajg1xs7W3CUiUNJMvdjgLjKLDGzs0XPzoVg0Dunhold1Jg7w5pihUdvVugFlNtkSpXMA+du9QDHE8lmpg== @@ -1452,6 +1452,16 @@ resolved "https://registry.yarnpkg.com/@native-html/plugins-core/-/plugins-core-1.3.0.tgz#f1f24622097551930d9dab0214c4929d00f7446e" integrity sha512-vce35gqGJKa2oPDZVa2sKjucFFVK+3g8quLayeXiJtj5LzuS8TWGrBFTS5O4ToUtE02AJkCDOLwAguCzK2HWdQ== +"@native-html/table-plugin@^5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@native-html/table-plugin/-/table-plugin-5.3.1.tgz#12d34869c2ff3e5f45de6ff6a8b5aba1471a8a03" + integrity sha512-zz1ww7tUgIY6fMnKYejKHacaUBV+yjuWDBWDwSp4SP0CFiLAbmLIER0UGw0kI58lAVgbWzdEJUX0dmeBG0qevA== + dependencies: + "@formidable-webview/webshell" "2.6.0" + "@native-html/plugins-core" "1.3.0" + "@types/prop-types" "^15.7.4" + prop-types "^15.7.2" + "@native-html/transient-render-engine@^9.2.2": version "9.2.2" resolved "https://registry.yarnpkg.com/@native-html/transient-render-engine/-/transient-render-engine-9.2.2.tgz#00691518926ea47709185c3a25a786472c99a1f0"