State force reset when switching between tabs
kockok opened this issue · 2 comments
I use const [isOpen, setIsOpen] = useState(false);
to control the state of an accordion.
However, when I switch to other tabs, the screen state of the original tab component will always be reset.
Is this intended?
I tried setting
options={{
unmountOnBlur: false,
}}
But the local state will still be forced to set back to the default value.
I've tried all these options, only setting component={ComponentA}
will keep the local state.
I figured out that when I change back to <Tabs.screen component={ComponentA} />
, the state retains.
However, when I render the component explicitly:
<Tabs.Screen
name="ComponentA"
options={{
unmountOnBlur: false,
}}
>
{(props) => <ComponentA {...props} tess={'TEST'} />}
</Tabs.Screen>
then the state won't keep, just wondering how to keep the state intact with the second component rendering method.
Also, if I use initialParams={{ tess: 'test' }}
to pass props, rerender will be triggered and the state will be lost.
Stale issue message