I'm referring to this page of the official doc: https://wix.github.io/react-native-navigation/#/screen-api?id=listen-to-visibility-events-globally
After I create this class, how I tell navigator to use it?
FindViewById(Int32) Finds a view that was identified by the android:id XML attribute that was processed in #onCreate . FindViewById<T>(Int32) Finds a view that was identified by the id attribute from the XML layout resource.
View is a basic building block of UI (User Interface) in android. A view is a small rectangular box that responds to user inputs. Eg: EditText, Button, CheckBox, etc. ViewGroup is an invisible container of other views (child views) and other ViewGroup.
ScreenVisibilityListener
listens to global events fired on the native side through react-native eventDispatcher, the navigator doesn't need to know about it.
Example usage:
import {ScreenVisibilityListener} from 'react-native-navigation';
new ScreenVisibilityListener({
willAppear: ({screen}) => {
console.log(`Displaying screen ${screen}`)
},
didAppear: ({screen, startTime, endTime, commandType}) => {
console.log('screenVisibility', `Screen ${screen} displayed in ${endTime - startTime} millis [${commandType}]`)
},
willDisappear: ({screen}) => {
console.log(`Screen will disappear ${screen}`)
},
didDisappear: ({screen}) => {
console.log(`Screen disappeared ${screen}`)
}
}).register();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With