Last active
April 26, 2020 01:39
-
-
Save themakshter/1396a7482b06aefeaf9e6db3b9508283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateDummyReadings(){ | |
return { | |
peep: getRandomValue(10), | |
peakPressure: getRandomValue(100, 100), | |
patientRate: getRandomValue(220), | |
vte: getRandomValue(700), | |
inspiratoryTime: getRandomValue(3), | |
expiratoryTime: getRandomValue(5), | |
oxygen: getRandomValue(100), | |
flow: getRandomValue(30, 10) | |
} | |
} | |
function getRandomValue(range, valueToSubtract = 0){ | |
return (Math.random() * range) - valueToSubtract; | |
} | |
// HomeScreen.js | |
export default function HomeScreen() { | |
const [readings, setReadings] = useState({}); | |
React.useEffect(() => { | |
const interval = setInterval(() => { | |
const newReadings = generateDummyReadings(); | |
setReadings(newReadings); | |
}, 2000); | |
return () => clearInterval(interval); | |
}, []) | |
return ( | |
<View style={styles.container}> | |
<View style={styles.peakpressure}> | |
<PeepPressure></PeepPressure> | |
</View> | |
<View | |
style={{ flex: 5, height: "100%", backgroundColor: "white" }} | |
></View> | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment