Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm authored Nov 15, 2016
1 parent c563199 commit 56d8dde
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,34 @@ dependencies {
}
```

- Add following lines into `MainActivity.java`
- Add following lines into `MainApplication.java`

```java
...
import cn.reactnative.httpcache.HttpCachePackage;
// Add this line before public class MainActivity
// Add this line before public class MainApplication

public class MainActivity extends Activity {
public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected void onCreate(Bundle savedInstanceState) {
...
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(new MainReactPackage())
.addPackage(new HttpCachePackage()) // Add this line
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new HttpCachePackage(), // Add this line
new MainReactPackage()
);
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
```

Expand Down

0 comments on commit 56d8dde

Please sign in to comment.