Comments (6)
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:
- Expo Snack
- TypeScript Playground
- GitHub repo under your username
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.
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.
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.
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.
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.
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)
- RemoveEventListener error in react-native-navigation@4 HOT 7
- Keyboard is dismissed immediately when focusing on TextInput field on non-outer tabs for `react-native-tab-view` HOT 1
- RemoveEventListener error in react-native-navigation@4 HOT 8
- Bottom Tabs flash when opening keyboard HOT 2
- Bottom Tab Navigator falls out of viewable area HOT 2
- Wrong header height value for screens inside Native Stack inside another Native Stack with modal presentation on iOS
- headerLargeTitle: true with headerBackTitleVisible: false makes back button animation jerky HOT 1
- Unable to adjust height once the height of tab is reduced and then expanded HOT 4
- RemoveEventListener error in react-native-navigation@4 HOT 21
- Unexpected layout size when screen is out of focus HOT 2
- Nested tabview are not supported?... HOT 1
- useColorScheme is not working with fullScreenModal HOT 2
- react-native-tab-view, Unable to scroll to the top HOT 1
- Drawer position is not correct in Expo 49 HOT 3
- App is freezing if you use drawer navigation on RN 73.7 HOT 3
- Task :react-native-safe-area-context:compileDebugKotlin FAILED HOT 4
- Drawer is not working with react-native-v8
- Keyboard hides => shows => hides when navigating back (from ios gesture only) from a screen where keyboard is shown HOT 1
- IOS fullscreenmodal not switching to dark/light mode when changing appearance HOT 1
- Bottom tab navigation only works for few seconds when refresh then it doesn't work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-navigation.