Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After updating tableview alertview becomes unresponsive #441

Open
alouanemed opened this issue Mar 13, 2019 · 0 comments
Open

After updating tableview alertview becomes unresponsive #441

alouanemed opened this issue Mar 13, 2019 · 0 comments

Comments

@alouanemed
Copy link

I have a tableview with several items on whcih each it has an udpate button.When clicked it shows the alert, receive user inputs and reload data of the tableview. The next time I click in the update button, the alert showsup but with no interaction meaninig I can't click in the edittext nor the cancel button. and if clicked outside the alert it keeps showing multiple alerts.

Observable
            .zip(tableView.rx.itemSelected, tableView.rx.modelSelected(CartProductSectionItem.self))
            .bind { indexPath, model in
                switch model {
                case .cartItem(let viewModel) :
                    self.showAlert(with: viewModel.item)
                default:
                    return
                }
            }.disposed(by:rx.disposeBag)
     

The Alert view config.

  func showAlert(with item: CartItem){
        let vm = viewModel as! ViewModel

        let appearance = SCLAlertView.SCLAppearance(
            kTitleFont: Configs.Font.regular(size: 14),
            kTextFont: Configs.Font.regular(size: 14),
            showCloseButton: true, showCircularIcon: false
        )
        
        let alertView = SCLAlertView(appearance: appearance)
        let qty: String = {
            if let qty = item.quantity{
                return String(qty)
            }
            
            return R.string.localizable.cartActionUpdateQty.key.localized()
         }()
        
        let alertViewText = alertView.addTextField(R.string.localizable.cartActionUpdateQtyPrefill.key.localized())
        alertViewText.keyboardType = .numberPad
        alertViewText.text = qty
        _ = alertView.addButton(R.string.localizable.commonActionUpdate.key.localized()) {
            if var qtyValue = alertViewText.text {
                
                if qtyValue.isEmpty{
                    qtyValue = "1"
                }
                
                alertViewText.text = qtyValue
                vm.updateIemQty(with: item.id!, qty: qtyValue)
            }
        }
        
        alertView.showEdit("", subTitle: R.string.localizable.cartActionUpdateQty.key.localized())
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant