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
onCellUnHighlight and row.reload #761
Comments
On another topic, it's still a bit unclear for me when to use |
@mats-claassen @mtnbarreto If this is a bug, don't hesitate to give me some hints, I can try to fix it myself and submit a PR 👍 |
I would not say this is a bug.. We will have to add some clarification on the FAQ readme section. basically According apple documentation:
On the other hand New eureka version calls /**
Called when a cell becomes first responder
*/
public final func beginEditing<T:Equatable>(of cell: Cell<T>) {
cell.row.isHighlighted = true
cell.row.updateCell()
RowDefaults.onCellHighlightChanged["\(type(of: cell.row!))"]?(cell, cell.row)
cell.row.callbackOnCellHighlightChanged?()
...
...
}
} If you only want to update the cell, you should use |
@mtnbarreto Thanks for the explanation. Although I get the same issue with If tomorrow I can duplicate this behaviour in the exemple project of Eureka, would you take a look? |
sure! do it in the master branch code please. regards |
@mtnbarreto I just reproduced the async issue in the master branch, here's the code: https://github.com/allaire/Eureka |
I looked at the code. Basically the issue comes from open func textFieldDidEndEditing(_ textField: UITextField) {
formViewController()?.endEditing(of: self) // --> it invokes `onCellHighlightChanged`
formViewController()?.textInputDidEndEditing(textField, cell: self)
textFieldDidChange(textField)
textField.text = displayValue(useFormatter: (row as? FormatterConformance)?.formatter != nil) -> overrides the text field text
} Based on that, there is no UIKit nor thread/race condition issue. By using the dispatch_async you are setting up textField.text after Let me see if we can change the sentences order to avoid this error. |
@mtnbarreto Good catch! Let me know how this goes :) |
Hi,
it seems that when I try to call
row.reload()
inonCellUnHighlight
(because I want my IntRow to get refreshed and pick the new value ofdisplayValueFor
I declared in setup), it does not reload the cell with the good format. Same thing withrow.updateCell()
.However, when I scroll and the cell is off the screen, and scroll back to it, then it's formatted correctly.
The only way to fix it is to add a bit of delay before calling
row.reload()
inonCellUnHighlight
(dispatch_async(dispatch_get_main_queue())
also works) :Calling
self.tableView?.reloadData()
also seems to work.When I use
row.reload(.Fade)
, the cell disappears completely.Is this the expected behaviour?
The text was updated successfully, but these errors were encountered: