-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can height be set in percentages? #28
Comments
Hi @zbillones-navagis @mtrecenio-navagis, can you please take a look at this? is it possible? |
any update on this? Right now we have to calculate the space we have and then set the height of the maps. It would be very useful to be able to set height 100% and use all space that's available |
Hi @ziga-hvalec , you can set percentage as well in your app.tsx. You can create methods that takes percentage as parameter like this:
and pass it as the height and width of the navView component
|
Maybe i didn't explain this well. We have a custom header at the top and a button at the bottom. I would like to use the rest of the space for the map. Hope this is a better explanation. |
NavigationView can be resized to your desired percentage using the above-mentioned code snippet. With the help of Flexbox, you can achieve the behavior of NavigationView that can take the remaining space without calculating what specific height to set. Just define the height of your header and button and NavigationView will take the rest of the space.
|
Currently both height and width are required or nothing gets rendered at all. Unless this has been changed.
Žiga Hvalec
Web Developer @d.labs
…On Mar 18, 2024, 03:23 +0100, mtrecenio-navagis ***@***.***>, wrote:
NavigationView can be resized to your desired percentage using the above-mentioned code snippet. With the help of Flexbox, you can achieve the behavior of NavigationView that can take the remaining space without calculating what specific height to set. Just define the height of your header and button and NavigationView will take the rest of the space.
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
header: {
height: 50, // Adjust this according to your header's height
},
mapContainer: {
flex: 1,
},
map: {
flex: 1,
},
buttonContainer: {
height: 50, // Adjust this according to your button's height
},
});
const FlexboxSample = () => {
return (
<View style={styles.container}>
<View style={styles.header}>
</View>
<View style={styles.mapContainer}>
<NavigationView style={styles.map} />
</View>
<View style={styles.buttonContainer}>
<Button/>
</View>
</View>
);
};
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Can you please take a look at @ziga-hvalec response @mtrecenio-navagis @zbillones-navagis? CC @reignbartolome |
@mtrecenio-navagis - can you please share an updated code sample where height/width are passed to |
@ArturoSalazarB16 - here we created a function to accept value as percentage for both width and height and set it to NavigationView. You can set it to 100 for both width and height and it will occupy the remaining space inside parent component. |
Hi @ziga-hvalec - can you please take a look at @mtrecenio-navagis snippet and see if this suffices? Thank you! |
the above only works if maps is full screen. we have some of our own ui bellow the map. which makes the map not as tall as the screen. |
Hi @ziga-hvalec, have you tried using the flexbox layout approach? Otherwise, you have to get the height of the corresponding views manually and calculate the exact size you need for the height. as of now, width and height must be defined just like any other views or component. We don't have the automatic width or height distribution as of the moment. cc: @mtrecenio-navagis |
flexbox doesn't help since NavigationView needs height and width provided as a number. |
Thanks for the context here @ziga-hvalec. |
FYI @jokerttu - this is related to what we discussed today about Flex layouts |
Are we expecting this to be implemented soon? |
Hi @nexttrack07 |
Right now the only way to set height is to set it as a number.
We would like to add some content under the navigation view so we can't set the height as a number.
Can we set height in percentages to be able to have content under that map?
The text was updated successfully, but these errors were encountered: