me.apla.cordova.app-preferences
me.apla.cordova.app-preferences copied to clipboard
textfield is editable on click in settings panel
Please specify your environment : iOS
Plugin version:
- released version: ~0.99.1_
Toolchain:
- Cordova cli
Platforms affected:
- iOS/macOS
Having the below JSON - the version field is editable in the panel - I want this to be static text, from the docs there seems to be no type that is static - such as a string.
[
{
"type" :"group",
"title" :"ABOUT",
"items" : [ {
"title" : "Version",
"type" : "textfield",
"key" : "version"
}]
}
]
It looks like the "read only" version of textfield
is called title
.
i.e. it's not the title of a group => https://github.com/apla/me.apla.cordova.app-preferences/blob/78a944a1fedbb06136664e49e42c8f8cfc295c61/bin/lib/mappings.js#L134
It's just a "read only text field" => https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html
The underlying iOS type is PSTitleValueSpecifier
.
It would be awesome if together we could add support to title
/ PSTitleValueSpecifier
to me.apla.cordova.app-preferences
as it's something I'm needing on my current iPad project as well.
I'd be happy to do the work with a little guidance as I've never written any iOS code before... But I'm willing to give it a go! :sunglasses:
It should not be too difficult to add. You found out most of what is needed already.
It turns out to be as simple as replacing:
titleNotSupported: {
// please use group for this, ios only
// TODO: probably it is good idea to add title automatically:
// 1. if you want to show wide text input without title
// 2. for a slider
// 3. to simulate android summary for fields
}
With:
title: {
ios: "PSTitleValueSpecifier",
types: "string",
required: ["title", "key", "default"],
attrs: {
key: commonMappings.key,
title: commonMappings.title,
default: commonMappings.default,
}
}
I'm not sure how to add support for Android yet...
@apla @pke are you happy to get a PR of the above now (adding read-only text field support to iOS) and we can add the Android support later?
@todthomson sure, happy with what you have found out.
PR raised => https://github.com/apla/me.apla.cordova.app-preferences/pull/119.