I have a widget made using widgetkit extension which have four tappable icons which opens specific screen in the app using deeplinks.
Link(destination: URL(string: deepLinkUrl)!) {
..... //tappable UI components
}
However, on tapping the area outside the icons, i.e the widget itself(the blank area), it opens the app by default. Is there any way to stop this default behaviour. Similar to Today widgets like whatsapp,snapchat
Related
How can I show in my app a snapshot of a widget?
I created an app where you can modify the widget (like colors, text...). I would like to show in real time a preview of the widget. How can I do?
After Select Widget views target membership same as app.
You can use Widgets code in your app.
I'm trying to add buttons to a widget having family type ".systemLarge". I want to execute some code without opening the app.
Anyone knows how to do that?
For example the Shortcuts App Widget includes buttons you can tap to execute a shortcut without opening the app.
Widgets are read only. The Shortcuts app is an exception.
https://developer.apple.com/documentation/widgetkit/creating-a-widget-extension
Widgets present read-only information and don’t support interactive elements such as scrolling elements or switches. WidgetKit omits interactive elements when rendering a widget’s content.
You can add Link controls on medium and large size widgets to get a button like behavior.
This won't allow you to create interactive widgets, which change their content by clicking elements inside the widgets.
But you will be able to tell which "link" was clicked based on the widgetUrl provided when your app gets activated through the widget.
See the chapter Respond to User Interactions here:
https://developer.apple.com/documentation/widgetkit/creating-a-widget-extension
I am developing a Flutter App. In a specific screen, I have a Cupertino style text field. (The whole app is Cupertino, I have four TabBars below the screen). Whenever I click on the textfield, the virtual keyboard opens and all the widgets squeeze between the textfield and the keyboard (with yellow-black bands of course).
The widgets are Expandable rows and columns (Flexible also has the same result).
resizeToAvoidBottomPadding is disabled.
resizeToAvoidBottomInset does not have any functionality.
SingleChildScrollView does not work.
ListView is meaningless, since my widgets are stateless and static.
What I need is to have keyboard open on top of the current widgets, instead of moving them. This problem exists both in iOS and Android.
After couple of weeks, I finally reached the solution. Despite indicating 'resizeToAvoidBottomInset' as not working above, I was using that in one of the folders of tabs. However this should be added where you build the tabs.
We have found a behaviour that in my opinion is a bug in Safari. Install the PWA on iOS to Home Screen, open app in standalone mode and tap to any text input, close the keyboard and double-tap on free space (it zooms out if zoomed, then double tap again), the white block appears from bottom of the page. Probably it is caused by the “keyboard” to offset the content when keyboard is active. I have tried with Angular and with React to create empty project and adding just an input and some coloring so the block is more visible. Both repositories are available on GitHub and deployed to Firebase. I have tried with a few production PWA of different companies, all apps had the same (buggy) behavior. I have reported to Apple already. Does anybody found a solution or tip how to prevent the scrolling?
Angular
https://github.com/lenkavon/pwa-double-tap-bug-ng
https://pwa-double-tap-bug-ng.firebaseapp.com
React
https://github.com/lenkavon/pwa-react-double-tap
https://pwa-double-tap-bug.firebaseapp.com
Steps to reproduce
- on iPhone iOS11.*, iOS12.*
- install the PWA app to homescreen add PWA to homescreen
- open the app from home - standalone mode
- tap the input to open the keyboard
- close keyboard
- double tap on any free space
Behavior: white panel arrives from bottom of the display (probably the 'space' for keyboard)
Expected behavior: zoom or nothing depending on meta tags.
https://i.makeagif.com/media/3-12-2019/WQwlCk.gif
For anyone who is having this issue,
this is a wacky yet simple workaround:
document.addEventListener("scroll", (e) => {
if (document.documentElement.scrollTop > 1) {
document.documentElement.scrollTop = 100;
}
});
Apple developers should be ashamed really
This is still a bug today in iOS13 but I have found a work around.
You can add an empty touchstart event listener to a parent element. Ideally you select an element that covers the entire viewport that isn't document.body. The event listener will prevent the double-tap from triggering the invisible keyboard.
Using your angular example, the problem is fixed with the following:
document.querySelector('app-root').addEventListener('touchstart', (e) => {});
I'm setting [self.extensionContext setWidgetLargestAvailableDisplayMode:NCWidgetDisplayModeExpanded] in viewDidLoad and, as expected, I'm getting the "show more" button that toggles between compact and expanded widget mode.
When the widget starts, it's always in compact mode by default. How can I change that and make widget be in expanded mode when it starts?
It is impossible.
A widget should not take over the screen by default. It defeats the purpose of a widget. You should make the content you want to display to user minimum and small (like a brief info), and user should be able to expand to view more details. This is how Widget works as intended.