Giter VIP home page Giter VIP logo

Comments (11)

sodik82 avatar sodik82 commented on August 21, 2024 1

thank you - I can reproduce the bug now. We will need some time to fix it properly however here is small workaround - wrap your router definition so that it does not rerender like

  <Provider store={store}>
    <MenuContext style={{ flex: 1 }}>
      <StaticRenderer>
        <RouterComponent />
      </StaticRenderer>
    </MenuContext>
  </Provider>

example implementation of StaticRenderer

class StaticRenderer extends Component {
  shouldComponentUpdate() {
    return false;
  }
  render() {
    return React.Children.only(this.props.children)
  }
}

from react-native-popup-menu.

sodik82 avatar sodik82 commented on August 21, 2024 1

as far I have seen the bug - it has side effects (remounting of menu) if the router is not shielded from MenuContext. Unless you have something else "above" the router that might change the router definition somehow - it is safe to wrap router.

Right now we are working on refactoring of our internals so that such workarounds are not needed but we need more time for it.

from react-native-popup-menu.

hgg avatar hgg commented on August 21, 2024 1

@sodik82 I'm sorry for the late response but I can confirm it indeed works without the workaround for me. Cheers 👍

from react-native-popup-menu.

sodik82 avatar sodik82 commented on August 21, 2024

Thank you. I have tried simplified example and seems to work:

  <Provider store={store}>
    <MenuContext style={{ flex: 1 }}>
      <Testing />
    </MenuContext>
  </Provider>

Maybe if you can share with us details about your used navigation (which library, sample setup)? Or maybe if you can confirm first if it works without the Router?

from react-native-popup-menu.

hgg avatar hgg commented on August 21, 2024

For navigation I'm using [email protected] with the following setup on the Router:

const RouterComponent = () => (
  <Router>
    <Scene hideNavBar>
      <Stack key="auth" initial>
        <Scene
          key="testing"
          component={Testing}
          title="Testing"
          initial
        />
      {/*... */} 
      </Stack>
    {/*... */} 
    </Scene>
  </Router>
);

EDIT: Ok, I tried it without the Router and it's working. Any idea as to why?

from react-native-popup-menu.

hgg avatar hgg commented on August 21, 2024

I'm fairly new to React Native, so forgive my ignorance when I ask you:
Will wrapping the router as suggested have any other (side-)effects?

Anyways, thanks for the fast response and fix! 👍

from react-native-popup-menu.

sodik82 avatar sodik82 commented on August 21, 2024

@Hugainz - new version 0.8.2 should work without any workarounds. can you confirm it?

from react-native-popup-menu.

mohamed-alashry avatar mohamed-alashry commented on August 21, 2024

it's not working. I have the new version 0.8.3

from react-native-popup-menu.

sodik82 avatar sodik82 commented on August 21, 2024

can you provide us more details? does it work with workaround? what error/unexpected behaviour do you get? more details about your setup?

from react-native-popup-menu.

mohamed-alashry avatar mohamed-alashry commented on August 21, 2024

I will give a try again, thanks for the feedback.

from react-native-popup-menu.

sodik82 avatar sodik82 commented on August 21, 2024

@mohamed-alashry - thanks. maybe it is unrelated problem (maybe #41 ). but if you have any more information about your problem we can resolve it.

from react-native-popup-menu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.