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
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
3. Manually call the `sync` method from within the `componentDidMount` lifecycle event, to initiate a background update on each app start:
436
+
**Option 2: Call `codePushify` on your root component and assign the result to itself after the component declaration:**
437
+
438
+
```javascript
439
+
import codePush, { codePushify } from "react-native-code-push";
440
+
441
+
let codePushOptions;
450
442
451
-
```javascript
452
-
import codePush from "react-native-code-push";
443
+
class MyApp extends Component {
444
+
}
453
445
454
-
class MyApp extends Component {
455
-
componentDidMount() {
456
-
let syncOptions;
457
-
458
-
codePush.sync(CodePushOptions);
459
-
}
446
+
MyApp = codePushify(codePushOptions)(MyApp);
447
+
```
448
+
449
+
**Option 3: Manually call the `sync` method from within the `componentDidMount` lifecycle event, to initiate a background update on each app start:**
450
+
451
+
```javascript
452
+
importcodePushfrom"react-native-code-push";
453
+
454
+
classMyAppextendsComponent {
455
+
componentDidMount() {
456
+
let syncOptions;
457
+
458
+
codePush.sync(syncOptions);
460
459
}
461
-
```
460
+
}
461
+
```
462
462
463
463
If an update is available, it will be silently downloaded, and installed the next time the app is restarted (either explicitly by the end user or by the OS), which ensures the least invasive experience for your end users. If an available update is mandatory, then it will be installed immediately, ensuring that the end user gets it as soon as possible.
0 commit comments