'Style with text freezes Openlayers react / capacitor app on IOS after unlock (
I'm writing a cross-plattform react application with capacitor and facing freezes in the IOS application (IOS version 15.3.1 - also occured on lower versions) when adding features to OpenLayers ("ol": "^6.3.1"). The features are added in multiple useEffect hooks to the map component (source.addFeature(…)).
The problem arises when I close the app, keep it laying for around 5 seconds and then reopen it. Or if I shortly lock the screen and unlock it again.
After some time, between 10 seconds and 2 minutes, the app manages to recover. After the app has recovered it continues running as if nothing happend. If I debug the app in Xcode and touch the frozen app user interface I get the following console output: App[449:19368][IPC] Connection::waitForSyncReply: Timed-out while waiting for reply for WebPage_touchEventSync from process 451, id=39
The freeze appears independent of the used style for the feature (replaced all images with an inline CircleStyle). If I'm not adding any features the application doesn't freeze!
I found out that the application only freezes when I apply a text to my feature style. If I replace the text the application won't freeze
new Style({
image: new Icon({
opacity: 1,
src: imageSrc,
anchor: [0.5, 1],
scale: 0.6
}),
text: new Text({
text: "This text breaks my app",
fill: new Fill({
color: textColor
}),
stroke: textHalo,
offsetY: 14
})
});
Any suggestions how I could avoid that problem? My current Solution, is to use instead of a Style with an Image and a text to use two Styles one with the image and one with an SVG in that I replace the text. However that is rather a hack than a nice solution.
return [
new Style({
image: new Icon({
opacity: 1,
src: imageSrc,
anchor: [0.5, 1],
scale: 0.6
})
}),
new Style({
image: new Icon({
opacity: 1,
src: imageText,
anchor: [0.5, 0],
scale: 0.8
})
})
];
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
