Giter Site home page Giter Site logo

Comments (6)

github-actions avatar github-actions commented on May 2, 2024

Hey @simonadenic! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

A snack link is preferred since it's the easiest way to both create and share a repro. If it's not possible to create a repro using a snack, link to a GitHub repo under your username is a good alternative. Don't link to a branch or specific file etc. as it won't be detected.

Try to keep the repro as small as possible by narrowing down the minimal amount of code needed to reproduce the issue. Don't link to your entire project or a project containing code unrelated to the issue. See "How to create a Minimal, Reproducible Example" for more information.

You can edit your original issue to include a link to the repro, or leave it as a comment. The issue will be closed automatically after a while if you don't provide a repro.

from react-navigation.

github-actions avatar github-actions commented on May 2, 2024

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

  • @react-navigation/native (found: 6.0.2, latest: 6.1.17)
  • @react-navigation/bottom-tabs (found: 6.0.5, latest: 6.5.20)
  • @react-navigation/stack (found: 6.0.7, latest: 6.3.29)

Can you verify that the issue still exists after upgrading to the latest versions of these packages?

from react-navigation.

simonadenic avatar simonadenic commented on May 2, 2024

Here's a reproduction on the snack: https://snack.expo.dev/@simonadenic/getting-started-%7C-react-navigation?platform=android&name=Getting%20started%20%7C%20React%20Navigation&dependencies=%40expo%2Fvector-icons%40

from react-navigation.

satya164 avatar satya164 commented on May 2, 2024

It's working as designed. In many cases such as conditional rendering, it's impossible to know if the state changes until after the components finish re-rendering.

It also seems very unlikely that a button press will happen before useEffect is called. But if you really need to know before screen mounts then you can use events such as __unsafe_action__, however it'll not cover all scenarios.

from react-navigation.

github-actions avatar github-actions commented on May 2, 2024

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

from react-navigation.

simonadenic avatar simonadenic commented on May 2, 2024

Hey @satya164, thank you for the answer.

Is there any other way you'd suggest to track analytics, since maybe the suggested way in the docs does not cover all the use cases and doesn't track screen views properly.
Consider the following use case. For the screen view event you're logging, you want to describe it with some data from that particular screen. In the example, I gave, when the user opens SEARCH page, you'd want to know which params he sees on the SEARCH page. You can only do this in the useEffect of the SEARCH page (params could be coming from deep link, push notification, prefilled from some user context etc). So, for example:

<NavigationContainer onStateChange={()=>{
    // conditions 
     logScreenView(); 
}}>

// here we instantiate screens in a navigator
</NavigationContainer>
const SearchScreen = ()=>{
   const params = getParamsSomehow();
   React.useEffect(()=>{
      logSearchEvent({ params }); 
   },[params]);

return <SomeUi/>
}

In the analytics, you'll see that the Search event you logged is connected to the wrong page (since screen view is going to be logged after the search event).

So anytime you want to log some event from any effect in the component, the analytics will show wrong data for these events, as they will not be tied to the correct screen.

from react-navigation.

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.