Package Exports
- react-native-smart-app-event-listener-enhance
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-smart-app-event-listener-enhance) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-native-smart-app-event-listener-enhance
A AppEventListenerEnhance for React Native app which provides addEventListener functions that are safely cleaned up when the component unmounts
Installation
npm install react-native-smart-app-event-listener-enhance --saveFull Demo
Usage
Install the AppEventListenerEnhance from npm with npm install react-native-smart-app-event-listener-enhance --save.
Then, require it from your app's JavaScript files with import AppEventListenerEnhance from 'react-native-smart-app-event-listener-enhance'.
import React, {
Component,
} from 'react'
import AppEventListenerEnhance from 'react-native-smart-app-event-listener-enhance'
class AppEventListenerEnhanceDemo extends Component {
componentDidMount() {
this.addAppEventListener(
this.props.navigator.navigationContext.addListener('didfocus', this._didFocus)
).addAppEventListener(
this.props.navigator.navigationContext.addListener('didfocus', this._didFocus)
)
}
render() {
return null
}
_didFocus = () => {
console.log(`didfocus`)
}
}
export default AppEventListenerEnhance(AppEventListenerEnhanceDemo)