import React, { useState } from 'react'; import { View, Text, TextInput, Button, StyleSheet } from 'react-native'; const BMICalculator = () => { const [weight, setWeight] = useState(''); const [height, setHeight] = useState(''); const [bmi, setBmi] = useState(null); const [status, setStatus] = useState(''); const calculateBMI = () => { const w = parseFloat(weight); const h = parseFloat(height) / 100; if (w > 0 && h > 0) { const bmiValue = (w / (h * h)).toFixed(2); setBmi(bmiValue); setStatus(getBMIStatus(bmiValue)); } else { setBmi(null); setStatus(''); } }; const getBMIStatus = (bmi: string): string => { const bmiValue = parseFloat(bmi); if (bmiValue < 18.5) return 'Alulsúlyos'; if (bmiValue < 24.9) return 'Normál súlyú'; if (bmiValue < 29.9) return 'Túlsúlyos'; return 'Elhízott'; }; return ( BMI Kalkulátor