react-native-tab-view icon indicating copy to clipboard operation
react-native-tab-view copied to clipboard

Allow children dictate height

Open daniel112 opened this issue 4 years ago • 10 comments

Please provide enough information so that others can review your pull request:

Motivation A follow up to this comment: https://github.com/satya164/react-native-tab-view/pull/1198#issuecomment-889945740

There exists some use case where we want to embed this tab view within a view (typically a scroll view), doing so does not properly set the height UNLESS you specifically give TabView a static height. In some cases, our content needs to be dynamic so setting a specific height prior to rendering the content will not look great.

This PR covers the edge case where:

  • you want to embed a tabview that's not full screen and/or is within another view
  • your content is dynamic is height

Test plan

  • I've added an example to the /example folder to better visualize this, but I also have been using this modified version in my production application

Before changes

https://user-images.githubusercontent.com/3317835/127685333-27d745f6-3614-44b0-aa9b-dc0febd25d39.mp4

After changes

https://user-images.githubusercontent.com/3317835/127685318-afdb8c1f-f36f-4b3b-943a-e8841032271b.mp4

https://user-images.githubusercontent.com/3317835/124084979-67bb8900-da04-11eb-842b-98980a40a798.mp4

daniel112 avatar Jul 30 '21 16:07 daniel112

Hey daniel112! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines.

github-actions[bot] avatar Jul 30 '21 16:07 github-actions[bot]

@satya164 - opening PR with examples as requested - https://github.com/satya164/react-native-tab-view/pull/1198

daniel112 avatar Jul 30 '21 16:07 daniel112

Hey! When will this be available? :)

bayerlse avatar Nov 30 '21 11:11 bayerlse

I had this issue which pretty much stopped me from being able to use the component. I downloaded the source from the fork and it works great for me.

SpeedOfSpin avatar Jan 06 '22 13:01 SpeedOfSpin

HI. I'm in trouble solving this issue. When will it be applied?

blackSooooo avatar Jan 07 '22 07:01 blackSooooo

Don't think this fixes the issue entirely, it is working indeed, but there is this unwanted behaviour visible on an attached original video, where the height is being set only after swipe is done, and if heights of the content are different it does not look good (even more if you do swipe with a finger and you don't see any content until you release the finger). In v2 this was not the case, heights were set before swipe is done, so you could go back and forth between tabs with different heights without any visual glitches.

Progress Result
Screenshot 2022-01-07 at 14 16 29 Screenshot 2022-01-07 at 14 16 42

demchenkoalex avatar Jan 07 '22 13:01 demchenkoalex

Also stuck without this fix, cannot upgrade to react-navigation 6, what is blocking?

fknop avatar Jan 22 '22 16:01 fknop

It's such a shame this fix is not merged yet. More than 6 months after.

pistou avatar Feb 10 '22 13:02 pistou

please merge this! I lost days working around this issue. This branch fixed my issue with zero code changes on my end!

beerent avatar Jul 27 '22 13:07 beerent

This PR is fixing the problem with the height of screens. I am using the fork version at the moment and hopefully this will be merged soon.

bledar avatar Aug 03 '22 09:08 bledar

Hey @daniel112 can you sync this with the main branch? So we can get back to working on this and merge it.

okwasniewski avatar Aug 29 '22 19:08 okwasniewski

Hey @daniel112 can you sync this with the main branch? So we can get back to working on this and merge it.

@okwasniewski I no longer have access to the forked repo. So I forked it on my personal account and have an identical updated PR here: https://github.com/satya164/react-native-tab-view/pull/1383

feel free to close this one when you're ready

daniel112 avatar Aug 29 '22 21:08 daniel112