36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { ScrollView, Image, TouchableOpacity, Alert, Text, GestureResponderEvent, Dimensions } from 'react-native';
|
|
import RenderHtml, { TChildrenRenderer } from 'react-native-render-html';
|
|
import { Cfg } from './action';
|
|
|
|
export function ImgRoundedRenderer({
|
|
...props
|
|
}: {
|
|
[key: string]: any;
|
|
}) {
|
|
const { tnode } = props;
|
|
const { domNode } = tnode;
|
|
const { attribs } = domNode;
|
|
|
|
const onPress = () => {
|
|
const config = Cfg.action as { [key: string]: (event: Function) => void };
|
|
const custAction: ((event: Function) => void) | null =
|
|
(attribs?.action && typeof config[attribs?.action] === 'function')
|
|
? config[attribs?.action]
|
|
: null;
|
|
if (custAction) {
|
|
attribs.pop = custAction;
|
|
custAction(attribs);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
<Image src={attribs.src ? attribs.src : ''} style={[props.style, {
|
|
borderColor: attribs.color ? attribs.color: 'none'
|
|
, borderWidth: attribs.border ? Number(attribs.border): 0
|
|
}
|
|
]} />
|
|
);
|
|
} |