Closed
Description
It's actually currentPage
since it reacts to changes https://github.com/brentvatne/react-native-scrollable-tab-view/blob/master/index.js#L55 (or maybe at least clarify that in docs?)
It's actually currentPage
since it reacts to changes https://github.com/brentvatne/react-native-scrollable-tab-view/blob/master/index.js#L55 (or maybe at least clarify that in docs?)
Activity
skv-headless commentedon Jan 13, 2016
absolutely agree
grabbou commentedon Jan 13, 2016
It depends on expected by user behaviour, we can either:
initialPage
behaviour & implementpage
proppage
prop and log thatinitialPage
is deprecated and will be removed with next versionskv-headless commentedon Jan 14, 2016
First option is better for me.
skv-headless commentedon Jan 24, 2016
related issues #137 , #135 ,#128 ,#129
robtg4 commentedon Feb 4, 2016
So what was the conclusion here - how can this problem of popping back to the initial set page be solved?
digital-flowers commentedon May 24, 2017
@robtg4 i think it's not the component job to do so it's the user implementation to decide the initial state using redux or what ever he wants
eseQ commentedon May 25, 2017
UPDATE 2 - solution
I returned to this problem again and found simple solution.
For control with Redux we don`t need use
page
- we needgoToPage
(how could i miss it before?)UPDATE
All of i wrote next will work only for controlled tabs with Redux, but i catch scroll back if just swipe to other tab (if change with Redux or tap on TabBar all work fine).
But for control with Redux next solution work well.
TL;DR
Add identical
initialPage
andon start, don`t changepage
initialPage
,change only;page
Update don`t use
page
- onlyinitialPage
on start andgoToPage
for change page.I use redux for save my current tab (I change it in other place).
I want change active tab in drawer if that route active or initial specific tab if go from other route.
Ok we have object for save component`s page data;
!important; keep it in mind! For initial Tabs we need set identical
initialPage
and(usepage
goToPage
, if usepage
u can catch slide back). But for change tab we don`t need changeinitialPage
. If we changeinitialPage
without unmount component or set different values - tabs jump out of range and tab will not be loaded -_-just handle onChangeTab and set in Redux (
mainScreen
- name of var for current tab in Redux)Next step:
mainScreen
- index current tab. Don`t changeinitialPage
if tabs already init.SetDon`t use this codepage
for init or change if page changed in Redux.Update
Now we need catch receive new mainScreen if it change outside
Add props to
ScrollableTabView
. Have fun.I try explain in detail, perhaps i can`t did it =).
digital-flowers commentedon May 26, 2017
i think many components has an issue with interacting with redux the main reason is sometime you need redux to control the component and sometime you need the component to control redux maybe all components should consider doing the following scenario:
==run==> internal event handler (
this.onClick
)==if external handler exits ==> run (
this.props.onClick
)== if return true ==> change internal state (
this.setState({page})
)== if return false ==> do nothing
componentWillReceiveProps
)== if prop not equal state ==> change internal state (
this.setState({page:this.props.page})
)digital-flowers commentedon May 26, 2017
in this way you can listen to the event cancel it and change your redux state in the other hand redux will change your component prop again :)
eseQ commentedon May 26, 2017
@digital-flowers yeah, i agree, that will be awesome. If we don`t control component - just do u job, but if we do - doesn`t disturb =)
digital-flowers commentedon May 28, 2017
exactly !
eseQ commentedon Jun 1, 2017
UPDATE
I returned to this problem again and found simple solution.
For control with Redux we don`t need use page - we need goToPage (how could i miss it before?)
I updated my past solution.
Sorry for long read
Froelund commentedon Jun 6, 2017
@dictory Could you elaborate how you would use
goToPage
in a redux setup? I can't really figure out what you mean is your solution in the previous comment with all those updates :)12 remaining items