lucasferreira / react-native-flash-message

React Native flashbar and top notification alert utility
MIT License
1.42k stars 154 forks source link

Warning: EventEmitter.removeListener('change', ...): Method has been deprecated. #176

Closed imomer closed 3 years ago

imomer commented 3 years ago

I'm using RN 0.65.1 and install react-native-flash-message module on a newly created app. When ever I run the flash message I got this warning:

WARN EventEmitter.removeListener('change', ...): Method has been deprecated. Please instead useremove()on the subscription returned by EventEmitter.addListener. TouchableWithoutFeedback@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flashmsgapp&modulesOnly=false&runModule=true:77383:36 RCTView View AnimatedComponent@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flashmsgapp&modulesOnly=false&runModule=true:67484:80 AnimatedComponentWrapper FlashMessage RCTView View SafeAreaView@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flashmsgapp&modulesOnly=false&runModule=true:80474:41 App RCTView View RCTView View AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flashmsgapp&modulesOnly=false&runModule=true:75604:36 FlashMsgApp(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.flashmsgapp&modulesOnly=false&runModule=true:82460:28

A friend of mine using the same module but his app RN is a bit older (0.64.2)

Screenshot_1630905558

Sandeep155Vibhuti commented 3 years ago

@imomer I have got Same Issue with the react-native version - 0.65.1, react-native-flash-message - 0.1.15

nericode commented 3 years ago

I have a same issue:

EventEmitter.removeListener('change', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.

Environment:

"react": "17.0.2",
"react-native": "0.65.1",
"react-native-flash-message": "^0.1.23"

I search in source code and found this section FlashMessageWrapper.js:

componentDidMount() {
  Dimensions.addEventListener("change", this.handleOrientationChange);
}
componentWillUnmount() {
  Dimensions.removeEventListener("change", this.handleOrientationChange);
}

I think this is causing the warning

Sadathossain commented 3 years ago

This patch worked for me.

lucasferreira commented 3 years ago

Hi folks,

The last update published in NPM had a fix to this event warning.

Thanks for the reporting ;)