I am trying to optimize my React app in order to remove unnecessary renders. Please refer to this Snack for an example: https://snack.expo.io/bUZpyw0kH In this example app, there are two state variables stored in context. One of these values is updated every second, the other never changes. What I am trying t…
Tag: react-native
Why I am getting cross origin error in React?
I am quite new in React. I have build an event scheduler web app but it’s only working in my browser if I try it to different browsers or someone else system it gives me this error: A cross-origin error was thrown. React doesn’t have access to the actual error object in development. I am trying to…
react-native-hms-location error when building app
I am trying to install the library @hmscore/react-native-hms-location. I am following all the steps as per https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/integrating-sdk-0000001050041330 However, once i have installed the library and I attempt to run ./gradlew assembleRelease in or…
Callback when Keyboard Dismiss in React Native
I have a date picker and a text input in my screen. To avoid ugly transitions, I want to dismiss the keyboard before showing the date picker. Currently, as I don’t know how to invoke a callback when the Keyboard is dismissed, I am doing something like this: This works, but this solution has a problem…
React native layouts – view not showing inside touchable opacity
I am new to programming and I have been running with this problem for the past week and haven’t been able to solve it any other way, please help. I have a styles/layout issue on my react native application. I have a touchable opacity and inside it I want to have two views (one that will contain an image…
How to use ref in a functional component (expo camera)
I’m reacting my camera as a functional component but the documentation says To use methods that Camera exposes one has to create a component ref and invoke them using it. but in react documentation it says that I can not use ref in a functional component. if this the same thing as useRef? I’m tryi…
How to integrate Google Tag Manager with React Native app?
Recently, the marketing team asked me to add Google Tag Manager in the current company project, this project is written based on React Native and I searched a lot for this. but no success to found good updated documentation. I found a react-native-gtm but it is for 4 years ago. also, I find some descriptions …
Can’t scroll down screen in react JS
My goal with this code is to show text on pressing First and Second Buttons, which work as expected. However, whenever I press on the second one, the text is longer than the screen, but I cannot scroll down: The screen is fixed. I have made some researchs but can’t find any solutions to my problem ̷…
Can’t connect to pusher with react-native
Hello i am new to react native and im trying to create a realtime chat application using pusher-js so i installed the package npm install pusher-js @react-native-community/netinfo and put the following code in my useEffect and im getting this in the console Link of the image Im using react-native run-android …
React Native – Pressable – Can’t run sample code
i am trying to run the example code from react native you can find here: https://reactnative.dev/docs/pressable I allways get the error message: Warning: React.createElement: type is invalid — expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s%s, un…