Closed EladKarni closed 9 months ago
You probably missed a step in the guide (did you update app.config.ts or app.json?)
Can you check the docs again, or share your code on a branch in your project?
You probably missed a step in the guide (did you update app.config.ts or app.json?)
Can you check the docs again, or share your code on a branch in your project?
I redid the whole process and still I'm not seeing it.
I created the handler, and registered it with expo (note that index.js
already existed so I just modified it). and the preview seems to be working so I'm not sure what step I might have missed...
Here is the branch I'm working on https://github.com/EladKarni/rn-dualtemp-weather/tree/feat/android-homescreen-widget
Edit: The last commit in the branch is all the work I did to add the feature. Let me know if you need any additional things from me!
I think you are missing https://saleksovski.github.io/react-native-android-widget/docs/tutorial/register-widget-expo#build-dev-client
I saw that you are using npx expo run:android
, and I'm not sure how that works.
From your commit in app.config.ts
I see fonts: ['./assets/fonts/Inter.ttf'],
, but that font is not present in assets.
So the app should not compile, and the widget will not be registered in android.
I'm not sure how your app starts, I tried running npx expo run:android
on the example-expo
project in this repo while adding a reference to non-existing font, and it immediately failed with
✖ Config sync failed
Error: [android.dangerous]: withAndroidDangerousBaseMod: ENOENT: no such file or directory, copyfile '/home/stefan/Development/react-native-android-widget/example-expo/assets/fonts/Ndot-56.otf' -> 'android/app/src/main/assets/fonts/Ndot-56.otf'
Also, you are referencing ./assets/widget-preview/hello.png
which also does not exist. The correct file is ./assets/widget-preview.png
I'm assuming your android folder is already generated, and npx expo run:android
does not fail for some reason, but I don't know why.
Can you try deleting it and trying again, after fixing the config? Or create a dev client using the guide.
I think you are missing https://saleksovski.github.io/react-native-android-widget/docs/tutorial/register-widget-expo#build-dev-client
So I'm not sure why it isn't showing for you, but I just checked the project again and I do see the correct configuration in:
https://github.com/EladKarni/rn-dualtemp-weather/blob/feat/android-homescreen-widget/app.config.js
I updated the name for the asset and removed the font in my last commit.
I'm not sure why you were having issues building the app, but seems like removing the font & changing it to the correct asset name have done the trick. I ran into an issue where the first time when I tried to add the widget it was "there" but invisible while still allowing me to click on it... I tried reproducing the error so I can record it, but the second time it worked fine so who knows lol!
Regardless, appreciate the help and apologies for wasting your time with something that was an oversight on my part!
Sidenote: I'm not sure why you were having trouble compiling it since that was never an issue for me. To test it, I deleted node_modules
and android
folders and it still builds fine.
I'm glad you got it working.
I'm not getting any errors, but I don't see the widget after following the setup guide.
I just updated the project to the latest version of
expo
andreact-native
. I'm not getting any errors when runningnpx expo run:android
so I'm unsure what I did wrong. Any suggestions would be greatly appreciated!Trying to add it to this project: https://github.com/EladKarni/rn-dualtemp-weather