NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Tab bar on active Tab doesn't start at initialPage

Open AnthonyAltieri opened this issue 9 years ago • 80 comments

Pushing this issue #665

react: 16.0.0-alpha.6 react-native: 0.44.0 native-base: 2.1.5

Expected Behavior: Tab bar should be under the tab that initialPage is set to

Actual Behavior: The content is displayed of the initial Page but the bar is in the 0 position always, scrolling horizontal slightly makes the bar update to the correct place.

Platform: Only have tried IOS, not sure if it doesn't work in android.

Note: I'm more than willing to fix this myself and submit a PR but I'm not sure where the bar on the active Tab is generated, I've attempted to trace the code but couldn't find it. If anyone can point out where that is created I can probably fix this myself and submit a PR. Thanks!

AnthonyAltieri avatar Jul 02 '17 21:07 AnthonyAltieri

Hey guys, first, you did great work on this library! I just want to check what the current status of this issue is?
@shivrajkumar, I saw you self-assigned it. Any progress? :)

yannickschuchmann avatar Jul 29 '17 19:07 yannickschuchmann

hey guys, anyone can add this feature please? any updates?

xempie avatar Nov 29 '17 16:11 xempie

@xempie There is a PR open for it Soon we will merge it

SupriyaKalghatgi avatar Nov 30 '17 05:11 SupriyaKalghatgi

Was this fixed? When will it be merged? Or else, how can I manually do a temporary fix?

leekuo avatar Dec 12 '17 23:12 leekuo

@leekuo Merging it this week

SupriyaKalghatgi avatar Dec 13 '17 03:12 SupriyaKalghatgi

Thank you very much @SupriyaKalghatgi ! Native base is incredible to use so far and am eagerly anticipating this fix so we can deploy our first react native app!

leekuo avatar Dec 13 '17 20:12 leekuo

@leekuo Happy to hear that

SupriyaKalghatgi avatar Dec 14 '17 05:12 SupriyaKalghatgi

Any updates on the new release that will fix this?

rodrigoreis22 avatar Dec 19 '17 20:12 rodrigoreis22

Merging it today

SupriyaKalghatgi avatar Dec 20 '17 05:12 SupriyaKalghatgi

was this merged?

xempie avatar Dec 23 '17 03:12 xempie

PR has some issue #1376 #1443

SupriyaKalghatgi avatar Jan 03 '18 11:01 SupriyaKalghatgi

Fixed with 2.3.6

SupriyaKalghatgi avatar Jan 05 '18 06:01 SupriyaKalghatgi

Trying out the new 2.3.6 release. The tab content does render correctly instead of blank when initialPage is set. But the selected tab underline still incorrectly underlines the first tab. Anyone else seeing this issue?

Edit: Well I have solved this problem by removing initialPage, creating a ref to the Tabs component, and then calling goToPage() function in the parent component's componentDidMount(). Seems to work so far.

leekuo avatar Jan 05 '18 21:01 leekuo

@leekuo Can you provide an example please? Thx a ton!

ziudeso avatar Jan 06 '18 08:01 ziudeso

@leekuo https://github.com/GeekyAnts/NativeBase/issues/1010#issuecomment-354988401

SupriyaKalghatgi avatar Jan 09 '18 05:01 SupriyaKalghatgi

This problem persists on 2.3.6 and 2.3.7. Setting initialPage to other than zero triggers all problems described here.

I've followed the steps @leekuo proposed, but in my case I've had to put a setTimeout to make it work. Ugly, but it is working. If I could manage to skip the animation triggered by goToPage() I could make this issue go unnoticed until we find a fix.

@ziudeso If you still interested in an example

class Home extends Component {
  componentDidMount(){
    setTimeout(this._tabs.goToPage.bind(this._tabs,1))
  }
  render(){
    return <Tabs ref={component => this._tabs = component}>
      //individual tabs here
   </Tabs>
  }
}

Hopefully, this example can lead you guys to find a permanent solution - a setTimeout delaying the execution of goToTabs() and fixing the problem could mean that something isn't firing before the component mounts.

Thanks everyone!

Yarkhan avatar Jan 20 '18 11:01 Yarkhan

U are the best @Yarkhan! thanks a lot!

ziudeso avatar Jan 21 '18 07:01 ziudeso

I have much of the same issues. On IOS the first page is rendered ok. On Android (emulator, API 24) the first page is not drawn corretly. The second, third etc. pages are drawn correctly. Example:

Images illustrating the issue https://drive.google.com/open?id=1qrVzsjj9a-uuqEJkRXAEkQzRtCz9yiDZ

Package "expo": "^24.0.0", "native-base": "^2.3.7", "react": "16.0.0", "react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz",

Sigve84 avatar Jan 23 '18 11:01 Sigve84

@SupriyaKalghatgi Which click event works on the tab?

MatheusLima7 avatar Jan 23 '18 12:01 MatheusLima7

@SupriyaKalghatgi How to listen when changing tab?

MatheusLima7 avatar Jan 23 '18 13:01 MatheusLima7