White background flashing when switching screens – React-Navigation v5

I faced the same issue and dived into an investigation. It seems that the detachment of the screens causes it. I found a few approaches. You can choose one according to your needs. They are the following: You can specify a view wrapper of the navigator with the same background color as the screens one … Read more

React Navigation how to hide tabbar from inside stack navigation

This is how I hide the tab bar in a specific screen in a stack (React Nav 5.x & 6.x) import { getFocusedRouteNameFromRoute } from ‘@react-navigation/native’; const ProfileStack = createStackNavigator(); const ProfileNavigator = ({ navigation, route }) => { React.useLayoutEffect(() => { const routeName = getFocusedRouteNameFromRoute(route); if (routeName === “Group”){ navigation.setOptions({tabBarVisible: false}); }else { navigation.setOptions({tabBarVisible: … Read more

Invariant Violation: “main” has not been registered

Open the index.js, the content of the file should be like this: import { AppRegistry, Platform } from ‘react-native’; import App from ‘./App’; AppRegistry.registerComponent(‘X’, () => App); if (Platform.OS === ‘web’) { const rootTag = document.getElementById(‘root’) || document.getElementById(‘X’); AppRegistry.runApplication(‘X’, { rootTag }); } If you have this error Invariant Violation: “main” has not been registered … Read more

react native typescript ‘string’ is not assignable to parameter of type ‘never.’ in useNavigation

This is a weird issue that happens in RN > 0.65. My solution: 1.- Import: {/* Depends of your Package (Stack or NativeStack…) */} import { StackNavigationProp } from ‘@react-navigation/stack’; import { useNavigation } from ‘@react-navigation/core’; 2.- Define types export type RootStackParamList = { YourScreen: { id: number } | undefined; }; 3.- Assign useNavigation … Read more

Passing function as a param in react-navigation 5

Passing a callback through react native navigation params is not recommended, this may cause the state to freeze (to not to update correctly). The better solution here would be using an EventEmitter, so the callback stays in the Screen1 and is called whenever the Screen2 emits an event. Screen 1 code : import {DeviceEventEmitter} from … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)