react-native-ui-lib
Version:
<p align="center"> <img src="https://user-images.githubusercontent.com/1780255/105469025-56759000-5ca0-11eb-993d-3568c1fd54f4.png" height="250px" style="display:block"/> </p> <p align="center">UI Toolset & Components Library for React Native</p> <p a
36 lines (30 loc) • 871 B
JavaScript
import { isEmpty } from 'lodash';
import React, { useMemo } from 'react';
import View from "../../components/view";
import DialogText from "./DialogText";
import DialogKnob from "./DialogKnob";
import DialogDivider from "./DialogDivider";
const DialogHeader = (props = {}) => {
const {
text = {},
renderContent,
showKnob = true,
showDivider = true,
...others
} = props;
const _renderContent = useMemo(() => {
if (renderContent) {
return renderContent(props);
}
return <DialogText text={text} />; // eslint-disable-next-line react-hooks/exhaustive-deps
}, [renderContent, text]);
if (!isEmpty(props)) {
return <View {...others}>
<DialogKnob showKnob={showKnob} />
{_renderContent}
<DialogDivider showDivider={showDivider} />
</View>;
}
return null;
};
export default DialogHeader;