This repository has been archived by the owner on Aug 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7a0d44
commit c9a28bf
Showing
4 changed files
with
41 additions
and
28 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
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 |
---|---|---|
@@ -1,28 +1,39 @@ | ||
import React from 'react' | ||
import { StyleSheet, View, Text, Dimensions } from 'react-native' | ||
import { StyleSheet, View, Text, Dimensions, type ViewProps } from 'react-native' | ||
import { Map } from './components/Map' | ||
import { Sheet } from './components/Sheet' | ||
import { GestureHandlerRootView } from 'react-native-gesture-handler'; | ||
|
||
/** | ||
* Controls the percentage of the screen taken up by the bottom sheet in | ||
* it's collapsed state. | ||
*/ | ||
const SHEET_EXTENT = 0.5 | ||
|
||
/** | ||
* The main screen containing the map and sheet components. | ||
*/ | ||
export function Main(): React.ReactElement<void> { | ||
export function Main(_: ViewProps): React.ReactElement<void> { | ||
// The bottom sheet extends halfway across the screen, with the map | ||
// being inset accordingly. | ||
const halfwayExtent = 0.5 | ||
const halfwayInset = Dimensions.get('window').height * halfwayExtent | ||
const mapInsets = { top: 0, left: 0, bottom: halfwayInset, right: 0 } | ||
const screenHeight = Dimensions.get('window').height | ||
const mapInsets = { | ||
top: 0, | ||
left: 0, | ||
// Inset the map so that elements are not obscured by the bottom sheet | ||
bottom: screenHeight * SHEET_EXTENT, | ||
right: 0 | ||
} | ||
|
||
return ( | ||
<View> | ||
<GestureHandlerRootView> | ||
<Map style={StyleSheet.absoluteFillObject} | ||
insets={mapInsets} /> | ||
<Sheet collapsedExtent={halfwayExtent}> | ||
<Sheet collapsedExtent={SHEET_EXTENT}> | ||
<View> | ||
<Text>Paula</Text> | ||
<Text>Brilliant</Text> | ||
<Text>Hello World</Text> | ||
</View> | ||
</Sheet> | ||
</View> | ||
</GestureHandlerRootView> | ||
) | ||
} |
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