In my app I have a textbox in one scene and a tableview in another scene.
When the App starts, the text in the textbox can be scrolled normally, but after going to the tableview scene and coming back to the textbox scene, the scroll is not more working properly. I can only scroll until the position of the cursor. This happens as well when the textbox is not editable.
This happens only on device and I only tested this with Android so far. (Moto G4 Plus, Android 6.0.1)
I built the App with Corona 2016.3002 (2016.12.9) on windows.
I prepared a sample with only necessary code:
main.lua
--------------------------------------------------------------------------------- -- -- main.lua -- --------------------------------------------------------------------------------- -- hide the status bar display.setStatusBar( display.DefaultStatusBar ) -- require the composer library local composer = require("composer") composer.gotoScene( "textBoxScene" ) -- Add any objects that should appear on all scenes below (e.g. tab bar, hud, etc) local backGround = display.newRect(0,0, display.actualContentWidth, display.actualContentHeight) backGround.x = display.contentCenterX backGround.y = display.contentCenterY backGround:setFillColor(0.5,0.5,0.5) backGround:toBack()
textBoxScene.lua
--------------------------------------------------------------------------------- -- -- scene.lua -- --------------------------------------------------------------------------------- local sceneName = ... local composer = require( "composer" ) local widget = require( "widget" ) -- Load scene with same root filename as this file local scene = composer.newScene( sceneName ) --------------------------------------------------------------------------------- function scene:create( event ) local sceneGroup = self.view sceneGroup.Y = sceneGroup.y -- Called when the scene's view does not exist -- -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc ----Backbutton local backButton = display.newRoundedRect( sceneGroup, 0,0, 60, 50, 8) backButton.x = display.contentCenterX-display.contentWidth/2+40 backButton.y = 40 backButton.alpha = 0.6 backButton.id = "backButton" backButton:setFillColor(0, 0, 0) local backButtonText = display.newText(sceneGroup, "\<", 0,0, native.systemFont, 28) backButtonText.x = backButton.x backButtonText.y = backButton.y backButtonText:setFillColor(1,1,1) ----/Backbutton ----handle the buttons function scene.handleButtonEvent( event ) if ( "ended" == event.phase ) then local id = event.target.id if id == "backButton" then composer.gotoScene( "tableViewScene", { effect = "slideLeft", time = 300 } ) end return true end end backButton:addEventListener("touch", scene.handleButtonEvent) ----/handle the buttons ----TextBox local textBox = native.newTextBox( display.contentCenterX, display.contentCenterY, display.contentWidth-40, 80 ) textBox.text = "1\n2\n3\n4\n5\n6\n7\n8\n9\n" textBox.isEditable = false textBox.isFontSizeScaled = true -- make the text box use the same font units as the text object textBox.size = 16 sceneGroup:insert(textBox) ----/TextBox end function scene:show( event ) local sceneGroup = self.view local phase = event.phase local params = event.params if phase == "will" then -- Called when the scene is still off screen and is about to move on screen elseif phase == "did" then -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) elseif phase == "did" then -- Called when the scene is now off screen end end function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene
tableViewScene.lua
--------------------------------------------------------------------------------- -- -- scene.lua -- --------------------------------------------------------------------------------- local sceneName = ... local composer = require( "composer" ) local widget = require( "widget" ) -- Load scene with same root filename as this file local scene = composer.newScene( sceneName ) --------------------------------------------------------------------------------- function scene:create( event ) local sceneGroup = self.view -- Called when the scene's view does not exist -- -- INSERT code here to initialize the scene -- e.g. add display objects to 'sceneGroup', add touch listeners, etc ----Backbutton local backButton = display.newRoundedRect( sceneGroup, 0,0, 60, 50, 8) backButton.x = display.contentCenterX-display.contentWidth/2+40 backButton.y = 40 backButton.alpha = 0.6 backButton.id = "backButton" backButton:setFillColor(0, 0, 0) local backButtonText = display.newText(sceneGroup, "\<", 0,0, native.systemFont, 28) backButtonText.x = backButton.x backButtonText.y = backButton.y backButtonText:setFillColor(1,1,1) function scene.handleButtonEvent( event ) if ( "ended" == event.phase ) then local id = event.target.id if id == "backButton" then composer.gotoScene( "textBoxScene", { effect = "slideLeft", time = 300 } ) end end end backButton:addEventListener("touch", scene.handleButtonEvent) ----/Backbutton ----Table view local tableView = widget.newTableView { top = 100, left = display.contentCenterX-display.contentWidth/2+20, width = display.contentWidth-40, height = 300, } sceneGroup:insert(tableView) ----/Table View end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then -- Called when the scene is still off screen and is about to move on screen elseif phase == "did" then -- Called when the scene is now on screen -- -- INSERT code here to make the scene come alive -- e.g. start timers, begin animation, play audio, etc end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then -- Called when the scene is on screen and is about to move off screen -- -- INSERT code here to pause the scene -- e.g. stop timers, stop animation, unload sounds, etc.) elseif phase == "did" then -- Called when the scene is now off screen end end function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's "view" (sceneGroup) -- -- INSERT code here to cleanup the scene -- e.g. remove display objects, remove touch listeners, save state, etc end --------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) --------------------------------------------------------------------------------- return scene
I am using the standard config.lua and build.settings files (as created by corona when creating a new blank corona project.
To reproduce the problem, start the app, try to scroll the textbox text. Then tap on the backbutton (the app changes to the tableView scene) and tap the backbutton again (app switches back to textBox screen). Now try to scroll the textbox text again.
Any feedback would be great, if somebody else can reproduce this problem I will create a bug report.
Best,
Felix