35 lines
1.4 KiB
TypeScript
35 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { ScrollView, TouchableOpacity, Alert, Text, GestureResponderEvent, Dimensions } from 'react-native';
|
|
import RenderHtml, { TChildrenRenderer } from 'react-native-render-html';
|
|
import { Cfg } from './action';
|
|
import Ionicons from '@expo/vector-icons/Ionicons';
|
|
import { FAB } from 'react-native-elements';
|
|
|
|
export function FabRenderer({
|
|
...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);
|
|
}
|
|
}
|
|
|
|
const windowHeight = Dimensions.get('window').height;
|
|
const scrollViewHeight = windowHeight - (attribs.min ? attribs.min : 380); // Subtracting 90 from the total height
|
|
|
|
return (
|
|
<FAB onPress={onPress} color={attribs.background ? attribs.background : '#16a34a'} icon={{ color: attribs.color ? attribs.color : 'white', name: attribs.icon ? attribs.icon:"add"}} style={{position:"absolute", bottom:20, right:20}}/>
|
|
);
|
|
} |