Skip to content

Commit a4b4cc6

Browse files
committed
Package include update on main activity
1 parent 211fe17 commit a4b4cc6

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

README.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,24 @@ If you are a developer, you can use Realtime Cloud Storage to create database ta
3737
compile project(':react-native-realtime-storage-android')
3838
}
3939

40-
* Add `.addPackage(new CustomReactPackage())` to the `onCreate` method of `MainActivity`.
40+
41+
* Add `new CustomReactPackage()` to the `getPackages()` method return list in `MainActivity`.
4142

4243
import co.realtime.reactnativestorageandroid.CustomReactPackage; //<-- import
4344

44-
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
45-
45+
public class MainActivity extends ReactActivity {
46+
4647
...
47-
48+
4849
@Override
49-
protected void onCreate(Bundle savedInstanceState) {
50-
super.onCreate(savedInstanceState);
51-
mReactRootView = new ReactRootView(this);
52-
53-
mReactInstanceManager = ReactInstanceManager.builder()
54-
.setApplication(getApplication())
55-
.setBundleAssetName("index.android.bundle")
56-
.setJSMainModuleName("index.android")
57-
.addPackage(new MainReactPackage())
58-
.addPackage(new CustomReactPackage()) //<-- Add here
59-
.setUseDeveloperSupport(BuildConfig.DEBUG)
60-
.setInitialLifecycleState(LifecycleState.RESUMED)
61-
.build();
62-
63-
mReactRootView.startReactApplication(mReactInstanceManager, "YourProject", null);
64-
65-
setContentView(mReactRootView);
50+
protected List<ReactPackage> getPackages() {
51+
return Arrays.<ReactPackage>asList(
52+
new MainReactPackage(),
53+
new CustomReactPackage() // <-- add CustomReactPackage object
54+
);
6655
}
67-
68-
}
69-
56+
57+
...
7058

7159
* Drag `RCTRealtimeStorageAndroid.js` to the root of your project.
7260

0 commit comments

Comments
 (0)