All Questions
Tagged with expo react-hooks
194
questions
16
votes
7
answers
27k
views
How to apply custom fonts to whole project, Expo React Native
I'm new to React and those languages. Trying to apply a custom google font(Ubuntu) to whole project. I managed to pull the font into the project, but I can only use it in simple texts in App.js. Like ...
6
votes
3
answers
13k
views
Context API using useContext in React Native is showing a TypeError
I'm attempting to use the modern Context API within React-Native, but I'm getting the following error:
TypeError: TypeError: undefined is not an object (evaluating
'Context._context')
my ...
4
votes
1
answer
6k
views
React Native's useNavigation hook inside of a custom hook?
Im using React Navigation's useNavigation hook:
In MyComponent.js:
import { useNavigation } from "@react-navigation/native";
const MyComponent = () => {
const navigation = ...
4
votes
2
answers
387
views
Expo React Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application
I'm new to react native and was following a tutorial on medium about how to connect with firebase auth. Everything seems to work fine, but I keep getting this warning below:
Warning: Can't perform a ...
4
votes
0
answers
1k
views
Expo-Camera not Pausing Preview on Android
Expo-Camera not Pausing Preview on Android.
const options = { quality: 0.25, base64: true, allowsEditing: true };
//Props small 0.25, medium 0.5, high 1, by default 0.25
const data = await cameraRef....
3
votes
1
answer
218
views
How can I solve the warning "Warning: Can't perform a React state update on an unmounted component." from setInterval function?
I created my project React-Native. My project use 'expo-location' for tracking location module. I use setInterval function (inside useEffect hooks) for get last location every 10 seconds. But after I ...
3
votes
2
answers
2k
views
React Native Expo-Camera recording video find problem User rejected audio permission needed
I'm having trouble recording video with expo-camera. User rejected audio permission needed. Has anyone had such a problem?? If anyone tells me the way to solve the problem, I also added expo install ...
3
votes
1
answer
2k
views
Warning: React has detected a change in the order of Hooks
I have run into this error in my code, and don't really know how to solve it, can anyone help me?
I get the following error message:
ERROR Warning: React has detected a change in the order of Hooks ...
3
votes
2
answers
5k
views
Fix Can't perform a react state update on an unmounted component React native
how can I fix this error in my react native, see the code below.
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your ...
3
votes
1
answer
573
views
React native Unable to resolve module ./.expo/.virtual-metro-entry
Actually I have installed unimodule previously was running react native cli because of tensorflow/tfjs-react-native I have to install unimodule but whenever I am doing yarn android I am getting below ...
3
votes
1
answer
1k
views
I have to add multiple choice radio button in React native
Each item will have two radio buttons one is Yes and one is No. I have
added the radio button with every item that comes from Flatlist (API).
error is When I select one of the 8 radio button in front ...
3
votes
0
answers
139
views
Unable to render data to ReactNative FlatList on Scroll down using Http POST request
I want to render a list of items in a ReactNative FlatList, initially I am loading 15 items and then load more when user scrolls down. I am using FlatList's onEndReached prop to get new items on ...
2
votes
1
answer
1k
views
React Native: whole FlatList rerenders on every change, even with React.memo
I've been struggling with this issue for the past couple of days: I have a list of creators stored in an array, along with another array for followed creators, but when the user 'follows' a creator ...
2
votes
1
answer
5k
views
React Native: Why does FlatList re-render completely on data changes?
thanks for reading my question! I am struggling with this problem since a few days now: My Flatlist component re-renders all items in the list every time I make a change to the underlying data.
...
2
votes
1
answer
7k
views
How to fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function error
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a ...
2
votes
1
answer
1k
views
Invalid hook call. Hooks can only be called inside of the body of a function component, Error only occurs in browser not on mobile
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
You might have mismatching versions of React and the ...
2
votes
3
answers
88
views
How do I make sure my Profile information is imported every time, using React Native and AWS?
I have a RN/Expo app. The user can sign in and push the drawer (hamburger) button, and see their profile information. This info is pulled from an AWS server, but it is really hit or miss as to whether ...
2
votes
2
answers
12k
views
Why am I getting a "Possible Unhandled Promise Rejection (id:0):" console warning and how to get rid of it
I'm trying to request and get the position of the the user. This is my code. I'm trying to make it so that as soon as the user goes on that screen he is requested to give his position, hence the use ...
2
votes
1
answer
78
views
How to keep my components state after it unrenders and rerenders?
I have two screens that are conditionally rendered. I would like the state of the screens to remain the same after navigating away from the screen and returning.
For example, in the reproducible code ...
2
votes
1
answer
387
views
React Native: Can't fetch on onPress={}
My app :
import { LoginFunction, RegisterFunction } from './authentication/auth'
export default function LoginPage(props) {
const navigateToRegister = () => {
props.navigation.navigate(&...
2
votes
1
answer
91
views
setState hook not updating - though prevState shows correct value
I'm using the state variable to keep track of my previous state.
The animation works (without index), but when I do
const [index, setIndex] = useState(0)
useEffect(() => {
animation....
2
votes
1
answer
2k
views
Avoid multiple calls of useEffect in nested navigation using expo router
I am currently trying to make a layout with expo-router with following structure:
App
_layout (Stack)
home
_layout (Tab)
index
profile
place
_layout (Stack)
[id] (presentation:'modal')
review
...
2
votes
0
answers
585
views
Event listeners does not trigger in expo, react-navigation but use to work previously
For :
expo --version 4.9.0 and
"@react-navigation/bottom-tabs": "^5.11.11",
"@react-navigation/drawer": "^5.12.5",
"@react-navigation/native": "^...
2
votes
0
answers
197
views
Is it ok to pass react setState hook to 3rd party library class instance?
I am writing player UI in react-native with expo. There is a 3rd party library expo-av. And in examples section of that lib, react component initialize instance of mediaObject in useEffect and saves ...
2
votes
0
answers
313
views
useEffect: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application
Hi I am having an issue in my react native expo app when I updated the APK version from 28 to 29 - for google plays new update.
Heres my error after dependancy updates in the component specified in ...
1
vote
2
answers
1k
views
How to do a useEffect() style ajax call after button press in React Native?
I'm new to React and React Native.
Trying to build a simple app that does an API call on the press of a button.
My code below works but just doesn't "look right" to me.
useEffect() is run ...
1
vote
2
answers
746
views
Getting Warning: Can't perform a React state update on an unmounted component
I am getting this error twice every time I run this. I did my search and tried to cancel the subscription of onAuthStateChanged() to useEffect() in the cleanup function, but still got the same error. ...
1
vote
1
answer
56
views
How do I pass state variables from one screen to another in a React Native Project?
My state variables are defined as follows:
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
Both of these values are being updated via user input as follows:
<...
1
vote
1
answer
2k
views
Fonts not loaded in React Native Expo
(Sorry, English is not may first language)
I load my fonts, but when I try to use them it says that the font is not a Font and I need to use Font.loadAsync
I have load them in APP():
import * as ...
1
vote
1
answer
391
views
Data exists, but the map function returns no value React Native
I guess I'm not realizing something. I have the structure where I list the friends of the logged in user. Data appears to exist on console.log, but the map function does not work. Also, when I press ...
1
vote
1
answer
45
views
why is the useState hook not setting the value until the page is reloaded?
I'm fetching data from a local server, I want to put the response into images so I can render those urls afterwards
const [images, setImages] = useState([])
useFocusEffect(
React.useCallback(()=>...
1
vote
2
answers
2k
views
[Unhandled promise rejection: Error: Location "imageURL" isn't readable - Expo React Native
I am trying to convert an firebase image URL to base64 using expo FileSystem but getting following error.
[Unhandled promise rejection: Error: Location "https://pngimg.com/uploads/birds/small/...
1
vote
1
answer
686
views
Does react native always renders everything when state changes?
I would like to know if when a state changes only the component affected by the state and all its children are rendered or "the whole function (the return part) where that component is".
...
1
vote
2
answers
705
views
React native use hooks on snack.expo.io
I wanted to try using hooks on snack.expo.io, but it doesn't seem to work.
Is there a way to know what kind of version uses snack.expo?
1
vote
1
answer
2k
views
TypeError: dispatcher.useState is not a function for React Native
I have an expo project that I want to use hooks in.
I get the following error upon starting my app:
TypeError: dispatcher.useState is not a function. (In 'dispatcher.useState(initialState)', '...
1
vote
1
answer
44
views
React Native useCallback uses initial state values
I have the following setup when I want to track a bunch of metadata when a user listens to an audio from my app. However, for some reason, length_played always remain 0 and time_listened is inaccurate....
1
vote
1
answer
40
views
Component and Data Disappear after refresh page
I am working on an expo app. I got a situation which my component/data disappear after page refresh, but when I make any kind of changes in my code(such as just adding semicolon) and click save, ...
1
vote
1
answer
655
views
createBottomTabNavigator (navigation version 4) cannot use useEffect
I am using version 4 react navigation and particularly createBottomTabNavigator with createStackNavigator for each tab. For all implemented tabs, if I scroll away from my landing screen called home ...
1
vote
1
answer
744
views
Error: `FileSystem.moveAsync` needs a `to` path. in react native (Expo)
I am trying to take pictures from a real device and save it in a new location using expo expo-file-system. But I am getting an error Error: FileSystem.moveAsync needs a to path.
My code:
const ...
1
vote
2
answers
524
views
Error in working with useEffect for fetching data from an API
I am learning React Native, and in following one of the live-coding sessions on YouTube I have come across the following problem.
What I want to do is: I am making an app with expo and I want to fetch ...
1
vote
1
answer
1k
views
Expo React Native execute function when entering view
I'm trying to make a function execute when a view is in foreground, but just once not on each update of the component. If the user navigates to another view and goes back to the first view it should ...
1
vote
1
answer
186
views
Converting React-Native-Draggable-View from Class to Hooks
I am attempting to write some code using React-Native-Draggable-View but the example that has it the way I want is written in "class" form, while I write everything in "Hooks/Functional&...
1
vote
1
answer
664
views
React redux value inside a function of a functional component returns the value a cycle late
I recently changed my code from class components to functional components and using hooks. However, I ran into a problem where the accessing a redux value using useSelector and useDispatch.
let ...
1
vote
0
answers
19
views
Expo React, use hook from outside a export default func app
I need assistance with expo and react Hooks
I need to manipulate the hook display (profil.tsx) from outside an app export. From the last file login.js from a regular JS function.
Is there a way I can ...
1
vote
1
answer
31
views
Getting a warning of cannot update a Component
So I am making an app with the react native and expo router and made progress by creating onboarding and sign-in components and I wanted to show onboarding screen for the first time user opens the app ...
1
vote
0
answers
75
views
Nested Navigators navigation and Custom TabBar issue
What I'm Trying to Achieve
I'm Trying to achieve a Tab Navigator which has Two tabs on each side which don't redirect to a different tab but instead open their respective Side Drawer as shown in the ...
1
vote
1
answer
142
views
Using expo-av library in react-native application, how to avoid a sound delay when tapped on <TouchableOpacity> component
I am trying to create an app using react native expo and I was adding sounds to the buttons using expo-av library. So my intention is to play a sound when tapped on the touchableOpacity component. So ...
1
vote
2
answers
566
views
Resetting state when app comes back from background
I have a ticking clock timer component that I need to reset when the app comes back in from background. I am using expo 49.0.11, react-native 0.72.4. It sucks because this bug is not reproducible in ...
1
vote
0
answers
56
views
useRef is working in async but not outside - React native
I have this code but when I log processedData in onViewableItemsChanged it log nothing but when I log it in requestDb it works.
I have tu use processedData in a component so I need it outside async ...
1
vote
2
answers
266
views
Navigation no working on User Authentication with React Native (Expo)
I'm new to React Native and I'm starting with Expo.
I'm using "Firebase Auth" service and I'm able to create users.
The problem is with the navigation after creating an account or login:
...