An expo module that allows you to make native widgets in iOS and android.
Use v1 packages for expo 49, or v2 for expo 51+.
npx expo install @bittingz/expo-widgets
See the example project for more clarity. You can omit the android or ios folders and setup if you only wish to support one platform.
[
"@bittingz/expo-widgets",
{
ios: {
src: "./src/my/path/to/ios/widgets/folder",
devTeamId: "your apple dev team ID",
mode: "production",
moduleDependencies: [],
useLiveActivities: false,
frequentUpdates: false,
entitlements: {
"any xcode entitlement the widget needs": "entitlement value"
}
},
android: {
src: "./src/my/path/to/android/widgets/folder",
widgets: [
{
"name": "MyWidgetProvider",
"resourceName": "@xml/my_widget_info"
}
],
distPlaceholder: "optional.placeholder"
}
}
],
If you need to override xcode options (such as handling a swift version mismatch) you can add the following:
xcode: {
configOverrides: {
SWIFT_VERSION: '5.0',
},
},
The configOverrides properties are the xcodeproj values and must match case exactly.
cd example
npm run prebuild:ios
npm run ios
OR
npm run prebuild:android
npm run android
If you use R in your widget kotlin file to get layouts, you may get an unresolved reference error for R. In this case, simply add "package your.appconfig.packageid.R", delete your android folder and rebuild.
Give my other expo module a try. You'll need to put the fonts config before the widgets config.
If you need widgets designed & developed, reach out for more details.
A huge thanks to gashimo for a great baseline to start from.