Ionic 2 - Use ios action sheet style for android - ionic2

I'm doing some forms on my app and checking the ion-select component (https://ionicframework.com/docs/api/components/select/Select/), I realized that the ios version looks better than the android version. Is there a easy way to change the behavior so I can use the ios style on android/browser?

Yes, We can use select options for this. Take a look of the following code.
this.selectOptions = {
title: 'Pizza Toppings',
subTitle: 'Select your toppings',
mode: 'ios' // here we can specify our required platform
};

Related

WebStorm does not suggest autocomplete based on TypeScript types for some reason

Just started a fresh new React project, using WebStorm as my IDE.
Lets look at some type of material-UI typography 'varient' attribute:
For an unknown reason, WebStorm does not peek at these types:
('no suggestions' is written buy when I screenshot the message disappear)
VSCode auto-suggest with no problems on this union type:
What's going on? I know for sure that these sort of suggestions worked previously in WebStorm (I'm using latest version).
This is the code:
import { Typography } from "#mui/material";
function App() {
return (
<div className="App">
<Typography variant="">hello world, doing good?</Typography>
</div>
);
}
export default App;
WEB-53199 is fixed in the upcoming 2021.3.2 update

SwiftUI fails to build preview with compiling error

When I go to view my SwiftUI through the canvas preview in Xcode 11.3.1 I am getting the error
Compiling failed: 'Color' is only available in iOS 13.0 or newer
But the project itself builds successfully and the simulator loads without any issues. I have tried clearing the build folder, quitting Xcode and rebuilding but still no luck.
Any help would be great. Thanks in advance.
SwiftUI minimum deployment target is 13.0, so if you have project with support of older version, then all SwiftUI code (including preview providers) you have to prepend with availability modifier, like
#available(iOS 13.0, *) // << here !!
struct Demo: View {
var body: some View {
VStack {
Text("Hello")
}
}
}
You Should use Assets or Other option like Color Literal for Color.
Don't use the system Color option since your deployment target is 11.4.
Man, I've had a similar issue. The problem was that sometimes my preview worked sometimes it didn't... I reviewed the diagnostics and realized that there are some #_dynamicReplacement attributes mentioned (which are used, I guess, for hot reloading). It wasn't working when I've had a file with #available attributes opened in the (adjacent) editor. When I closed that editor everything worked back again.
Magic ✨
Also one more hint from my friend - when you have a file from another target (not the one hosting your Canvas-related code) in (adjacent) editor it behaves the same way.

Qt Installer Framework - Reading downloaded package version

Using QtIFW-1.5.0, so far I'm able to generate an online installer for my Qt application on Windows. The installer downloads the appropriate package from my web server and performs some operations defined in the control script installscript.qs, e.g. writing some keys into registry and creating a desktop shortcut with an icon:
installscript.qs:
Component.prototype.createOperations = function()
{
try
{
// call the base create operations function
component.createOperations();
// Add some keys to registry;
var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile);
var reg = installer.environmentVariable("SystemRoot") + "\\System32\\reg.exe";
var key= "HKCU\\Software\\Company\\Product";
component.addOperation("Execute", reg, "ADD", key, "/f");
component.addOperation("Execute", reg, "ADD", key, "/v", "productId", "/t", "REG_BINARY");
// Add a desktop shortcut with icon:
component.addOperation("CreateShortcut",
"#TargetDir#\\MyExecutable.exe",
"#UserProfile#\\Desktop\\MyExecutable.lnk",
"workingDirectory=#TargetDir#",
"iconPath=#TargetDir#\\MyIcon.ico");
}
catch (e)
{
print(e);
}
}
All right, but another key I need to write into registry is the package VERSION NUMBER, defined in the installer configuration file config.xml in tag
<Version></Version>
How can I get this value from installscript.qs ? I read --I'd said more: studied-- the docs component QML Type and installer QML Type and I have not found any reference to version, except:
installer QML type:
boolean versionMatches(string version, string requirement)
which is useless for me, because you have to know the version, which is precisely what I find.
So any help would be appreciated.
You can call
var version = installer.value("ProductVersion");
to get the version specified in the config.xml file.

UIButton not appearing in Rubymotion

For some reason my UIButtons aren't appearing in my ruby motion apps. Only the button text appears.
Here's the code:
#containerView = UIView.alloc.initWithFrame([[0, 50], [self.view.frame.size.width, 100]])
#loginButton = UIButton.buttonWithType(UIButtonTypeRoundedRect)
#loginButton.frame = [[(self.view.frame.size.width / 2) + 5, 65], [(self.view.frame.size.width / 2) - 15, 40]]
#loginButton.setTitle('Login', forState: UIControlStateNormal)
#loginButton.addTarget(self,
action:'login',
forControlEvents:UIControlEventTouchUpInside)
#containerView.addSubview(#loginButton)
self.view.addSubview(#containerView)
I'm using RubyMotion v2.16, Promotion 1.0.4, sugarcube 1.3.5, motion layout 0.0.1 and bubblewrap 1.4.0
I've tried to render the buttons using the promotion way, the sugarcube way and the bubblewrap way but decided to break it down to the raw rubymotion way (above) for troubleshooting in a regular view controller. Any ideas on this one?
Well, if anyone else is reading outdated documentation also, it turns out that UIButtonTypeRoundedRect has been deprecated in iOS7.
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/Controls.html#//apple_ref/doc/uid/TP40013174-CH9-SW1

What is the alternative to getActionView() before API level11 in android?

getActionView() for action bar was introduced in API 11, If I want backward compatibility what is the alternative for getActionView() ?
e.g.
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.action_bar_menu, menu);
final MenuItem item = menu.findItem(R.id.menuitem);
item.getActionView() //Works from API level 11
return true;
}
You can use MenuItemCompat.getActionView(MenuItem menuItem) from the support library to get the action view on pre 11 API.
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_activity_actions, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
// Configure the search info and add any event listeners
...
return super.onCreateOptionsMenu(menu);
}
See http://developer.android.com/guide/topics/ui/actionbar.html for details
For backwards compatibility you can use either ActionBarCompat or ActionBarScherlock. In both cases you can use the method getActionView(). You have to be sure that the import, in the first case is from the compatibility library ( android.support.v4.view.MenuItemCompat). If
you use ActionBarSherlock you have to import com.actionbarsherlock.view.MenuItem. Then you should be ok using item.getActionView().
Old
Since August 2013, and I pray people down-voting to take a look. You have to be sure that the OP's question date import, Android introduced in the first case is from the compatibility library ( ActionBarCompactandroid.support.v4.view.MenuItemCompat). Even though If you use ActionBarSherlock is still a valid choice, an option is moving towards ActionBarCompact.
So another option is to use it, and of course, all the importsyou have to came from the support library, e.g. android.supportimport com.v4actionbarsherlock.view.MenuItemCompatMenuItem. Then you should be ok using item.getActionView().