Skip to content

Commit

Permalink
Add some more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
VishruthR committed Feb 25, 2023
1 parent 0cfada5 commit 890d17b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 10 deletions.
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"react-native-pager-view": "^6.1.4",
"react-native-safe-area-context": "^4.5.0",
"react-native-screens": "^3.20.0",
"react-native-sound": "^0.11.2",
"react-native-sound-player": "^0.13.2",
"react-native-svg": "13.4.0",
"react-native-tab-view": "^3.5.0",
"styled-components": "^5.3.6"
Expand Down
29 changes: 22 additions & 7 deletions src/components/Ring.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@ import {
} from "react-native";
import { SvgXml } from "react-native-svg";

export const Ring = () => {
export const Ring = ({ safe, setRingPlease }) => {
const [ring, setRing] = useState(false);
setRingPlease(ring);

return (
<View style={styles.ringContainer}>
<Text style={styles.ringText}>
{ring ? "Your phone is ringing" : "Your phone is not ringing"}
</Text>
{safe ? (
<Text style={styles.safeText}>We marked you as safe!</Text>
) : (
<>
<Text style={styles.ringText}>
{ring ? "Your phone is ringing" : "Your phone is not ringing"}
</Text>

<TouchableOpacity onPress={() => setRing(!ring)}>
<SvgXml xml={ring ? unmuted : muted} width={42} height={42} />
</TouchableOpacity>
<TouchableOpacity onPress={() => setRing(!ring)}>
<SvgXml xml={ring ? unmuted : muted} width={42} height={42} />
</TouchableOpacity>
</>
)}
</View>
);
};
Expand Down Expand Up @@ -64,4 +71,12 @@ const styles = StyleSheet.create({
bottom: 5,
flexGrow: 1,
},
safeText: {
fontSize: 15,
color: "#fff",
fontWeight: "bold",
bottom: 5,
flexGrow: 1,
paddingBottom: 40,
},
});
9 changes: 6 additions & 3 deletions src/screens/WarningPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
import { Progress } from "../components/Progress";
import { Ring } from "../components/Ring";

import Timer from "../components/Timer";

const steps = [
{
number: 1,
Expand All @@ -28,6 +26,7 @@ const time = "2:59";

export const WarningPage = () => {
const [safe, setSafe] = useState(false);
const [ring, setRing] = useState(false);
const [timeout, setTimeout] = useState(false);

return (
Expand Down Expand Up @@ -70,7 +69,11 @@ export const WarningPage = () => {
})}
</View>

{timeout ? <Ring /> : <Progress setTimeout={setTimeout} />}
{timeout ? (
<Ring safe={safe} setRingPlease={setRing} />
) : (
<Progress setTimeout={setTimeout} />
)}

<TouchableOpacity onPress={() => setSafe(!safe)}>
<View
Expand Down

0 comments on commit 890d17b

Please sign in to comment.