You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Jetpack compose, you can do something like text = stringResource(id = R.string.email) inside a composable which uses ContextAmbient inside. For now, with this plugin, the code would look something like text = getMyString().toString(context = ContextAmbient.current.applicationContext). Moreover, I would have to write a function for each string resource as I can't access them like in R.string.something. Is there a more convenient way of doing it?
The text was updated successfully, but these errors were encountered:
hi @ln-12 ! your sample getMyString().toString(context = ContextAmbient.current.applicationContext) use StringDesc, but for your case text = stringResource(id = R.string.email) you need StringResource.
in MR class generated by plugin you have MR.strings with StringResource fields - for android in StringResource you have field resourceId. so you can just call text = stringResource(id = MR.strings.email.resourceId)
for better support of StringDesc in Compose i think we should add later support module where work with ContextAmbient will be inbox
Ah cool, the hint text = stringResource(id = MR.strings.email.resourceId) did the trick. That's much better, thanks. Is this stated in the readme? If not I think it would be a great idea to mention this method for the use with compose :)
In Jetpack compose, you can do something like
text = stringResource(id = R.string.email)
inside a composable which usesContextAmbient
inside. For now, with this plugin, the code would look something liketext = getMyString().toString(context = ContextAmbient.current.applicationContext)
. Moreover, I would have to write a function for each string resource as I can't access them like inR.string.something
. Is there a more convenient way of doing it?The text was updated successfully, but these errors were encountered: