在 React Native 中处理低内存 [英] Handling Low Memory in react Native

查看:91
本文介绍了在 React Native 中处理低内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以做类似...

didReceiveMemoryWarning() {
  alert('You are doomed')
}

反应原生?

推荐答案

它从文档中丢失(我找不到它,但肯定记得曾经看过它)但它在 TypeScript def's

It's missing from the doc's (I couldn't find it but definitely remember seeing it at one time) but it's in the TypeScript def's

import { AppState } from 'react-native';

AppState.addEventListener('memoryWarning', (state) => {

});

应该可以.

这篇关于在 React Native 中处理低内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆