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
Add support for selecting a keyboard type #32
Comments
This issue can be closed; I re-visited this today and came up with a solution. Here it is for anyone struggling with this, too: # app/screens/pin_entry_screen.rb
#
class PinEntryScreen < PM::XLFormScreen
stylesheet PinEntryScreenStylesheet
title 'Login'
form_options required: :asterisks,
on_save: :'submit_pin:'
def on_appear
find(UITextField).apply_style(:pin_entry_input)
find(UITextField).focus
end
def submit_pin(values)
dismiss_keyboard
#
if values.fetch('pin') == '1111'
App.alert("PIN-entry successful") do
open_tab_bar HomeScreen.new(nav_bar: true), ConfigScreen.new(nav_bar: false)
end
else
App.alert("PIN-entry failed") do
on_appear
end
end
end
def form_data
[
title: nil,
cells: [
{
name: :pin,
type: :password,
placeholder: 'Enter your 4-digit PIN',
required: true
},
{
title: 'Submit',
name: :save,
type: :button,
on_click: -> (cell) {
on_save(nil)
}
},
]
]
end
end
# app/stylesheets/pin_entry_screen_stylesheet.rb
#
class PinEntryScreenStylesheet < ApplicationStylesheet
def pin_entry_input(st)
st.text_alignment = :center
st.keyboard_type = :number_pad
end
end Here's a brief explanation of how this works: you specify a As far as I can make out, * see a full list of keyboard-types provided by RMQ here;
Note: this also includes a solution to another issue I posted here recently. |
I think |
👍 |
|
Perhaps I'm going about my particular problem the wrong way, but it seems to me that one should be able to, for example, specify a field be of type
:password
and, when clicked, pop up the:integer
type keyboard. Is keyboard type selection on a per-screen basis part of RedPotion?Is there an option I'm missing for each item in my
cells
array that achieves this?The text was updated successfully, but these errors were encountered: