I’m new to React Native and I’m trying to add translation in my navigation. In any other page it goes fine but not in my navigation. My i18n.js My StackNavigators.js What I’m trying to do is to add translation in BottomTabBar as title of each BottomNavigationTab and when I add const { t, i18n } = useTranslation(); I get Invalid
Tag: react-native
TypeScript : What is the right way to define types
I’m a little confused with the assignment of typescript types. In my example I want to know how I define the type of props that will not be “any type” and also how I define the type of the title, handleOnPress, svg parameters of the SideMenuItem function Answer Define the prop types for your component in an interface Then define
AsyncStorage setItem inside loop crashes
App crashes when trying to save something into asyncStorage. It crashes without an error message however I think the problem is in the while loop: As soon as the loop gets executed, the app crashes, console.log(“got here”) doesn’t even run. This function is called from a Pressable component: Answer I had to change it from a while loop to a
How do you achieve the below code in react-native when user presses a button
This is how we dynamically add elements in vanilla java script,how could this be achieved in react-native. Answer The logic for this remains the same in both react and react-native. You need a state that contains the list of contents and must map that state to react components. On Button press, you have to append another content item. Unlike vanilla
React Native, how to get values from multiple TextInputs into one object by pressing a Button?
I’m trying to put values from different TextInput’s into 1 object. I’m new to React in general and don’t have a firm grasp of states yet. So far my code is like this: Answer You’re really close! What you want (enteredText) shouldn’t actually be a state. It logically flows from the first and second texts, so you can just have
Send Data to a Server using Fetch API in React Native
I want to send data of Contact Form[firstname,lastname,email,note] to a server but When I click Contact Button to Send data I got an e=Error Telling that firstname is not defined The mean that all the 5 variables not defined if Some Can Help This The Code of FormScreen.js: This is The Error : enter image description here Answer It is
Changing a state of a variable in a function
I have two fonts one if the app is in arabic and one if the app is in English. My thinking is declare the state at the top but when the user changes the font it reverts the false state. The state is declared true when the user triggers the i18 .on function, but the app refreshes and changes the
Why does my app connect to my TCP server multiple times in my react native app?
When I run the code, it connects to my TCP server multiple times even though I am expecting it to connect only once The output is also changing a lot and it does not seem to follow how I programmed it to look. The output seems to be flicking from many other outputs. Answer React triggers your function multiple times
How to play one video from array at a time in ReactJS & AG Grid
Getting response from API. API response After populating data to table create one button then ag-grid look like this I am currently mapping through all the videos to button and I click button it opens multiple video but I want only one video at a time. app.js Multiple video open at same time,I don’t know how to properly play one
React Native TextInput sends input on second press
Guys i’m new to React Native and also not good at JavaScript. In my app i have 2 TextInput and a Pressable button but the output is not making sense. I’ve tried to change timing of execution of some lines but result is the same. I’m using: expo, react native 0.68.2, android api 30 (Android Studio) output: Android Bundling complete