 	_handleOverlayTap: =>
 		@showPrevious() if not @isModal
 
-	_wrapLayer: (layer) ->
-
-		# layer = layoutScroll(layoutPage(layer, @size), @size)
-		# layer.point = 0
-
-		# print layer
-
-		return layoutScroll(layoutPage(layer, @size), @size)
-
-		# # Wrap the layer in a ScrollComponent if the size exceeds the size of
-		# # the FlowComponent. Also set the horizontal/vertical scrollin if only
-		# # one of the sizes exceeds.
-
-		# # TODO: what about FlowComponent changing size, do we need to account?
-
-		# scroll = null
-
-		# # Calculate the available width and height based on header and footer
-		# width = @width
-
-		# height = @height
-		# height =- @header.height if @header
-		# height =- @footer.height if @footer
-
-		# # If we already created a scroll, we can use that one
-		# if layer[FlowComponentLayerScrollKey]
-		# 	scroll = layer[FlowComponentLayerScrollKey]
-
-		# # If the layer size is exactly equal to the size of the FlowComponent
-		# # we can just use it directly.
-		# else if layer.width is @width and layer.height is height
-		# 	return layer
-
-		# # If the layer size is smaller then the size of the FlowComponent we
-		# # still need to add a backgound layer so it covers up the background.
-		# # TODO: Implement this
-		# else if layer.width < @width and layer.height < height
-		# 	return layer
-
-		# # If this layer is a ScrollComponent we do not have to add another one
-		# if layer instanceof ScrollComponent
-		# 	scroll = layer
-		# 	scroll._originalContentInset ?= scroll.contentInset
-
-		# layer.point = Utils.pointZero()
-
-		# if not scroll
-		# 	scroll = new ScrollComponent
-		# 	scroll.name = "scrollComponent"
-		# 	scroll.backgroundColor = @backgroundColor
-		# 	layer[FlowComponentLayerScrollKey] = scroll
-		# 	layer.parent = scroll.content
-
-		# 	# Forward the events to the wrapped layer so we can listen on it for
-		# 	# scroll events. This is not "pure". But you don't really have a way
-		# 	# to access the magically created scroll component.
-		# 	_addListener = layer.addListener
-		# 	layer.on = (event, args...) ->
-
-		# 		_addListener.apply(layer, [event, args...])
-
-		# 		# But only the actual scroll events
-		# 		if event in [
-		# 			Events.ScrollStart,
-		# 			Events.Scroll,
-		# 			Events.ScrollMove,
-		# 			Events.ScrollEnd,
-		# 			Events.ScrollAnimationDidStart,
-		# 			Events.ScrollAnimationDidEnd]
-		# 				scroll.addListener(event, args...)
-
-		# scroll.parent = @
-		# scroll.size = @size
-		# # scroll.width = Math.min(layer.width, @width)
-		# # scroll.height = Math.min(layer.height, @height)
-		# scroll.scrollHorizontal = layer.width > width
-		# scroll.scrollVertical = layer.height > height
-
-		# contentInset =
-		# 	top: scroll._originalContentInset?.top ? 0
-		# 	bottom: scroll._originalContentInset?.bottom ? 0
-		# contentInset.top += @header.height if @header
-		# contentInset.bottom += @footer.height if @footer
-		# scroll.contentInset = contentInset
-
-		# return scroll
+	_wrapLayer: (flowLayer) ->
+
+		flowLayer._flowLayer = flowLayer
+
+		return flowLayer if flowLayer instanceof ScrollComponent
+		return flowLayer if flowLayer._flowWrapped
+
+		# Make the layer at least match the device size
+		flowLayer.width = Math.max(flowLayer.width, @width)
+		flowLayer.height = Math.max(flowLayer.height, @height)
+
+		layer = layoutPage(flowLayer, @size)
+		layer = layoutScroll(layer, @size)
+
+		# Mark the layer so we don't layout it twice'
+		layer._flowLayer = flowLayer
+
+		# Forward the scroll events from created scroll components
+		for scroll in [layer, layer.children...]
+			@_forwardScrollEvents(layer)
+
+		# Set the background color for he created scroll component
+		if layer instanceof ScrollComponent
+			scroll.backgroundColor = @backgroundColor
+
+		return layer
+
+	_forwardScrollEvents: (scroll) =>
+
+		return unless scroll instanceof ScrollComponent
+		return if scroll._flowForward is true
+
+		# But only the actual scroll events
+		for event in [
+			Events.ScrollStart,
+			Events.Scroll,
+			Events.ScrollMove,
+			Events.ScrollEnd,
+			Events.ScrollAnimationDidStart,
+			Events.ScrollAnimationDidEnd]
+			do (event) => scroll.on event, => @emit(event, scroll)
+
+		scroll._flowForward = true
 
 	_wrappedLayer: (layer) ->
 		# Get the ScrollComponent for a layer if it was wrapped,


	scroll = new ScrollComponent
		size: size

	scroll.propagateEvents = false

	layer.point = 0
	layer.parent = scroll.content

	scroll.scrollHorizontal = layer.maxX > size.width
	scroll.scrollVertical = layer.maxY > size.height

		# Wrap the layer into a ScrollComponent if it exceeds the size
		# and correct the parent if needed.
		wrappedLayer = layer
		wrappedLayer = @_wrapLayer(layer) if options.scroll and options.wrap

		wrappedLayer.parent = @
		wrappedLayer.visible = not options.animate

