NordicMuseum / Nordic-Museum-Audio-Guide

An inclusive audio guide for The Nordic Museum
https://nordicmuseum.github.io/Nordic-Museum-Audio-Guide/
MIT License
14 stars 6 forks source link

popToTop when pressing search tab item? #1

Closed Ambrosiani closed 6 years ago

Ambrosiani commented 6 years ago

https://github.com/NordicMuseum/Nordic-Museum-Audio-Guide/blob/baaf29e0956c21264dea97c08413d3cf77294a20/app/components/rootScreen.js#L156

right now popToTop is only done if the search tab is already selected. how do I change the onPress function so that popToTop is called the first time the tab item is pressed as well?

(I tried removing this.props.activeTab === TAB_SEARCH && but to no avail)

Ambrosiani commented 6 years ago

@RubenSandwich hopefully you can help me out here :)

RubenSandwich commented 6 years ago

@Ambrosiani So the code for the onPress you tried was:

              if (this.refs.SEARCH_REF != null) {
                this.refs.SEARCH_REF.popToTop();
                return;
              }

              this.props.actions.updateActiveTab(TAB_SEARCH);

Yeah, that should work... I'll look into it.

Ambrosiani commented 6 years ago

exactly!

RubenSandwich commented 6 years ago

@Ambrosiani I figured it out:

              if (this.refs.SEARCH_REF != null) {
                this.refs.SEARCH_REF.popToTop();
              }

              this.props.actions.updateActiveTab(TAB_SEARCH);

We forgot, to remove the return; so the updateActiveTab was never called. 🤦🏽

I pushed this change: https://github.com/NordicMuseum/Nordic-Museum-Audio-Guide/commit/baa0d74000ad0c296e805c1baba0ee33ba2da27d

Ambrosiani commented 6 years ago

thank you 🥇