Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 67f211a

Browse files
authored
Update README.md
1 parent f92acc6 commit 67f211a

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

README.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -406,59 +406,59 @@ With the CodePush plugin downloaded and linked, and your app asking CodePush whe
406406

407407
The simplest way to do this is to "CodePush-ify" your app's root component. To do so, you can choose one of the following three options:
408408

409-
1. Use the [ES7 decorator](https://github.com/wycats/javascript-decorators) syntax:
409+
**Option 1: Use the [ES7 decorator](https://github.com/wycats/javascript-decorators) syntax:**
410410

411-
```javascript
412-
import codePush, { codePushify } from "react-native-code-push";
413-
414-
let codePushOptions;
411+
```javascript
412+
import codePush, { codePushify } from "react-native-code-push";
415413

416-
@codePushify(CodePushOptions)
417-
class MyApp extends Component {
418-
}
419-
```
414+
let codePushOptions;
420415

421-
*NOTE: Decorators are not yet supported in Babel 6.x pending proposal update.* You may need to enable it by doing the following:
422-
- Install the [`babel-preset-react-native-stage-0` package](https://github.com/skevy/babel-preset-react-native-stage-0)
423-
424-
```
425-
npm install babel-preset-react-native-stage-0 --save-dev
426-
```
427-
428-
- In your `.babelrc` file, include the following:
429-
430-
```
431-
{
432-
"presets": ["react-native-stage-0/decorator-support"]
433-
}
434-
```
416+
@codePushify(codePushOptions)
417+
class MyApp extends Component {
418+
}
419+
```
435420

436-
2. Call `codePushify` on your root component and assign the result to itself after the component declaration:
421+
*NOTE: Decorators are not yet supported in Babel 6.x pending proposal update.* You may need to enable it by doing the following:
422+
- Install the [`babel-preset-react-native-stage-0` package](https://github.com/skevy/babel-preset-react-native-stage-0)
437423

438-
```javascript
439-
import codePush, { codePushify } from "react-native-code-push";
440-
441-
let codePushOptions;
424+
```
425+
npm install babel-preset-react-native-stage-0 --save-dev
426+
```
442427
443-
class MyApp extends Component {
428+
- In your `.babelrc` file, include the following:
429+
430+
```
431+
{
432+
"presets": ["react-native-stage-0/decorator-support"]
444433
}
445-
446-
MyApp = codePushify(codePushOptions)(MyApp);
447434
```
448435
449-
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;
450442
451-
```javascript
452-
import codePush from "react-native-code-push";
443+
class MyApp extends Component {
444+
}
453445
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+
import codePush from "react-native-code-push";
453+
454+
class MyApp extends Component {
455+
componentDidMount() {
456+
let syncOptions;
457+
458+
codePush.sync(syncOptions);
460459
}
461-
```
460+
}
461+
```
462462

463463
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.
464464

0 commit comments

Comments
 (0)