CCS332 App Lab Ex Set 1
CCS332 App Lab Ex Set 1
use react
native to do the same
Before starting, make sure you have Node.js, npm (or Yarn), and React Native CLI installed
on your machine. You'll also need an emulator or a physical device to test your app.
3. Install Dependencies
You may need some additional libraries for styling and form handling, such as react-
native-paper for UI components.
Here’s a basic example of how you could create the BMI calculator in React Native:
App.js
return (
<PaperProvider>
<View style={styles.container}>
<Text style={styles.title}>BMI Calculator</Text>
<PaperInput
label="Weight (kg)"
value={weight}
onChangeText={setWeight}
keyboardType="numeric"
style={styles.input}
/>
<PaperInput
label="Height (m)"
value={height}
onChangeText={setHeight}
keyboardType="numeric"
style={styles.input}
/>
<PaperButton mode="contained" onPress={calculateBMI}
style={styles.button}>
Calculate BMI
</PaperButton>
{bmi && (
<Text style={styles.result}>Your BMI is {bmi}</Text>
)}
</View>
</PaperProvider>
);
};