Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidFocus = async () => {
const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
this.setState({ permission: status, assets: [], endCursor: undefined, hasNextPage: undefined });
this.loadMoreAssets();
if (this.libraryChangeSubscription) {
this.libraryChangeSubscription.remove();
}
this.libraryChangeSubscription = MediaLibrary.addListener(() => {
this.loadMoreAssets([]);
});
}
componentDidFocus = async () => {
const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
this.setState({ permission: status, assets: [], endCursor: undefined, hasNextPage: undefined });
this.loadMoreAssets();
if (this.libraryChangeSubscription) {
this.libraryChangeSubscription.remove();
}
this.libraryChangeSubscription = MediaLibrary.addListener(() => {
this.loadMoreAssets([]);
});
};