Titanium BlurView not recognized - appcelerator

In the documentation I found that there is a BluView object that can be added to blur views: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.iOS.BlurView
When I try using it:
var blur = Ti.UI.iOS.createBlurView({
width: Ti.UI.FILL,
height: Ti.UI.FILL
});
$.test.add(blur);
I get the following exception:
[ERROR] : TypeError: undefined is not a function (evaluating 'Ti.UI.iOS.createBlurView({
[ERROR] : width: Ti.UI.FILL,
[ERROR] : height: Ti.UI.FILL
[ERROR] : })')
[ERROR] : File: app.js
[ERROR] : Line: 302
[ERROR] : SourceId: <null>
[ERROR] : Backtrace:
[ERROR] : undefined
Is this API wrongfully documented?

Nope, API docs are not wrong, but you missed one thing that the supported SDK is 5.4.0 - iPhone & iPad, and this SDK is not yet available as a General Release.
So wait until it releases or the same implementation can be achieved by using this Apaladini blur Module.
The docs of this above Apaladini blur module tells you how to create a blur view in iOS using controller file, but here is how you can do it using Alloy.
<View module="com.apaladini.blur" method="createView" style="0" width="100" height="100"></View>
style property can be given these values:-
0 for Dark, 1 (default) for Light and 2 for ExtraLight
Note that the style property of this module is exactly same as the effect property of the BlurView in API docs.
A more useful blur module for iOS & Android : Android+iOS Blur Module
Good Luck!!!

Related

Displaying only the right part of an image in QML - sourceClipRect

I'm trying to display only the right part of an image in QML by using the sourceClipRect property
Here is a snippet of the code
Image
{
id : _image
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectCrop
width: parent.width
height: parent.height
sourceSize.width : undefined
sourceSize.height : undefined
source : imagePath
sourceClipRect: Qt.rect(sourceSize.width/2, 0, sourceSize.width/2, sourceSize.height)
smooth : true
mipmap : true
}
This image is inside an item with a fixed Width and Height
This gives me a warning and a binding loop on the property sourceClipRect, I'm guessing from using sourceSize in the sourceClipRect
I cannot use hard numbers in the sourceClipRect, as I don't know the original size of the picture
Do you know how can I avoid this binding loop ?
Maybe by getting the original width and height another way, but I don't know any other way than sourceSize in pure QML
Ps : The results works as expected and is working fine, i just have an ugly warning stating a binding loop
Thanks a lot in advance
I finnaly found a fix for this that is acceptable.
It is maybe not the cleanest but it's acceptable for me.
But at the instanciation of the image i just save the var without the binding like so
Image
{
id : _image
property var sourceSizeWidth :{sourceSizeWidth = sourceSize.width} //initializing this way avoids the binding between sourceSize.Width and sourceSizeWidth
property var sourceSizeHeight :{sourceSizeHeight = sourceSize.height} //initializing this way avoids the binding between sourceSize.height and sourceSizeHeight
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectCrop
width: parent.width
height: parent.height
sourceSize.width : undefined
sourceSize.height : undefined
source : imagePath
sourceClipRect: Qt.rect(sourceSizeWidth/2, 0, sourceSizeWidth/2, sourceSizeHeight) //Use the unbinded var to set the sourceClipRect
smooth : true
mipmap : true
}
Doing an initialization like this avoid the binding between newly created sourceSizeWidth and QML property sourceSize.width
property var sourceSizeWidth :{sourceSizeWidth = sourceSize.width}
As I said, not the cleanest and there is probably a smarter way of doing it, but it's enough for now, works fine and without warning binding loop.
Cheers !

Mapbox is not working giving error so tell me how its work giving following error

I am adding this code in my file it is not working and giving error 'mapboxsdk' undefined and nativescript-mapbox is not added on preview app also give me this as warning in yellow color. So now can I work with mapbox plugin I added my token too but it is not working.
TypeError: Cannot read property 'mapboxsdk' of undefined
HTML:
<ContentView height="100%" width="100%">
<Mapbox
accessToken="your_token"
mapStyle="traffic_day"
latitude="50.467735"
longitude="13.427718"
hideCompass="true"
zoomLevel="18"
showUserLocation="false"
disableZoom="false"
disableRotation="false"
disableScroll="false"
disableTilt="false"
(mapReady)="onMapReady($event)">
</Mapbox>
</ContentView>
component.ts:
import { registerElement } from "nativescript-angular/element-registry";
registerElement("Mapbox", () => require("nativescript-mapbox").MapboxView);

Failed to set an indexed property on 'CSSStyleDeclaration'

I have a project with Gatsby where I use React Spring. I am getting the following error:
TypeError: Failed to set an indexed property on 'CSSStyleDeclaration': Index property setter is not supported.
In some of my research I have found that browser updates have been causing this type of error in other scenarios, but I haven't found any that deal with React Spring.
I have tried upgrading all related dependancies to the latest versions.
I have narrowed it down to a part of my code that uses React Spring:
const trail = useTrail(2, {
opacity: sideNav ? 1 : 0,
x: sideNav ? 0 : 180,
height: sideNav ? 180 : 0,
from: { opacity: 0, x: 20, height: 0 },
});
<NavItem style={trail}>
<Link to="/">Home</Link>
</NavItem>
If I take out style={trail} I no longer get the error so I'm thinking it has something to do with React Spring's useTrail.
I expect it to work as it did a few days ago, where I don't get an error and my animation works as expected. I actually have not touched the code in a few weeks, and the site was loading correctly just a few days ago. Now it suddenly breaks.
The useTrail documentation says:
The return value is an array containing animated props.
Hence you can't directly apply trail to the style of one item. It should be something like:
{trail.map(style => (
<NavItem
style={style}
>
<Link to="/">Home</Link>
</NavItem>
))}

Unable to show the context menu in ckeditor

can anyone please help me out for the following error:
Uncaught TypeError: Cannot read property 'show' of undefined
at line editor.contextMenu.show(editor.document.getBody(), null, x,
y); in plugin.js

Circular image edges are jagged in Alloy appcelerator

I am trying to make an circular image view in Alloy appcelerator formerly Titanium like this
XML
<ImageView id="profile_photo" />
TSS
"#profile_photo_view_holder":{
width: 80,
height: 80,
borderRadius: 40,
borderWidth:2,
borderColor:"black"
}
The image view is rendering properly but jaggy in its edges looks like an anti aliasing problem.
I use image factory module to scale down also but no luck.
resizedImage = ImageFactory.imageAsResized(blob, {
width : 80,
height : 80,
quality : 0.9
});
$.profile_photo.image = resizedImage;
on Android you will need to make use of a module to achieve it.
This module is quite new and looks great:
https://github.com/m1ga/com.miga.roundview
I'm using this one in my project:
https://github.com/snowciety/sc.roundedavatar
Hope it helps

Resources