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

Issues/focusable support #232

Closed

Conversation

DevTchernov
Copy link

No description provided.

@DevTchernov DevTchernov changed the base branch from master to develop April 19, 2020 13:15
@Alex009 Alex009 self-assigned this Apr 20, 2020
Comment on lines +147 to +155
label = "SystemInputViewFactory 1".desc()
),
InputWidgetGalleryScreen.InputInfo(
id = SystemInputId,
label = "SystemInputViewFactory 2".desc()
),
InputWidgetGalleryScreen.InputInfo(
id = SystemInputId,
label = "SystemInputViewFactory 3".desc()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for what here 3 same screens?

Comment on lines +6 to +8
/*
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copyright should be from first line of file

Comment on lines +11 to +12
val getFocused: LiveData<Boolean>
val setFocused: MutableLiveData<Boolean>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

livedata is not callback, it should be just val focused: MutableLiveData<Boolean> - and setting and getting allowed, also we can observe changes

Comment on lines +37 to +38
override var hasNext: Boolean = false //TODO: Relocate in init(...)?
override var hasPrev: Boolean = false //TODO: Relocate in init(...)?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it allow to change value from outside, not by our logic but just because someone write input(...).apply { hasNext = true } and broke our logic

Comment on lines +185 to +216
override fun textField(
textField: UITextField,
shouldChangeCharactersInRange: CValue<NSRange>,
replacementString: String
): Boolean {
if (inputFormatter == null) {
return true
}
val nsString = NSString.create(string = textField.text ?: "")
val newText = nsString.stringByReplacingCharactersInRange(
range = shouldChangeCharactersInRange,
withString = replacementString
)
val unformattedText = inputFormatter.unformat(newText)

textField.text = inputFormatter.format(unformattedText)
textField.sendActionsForControlEvents(UIControlEventEditingChanged)
return false
}

override fun textFieldDidBeginEditing(textField: UITextField) {
getFocused.postValue(true)
if (hasNext) {
textField.returnKeyType = UIReturnKeyType.UIReturnKeyNext
}
//TODO: Work with accessory view here depending on keyboard type and previous button enabled?
}

override fun textFieldShouldReturn(textField: UITextField): Boolean {
getFocused.postValue(false)
return true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we cant observe focused state without setting delegate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in same request used notification center, so we not set own delegate - https://github.com/icerockdev/moko-widgets/pull/180/files

Comment on lines +13 to +14
var hasNext: Boolean
var hasPrev: Boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it should be val to prevent invalid changes by developers outside of our focusable logic

Comment on lines +54 to +56
).apply {
[email protected](this)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this search should be done automatic by default...can we got it?

@Alex009 Alex009 closed this Aug 14, 2024
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

Successfully merging this pull request may close these issues.

3 participants