--[[
	Navigates to the previous page.
]]

modules.prevPage = function(self)
	return function(pageSize)
		if self.isAnimating then
			return
		end

		local nextIndex = self.state.selectedIndex - pageSize
		if nextIndex < 1 then
			nextIndex = #self.props.images + nextIndex
		end

		self.setCurrentIndex(nextIndex, pageSize)
	end
end
