0

I have an expandable listview on the parent screen. I expanded listview to see subcategory items. Now I clicked on one subcategory, it will navigate another screen(child screen). when I click on goback() method in child screen the parent screen is displaying with a collapsed list view.

Need to expand the expandable listview in expand mode only which are opened before in Parent screen when clicking on goback() in child screen.

Please help me.

Priyanka
  • 138
  • 2
  • 15
  • 1
    Please post the relevant code block and steps you have tried so far. Thanks – Sameer Kumar Jain Aug 31 '20 at 08:14
  • are you using react-native-router-flux? – Riddhi Aug 31 '20 at 10:49
  • @Riddhi i'm using react-native only – Priyanka Sep 01 '20 at 10:14
  • @SaachiTech posted code..Please check once – Priyanka Sep 04 '20 at 05:37
  • @Priyanka are you using react-navigation? which version? Also, please post how you have the stack set-up? – Sameer Kumar Jain Sep 04 '20 at 05:47
  • @SaachiTech didn't install any packager react-navigation in my project. – Priyanka Sep 04 '20 at 06:01
  • As per the document, once a stack screen mounted it will remain mounted and it will not refresh unless you explicitly refresh it using focus listener or redux state. You can read more about the lifecycle at https://reactnavigation.org/docs/navigation-lifecycle. Saying that your accordion must remain open. Here is a simple snack with a minimal example which works the way you expect https://snack.expo.io/@saachitech/moving-between-screens-%7C-react-navigation – Sameer Kumar Jain Sep 04 '20 at 06:37
  • @satchi I saw the example which you provided and the navigation life cycle also. Please check the updated code above. how can I expand the selected row when the screen navigates from child screen. – Priyanka Sep 05 '20 at 04:55

2 Answers2

0

I think you can use a parent screen name in the navigation to move from child to parent instead of goback().

Awais Ibrar
  • 585
  • 3
  • 14
  • in that case,screen will be refresh right...I don't wanna refresh the screen.Need display the expandable listview in expand mode only – Priyanka Aug 31 '20 at 08:30
0

Use navigation.replace(routeName,params) to pass the selected list in child componentÏ instead of goBack.

Phaoga55
  • 71
  • 1
  • 11