-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from TritonSE/GeneralPrinciplesMainView
After messaging Megan, dimensions issues with styles were fixed and the switch from SafeAreaView to regular View was incorporated for consistency between Android and iOS across regular search page and the general principles main view. Since everything else on this was approved beforehand, we can proceed with the merge.
- Loading branch information
Showing
6 changed files
with
285 additions
and
73 deletions.
There are no files selected for viewing
This file contains 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
Binary file not shown.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import * as Font from "expo-font"; | ||
import React, { useState } from "react"; | ||
import { Pressable, ScrollView, Text, View } from "react-native"; | ||
|
||
import SearchPage from "./SearchPage"; | ||
import styles from "./generalPrinciplesMainStyles"; | ||
|
||
const GeneralPrinciplesMain = () => { | ||
const [fontsLoaded, setFontsLoaded] = useState<boolean>(false); | ||
const [searchShowing, setSearchShowing] = useState(false); | ||
|
||
React.useEffect(() => { | ||
async function loadFont() { | ||
try { | ||
await Font.loadAsync({ | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
"Roboto-Medium": require("../assets/fonts/Roboto-Medium.ttf"), | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
"Roboto-Bold": require("../assets/fonts/Roboto-Bold.ttf"), | ||
}); | ||
setFontsLoaded(true); | ||
} catch (error) { | ||
console.error("Error loading fonts:", error); | ||
} | ||
} | ||
|
||
void loadFont(); | ||
}, []); | ||
|
||
if (!fontsLoaded) { | ||
return <Text>Loading...</Text>; | ||
} | ||
|
||
const renderPressables = () => { | ||
const pressableData = [ | ||
["Emergency Action Plan", "Trauma Centers"], | ||
["Burn Centers", "Stroke Centers"], | ||
["Inclement Weather", "Serious On-Field Injury"], | ||
["Catastrophic Incident", "Administering Medication"], | ||
["Muscle Injuries", "Ligament Injuries"], | ||
["Dislocations/Subluxations", "Fractures"], | ||
]; | ||
|
||
return pressableData.map((row, index) => ( | ||
<View key={index} style={styles.row}> | ||
{row.map((label, colIndex) => ( | ||
<Pressable key={`${index}-${colIndex}`} style={styles.pressable}> | ||
<Text style={styles.pressableText} numberOfLines={0}> | ||
{label} | ||
</Text> | ||
</Pressable> | ||
))} | ||
</View> | ||
)); | ||
}; | ||
|
||
return ( | ||
<View> | ||
<SearchPage onPage={searchShowing} setShowing={setSearchShowing} /> | ||
{!searchShowing && ( | ||
<ScrollView alwaysBounceHorizontal={false} contentContainerStyle={{ flexGrow: 1 }}> | ||
<View style={styles.container}> | ||
<View style={styles.subheader}> | ||
<Text style={styles.subheaderText}>Browse by Category</Text> | ||
</View> | ||
<View style={styles.grid}>{renderPressables()}</View> | ||
</View> | ||
</ScrollView> | ||
)} | ||
</View> | ||
); | ||
}; | ||
|
||
export default GeneralPrinciplesMain; |
Oops, something went wrong.