             var contentInset = tableView?.contentInset
             contentInset!.bottom = endFrame!.size.height + constants().mainViewBottomMargin
             tableView!.contentInset = contentInset!
-        }
-        UIView.animate(withDuration: duration,
-                       delay: TimeInterval(0),
-                       options: animationCurve,
-                       animations: { self.view.layoutIfNeeded() },
-                       completion: nil)
+            
+        }
+        
+        UIView.animate(withDuration: duration, delay: TimeInterval(0), options: animationCurve, animations: {
+            // animate our updates
+            self.view.layoutIfNeeded()
+        }) { (finished: Bool) in
+            // need to scroll the tableView to the active textField since our tableView bounds have changed
+            self.scroll(to: self.activeTextField)
+        }
     }
     
     // MARK: SBAGenericStepDataSource delegate

    
    public func textFieldDidBeginEditing(_ textField: UITextField) {
        
        guard let customField = textField as? SBAStepTextField else { return }
        
        savedVerticalScrollOffet = tableView!.contentOffset.y
        tableView?.scrollToRow(at: customField.indexPath!, at: .bottom, animated: true)
    }
    
    public func textFieldDidEndEditing(_ textField: UITextField) {
        
        // scroll back to our saved offset
        tableView?.setContentOffset(CGPoint(x: 0.0, y: savedVerticalScrollOffet), animated: true)
    }
    
    

                
                let answerFormat = tableItem?.formItem?.answerFormat?.implied()
                let type = answerFormat?.questionType
                
                // set keyboard type
                if let textAnswerFormat = answerFormat as? ORKTextAnswerFormat {
                    // use the keyboard type defined for this step
                    fieldCell.textField.keyboardType = textAnswerFormat.keyboardType
                    fieldCell.textField.isSecureTextEntry = textAnswerFormat.isSecureTextEntry
                }
                else {
                    // use the keyboard type appropriate for the questionType
