IOS立ち上げ時にこのようなエラーが出ます。。
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 %s.%s, a useEffect cleanup function, in Unknown (at SceneView.tsx:122) in StaticContainer in StaticContainer (at SceneView.tsx:115) in EnsureSingleNavigator (at SceneView.tsx:114) in SceneView (at useDescriptors.tsx:150) in RCTView (at CardContainer.tsx:221) in RCTView (at CardContainer.tsx:220) in RCTView (at CardSheet.tsx:33) in ForwardRef(CardSheet) (at Card.tsx:563) in RCTView (at createAnimatedComponent.js:144) in AnimatedComponent (at createAnimatedComponent.js:194) in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:545) in PanGestureHandler (at GestureHandlerNative.tsx:13) in PanGestureHandler (at Card.tsx:539) in RCTView (at createAnimatedComponent.js:144) in AnimatedComponent (at createAnimatedComponent.js:194) in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:535) in RCTView (at Card.tsx:529) in Card (at CardContainer.tsx:189) in CardContainer (at CardStack.tsx:558) in RCTView (at Screens.tsx:69) in MaybeScreen (at CardStack.tsx:551) in RCTView (at Screens.tsx:48) in MaybeScreenContainer (at CardStack.tsx:461) in CardStack (at StackView.tsx:458) in KeyboardManager (at StackView.tsx:456) in SafeAreaProviderCompat (at StackView.tsx:453) in RCTView (at StackView.tsx:452) in StackView (at createStackNavigator.tsx:85) in StackNavigator (at AppNavigator.js:16) in HomeStack (at SceneView.tsx:122) in StaticContainer in StaticContainer (at SceneView.tsx:115) in EnsureSingleNavigator (at SceneView.tsx:114) in SceneView (at useDescriptors.tsx:150) in RCTView (at BottomTabView.tsx:41) in SceneContent (at BottomTabView.tsx:117) in RCTView (at ResourceSavingScene.tsx:43) in RCTView (at ResourceSavingScene.tsx:26) in ResourceSavingScene (at BottomTabView.tsx:112) in RCTView (at src/index.native.js:139) in ScreenContainer (at BottomTabView.tsx:96) in RCTView (at BottomTabView.tsx:95) in RNCSafeAreaProvider (at SafeAreaContext.tsx:74) in SafeAreaProvider (at SafeAreaProviderCompat.tsx:42) in SafeAreaProviderCompat (at BottomTabView.tsx:94) in BottomTabView (at createBottomTabNavigator.tsx:41) in BottomTabNavigator (at AppNavigator.js:53) in EnsureSingleNavigator (at BaseNavigationContainer.tsx:390) in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:91) in ThemeProvider (at NavigationContainer.tsx:90) in ForwardRef(NavigationContainer) (at AppNavigator.js:52) in AppNavigaotor (at App.js:10) in Provider (at App.js:8) in App (created by ExpoRoot) in RNCAppearanceProvider (at src/index.tsx:70) in AppearanceProvider (created by ExpoRoot) in ExpoRoot (at renderApplication.js:45) in RCTView (at AppContainer.js:109) in DevAppContainer (at AppContainer.js:124) in RCTView (at AppContainer.js:135) in AppContainer (at renderApplication.js:39) * [native code]:null in __expoConsoleLog - node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error - node_modules/expo/build/environment/muteWarnings.fx.js:27:4 in error - node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:608:6 in warningWithoutStack - node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:21972:25 in warnAboutUpdateOnUnmountedFiberInDEV - node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:19813:40 in scheduleUpdateOnFiber - node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:11880:16 in dispatchAction * [native code]:null in dispatchAction * screens/HomeScreen.js:25:26 in fetchArticles - node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch - node_modules/regenerator-runtime/runtime.js:293:29 in invoke - node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch - node_modules/regenerator-runtime/runtime.js:154:27 in invoke - node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0 - node_modules/promise/setimmediate/core.js:37:13 in tryCallOne - node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0 - node_modules/react-native/Libraries/Core/Timers/JSTimers.js:135:14 in _callTimer - node_modules/react-native/Libraries/Core/Timers/JSTimers.js:183:16 in _callImmediatesPass - node_modules/react-native/Libraries/Core/Timers/JSTimers.js:446:30 in callImmediates * [native code]:null in callImmediates - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:396:6 in __callImmediates - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:144:6 in __guard$argument_0 - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:373:10 in __guard - node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:143:4 in flushedQueue * [native code]:null in flushedQueue * [native code]:null in callFunctionReturnFlushedQueue
調べていて、useEffectが原因なのではと思ったので、
useEffectを使っているところをコメントアウトしてみたのですが、
import React, { useState, useEffect } from 'react'; import { StyleSheet, FlatList, SafeAreaView } from 'react-native'; import Constants from 'expo-constants'; import axios from 'axios'; import ListItem from '../components/ListItem'; import Loading from '../components/Loading'; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, }); const URL = `https://newsapi.org/v2/top-headlines?country=jp&category=business&apiKey=${Constants.manifest.extra.newsApiKey}`; export default HomeScreen = (props) => { const [articles, setArticles] = useState([]); const [loading, setLoading] = useState(false); // useEffect(() => { // fetchArticles(); // }, []); // const fetchArticles = async () => { // setLoading(true); // try { // const response = await axios.get(URL); // setArticles(response.data.articles); // } catch (error) { // console.error(error); // } // setLoading(false); // }; return ( <SafeAreaView style={styles.container}> {loading && <Loading />} <FlatList data={articles} renderItem={({ item }) => ( <ListItem imageUrl={item.urlToImage} title={item.title} author={item.author} onPress={() => props.navigation.navigate('Article', { article: item, }) } /> )} keyExtractor={(item, index) => index.toString()} /> </SafeAreaView> ); };
このようなエラーがでました
10:03 LSOpenURLsWithRole() failed for the application /Applications/Atom.app with error -10810.
% ls -la $(which atom) lrwxr-xr-x 1 user admin 53 9 21 06:17 /usr/local/bin/atom -> /Applications/Atom.app/Contents/Resources/app/atom.sh
atomをインストールしているのですが、なぜこのようなエラーが起きるのかわかりません。
誰かわかる方がいたらお助け願います。
× シュミレータ
○ シミュレータ
あなたの回答
tips
プレビュー