Skip to content

Commit 6c3754e

Browse files
authored
Merge pull request #19 from MaxToyberman/master
Fix Unable to load error
2 parents a617254 + 3e1a1a8 commit 6c3754e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ You could use `$ npm i react-native-today-widget --save` as well, but don't forg
4141

4242
### Usage
4343

44-
All you need is to register your component for key `TodayWidgetExtension` in your `index.js`
44+
All you need is to create an index.widget.js at the root and register your component for key `TodayWidgetExtension` in your `index.widget.js`
45+
4546
```jsx
4647
const TodayWidget = () => (
4748
<View>
@@ -53,6 +54,11 @@ const TodayWidget = () => (
5354

5455
AppRegistry.registerComponent('TodayWidgetExtension', () => TodayWidget);
5556
```
57+
### Note
58+
please note that registering the widget and the app in index.js file can cause memory issues.
59+
because the app is also bundled (even if you don't need it in your app), and it causes 'Unable to load' errors.
60+
when we devide it to 2 different files, the widget and the app, are bundled seperately.
61+
5662
In place of `TodayWidget` component, you could use any JSX component. See [Basic example](./Examples/Basic/index.ios.js#L34).
5763

5864
Run your app as usual:

ios/RNTodayWidgetExtension.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@
801801
);
802802
runOnlyForDeploymentPostprocessing = 0;
803803
shellPath = /bin/sh;
804-
shellScript = "export NODE_BINARY=node\n\"$SRCROOT\"/../../react-native/scripts/react-native-xcode.sh";
804+
shellScript = "export NODE_BINARY=node\n\"$SRCROOT\"/../../react-native/scripts/react-native-xcode.sh index.widget.js";
805805
};
806806
/* End PBXShellScriptBuildPhase section */
807807

0 commit comments

Comments
 (0)