我低于警告
AsyncStorage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. See https://github.com/react-native-async-storage/async-storage
如何抑制它?
我已经尝试过以下方法(放置在
app.js
中的行下方),但没有一个有效。
import { LogBox } from 'react-native'
LogBox.ignoreLogs(['Warning: AsyncStorage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from `@react-native-async-storage/async-storage` instead of `react-native`. See https://github.com/react-native-async-storage/async-storage'])
import { LogBox } from 'react-native'
LogBox.ignoreLogs(["Warning: AsyncStorage has been extracted from react-native core and will be removed in a future release. It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. See https://github.com/react-native-async-storage/async-storage"])
谁能帮我压制它?
import { LogBox } from 'react-native';
LogBox.ignoreLogs(['Asyncstorage: ...']); // Ignore log notification by message
LogBox.ignoreAllLogs(); //Ignore all log notifications
将 console.disableYellowBox = true; 添加到您的 index.js 文件中。为我工作。
这是一个警告。不要压制它。我猜您正在使用“react-native”包中的异步存储。相反,请安装
@react-native-async-storage/async-storage
并从此处使用它。