У меня есть компонент react-native
, который прослушивает событие Linking
url. Как бы я запустил это событие с react-native-testing-library
?
Пример:
import React, { PureComponent } from 'react';
import { View, Text, Linking, ActivityIndicator } from 'react-native';
import SafariView from 'react-native-safari-view';
class WebAuthView extends Component<Props, State> {
componentDidMount() {
Linking.addEventListener('url', this.handleAuthUrl);
SafariView.addEventListener('onDismiss', this.handleDismiss);
}
componentWillUnmount() {
Linking.removeEventListener('url', this.handleAuthUrl);
SafariView.removeEventListener('onDismiss', this.handleDismiss);
}
handleAuthUrl = ({url}) => {
// Implementation goes here
}
render() {
// ....
}
}