3

Is possible to do something like...

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

in react native ?

1 Answer 1

5

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) => {

});

Should work.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks..but there is something wrong with the sintax...can you fix that ?
@MarcoJr What's the error? How are you importing React Native?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.