Status Update
Comments
an...@google.com <an...@google.com>
[Deleted User] <[Deleted User]> #2
This is probably happening because there are multiple instances of DataStore active. You should consider managing the DataStore as a singleton. See the attached bug for more info.
da...@gmail.com <da...@gmail.com> #3
+1
nj...@google.com <nj...@google.com> #4
There is an internal discussion regarding when this fix will land, however, if you need it sooner rather than later, you can copy and paste the implementation of the Modifier.border into your application as it does not leverage any private APIs.
Description
Jetpack Compose release version:
Android Studio Build:
Steps to Reproduce:
Shape
class and override thecreateOutline
function in order to create your own outline for the shape using thePath
class. ThePath
that you create should have a side that starts from a lower co-ordinate and then useslineTo
to draw a line UP and LEFT so that the line essentially travels towards the top-left of the space. If this is confusing then here is a providedPath
that does exactly this: (You can see the line with the commentThis is the THINNER one
that is thelineTo
that travels up and left creating an angled line)Shape
class, you now need to have a simple compose function that draws aBox
and add aborder
modifier to thatBox
. The border modifier should take the customShape
that we created in step 2, like so (example):Now simply run the app or run the preview, in both situations you will see that the line that draws up and left will be thinner than the other lines that are (in this case) specified to be
2.dp
, depending on the angle of the line the line might not even have any width and not be seen. (reference attached image: 0_compose_bug_rc01.png, screenshot of the top left corner of the drawn path showing clearly the thinner line compared to the others)For completeness now DO NOT change any of the above code, but instead change the compose version number down to a beta release (I tested it with beta07) and run the code again and you will see that the line in question now draws correctly and has a width (thickness) similar to the others. (reference attached image: 0_compose_bug_beta07.png, screenshot of the top left corner of the drawn path showing clearly that with this version of compose the thinner line is not present and instead has the same thickness as the others, as it should)
Write-up
After following the steps above you will hopefully see that between the different compose versions (in this case beta07 and rc01) that the line that draws up and left does not draw correctly. The reason that I have submitted this issue is simply because this issue was not present in previous version of compose, so I believe (possibly incorrectly) that this drawing bug has been introduced in the newer releases (possibly rc01). I hope this all makes sense, please reach out to me for anymore information as i would love to be more useful and help on addressing this issue. ALSO if this is infact not an issue then please take my deepest apologies for wasting anyone's time, maybe someone will reach out and tell me that im using the wrong APIs to draw my
border
orpath
and in that case I really hope I haven't caused any trouble!