import React from "react"; import { Pressable, StyleSheet, Text, View } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { moderateScale, verticalScale } from "react-native-size-matters"; import { Colors } from "@/theme"; import { asNumber, asString } from "../helpers/value"; import { CollectionScaffold } from "../shared/CollectionScaffold"; import type { CollectionItemRendererProps, CollectionRendererProps, } from "../../types/renderer.types"; export function PathogenicFactorsCollectionRenderer( props: CollectionRendererProps, ) { const header = ( Overview This method of pattern identification is based on the pathological changes occurring when the body is invaded by pathogenic factors such as Wind, Cold, Summer-Heat, Dampness, Dryness and Fire. Each of these pathogenic factors may be exterior or interior. They always correspond to a Full pattern according to the Eight Principles. Indeed, from the Eight-Principle point of view, a Full condition is defined as one characterized by the presence of a pathogenic factor while the body’s Qi is still relatively intact. The pathogenic factor is frequently associated with a Deficiency, in which case the condition is a combined Full–Empty condition. With regard to pathogenic factors, a combined Full-Empty condition can arise in one of two ways: a pathogenic factor can give rise to a Deficiency (e.g. Fire weakens Yin) or a Deficiency can give rise to a pathogenic factor (e.g. Spleen-Qi deficiency gives rise to Dampness). Generally speaking, pathogenic factors are more relevant as patterns of disharmony than as causes of disease. The diagnosis of a pathogenic factor is made not on the basis of the patient’s history, but on the basis of the pattern of symptoms and signs presented. Pathogenic Factors ); const sortedItems = React.useMemo(() => { return [...props.items].sort((a, b) => { const orderA = asNumber(a.attributes.sort_order) ?? 999; const orderB = asNumber(b.attributes.sort_order) ?? 999; return orderA - orderB; }); }, [props.items]); return ; } export function PathogenicFactorsCardRenderer({ item, onPress, }: CollectionItemRendererProps) { const a = item.attributes; const title = asString(a.name) || asString(a.title) || item.title; const overview = asString(a.overview) || asString(a.content) || item.summary; const sortOrder = asNumber(a.sort_order); const factorNumber = typeof sortOrder === "number" && sortOrder > 0 ? sortOrder : undefined; return ( [styles.row, pressed && styles.pressed]} > {factorNumber !== undefined ? ( {factorNumber} ) : ( )} {title} {overview ? ( {overview} ) : null} ); } const styles = StyleSheet.create({ overviewContainer: { marginBottom: verticalScale(14), }, overviewCard: { backgroundColor: "#FFFFFF", borderRadius: moderateScale(16), borderWidth: 1, borderColor: "#E2EAE5", padding: moderateScale(16), marginBottom: verticalScale(14), }, overviewHeader: { flexDirection: "row", alignItems: "center", marginBottom: verticalScale(8), gap: moderateScale(8), }, overviewTitle: { fontSize: moderateScale(16), fontWeight: "700", color: Colors.textPrimary, }, overviewText: { fontSize: moderateScale(13), lineHeight: verticalScale(19), color: Colors.textSecondary, }, overviewParagraph: { fontSize: moderateScale(13), lineHeight: verticalScale(19), color: Colors.textSecondary, marginTop: verticalScale(10), }, sectionHeading: { fontSize: moderateScale(15), fontWeight: "700", color: Colors.textPrimary, marginBottom: verticalScale(4), marginLeft: moderateScale(4), }, row: { minHeight: verticalScale(72), flexDirection: "row", alignItems: "center", paddingHorizontal: moderateScale(14), paddingVertical: verticalScale(13), gap: moderateScale(11), }, pressed: { opacity: 0.72, }, iconBox: { width: moderateScale(40), height: moderateScale(40), borderRadius: moderateScale(20), alignItems: "center", justifyContent: "center", backgroundColor: "#E8F5E9", }, factorNumber: { fontSize: moderateScale(16), fontWeight: "800", color: Colors.primaryDark, }, content: { flex: 1, gap: verticalScale(3), }, title: { fontSize: moderateScale(16), lineHeight: moderateScale(22), fontWeight: "700", color: Colors.textPrimary, }, subtitle: { fontSize: moderateScale(12.5), lineHeight: moderateScale(18), color: Colors.textSecondary, }, });