Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1efb5ba

Browse files
committed
Stop passing getApplicationContext() in to the constructor. It's not necessary, and can be derived from the ReactApplicationContext object.
1 parent 7fc4471 commit 1efb5ba

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public class MainApplication extends Application implements ReactApplication {
144144
protected List<ReactPackage> getPackages() {
145145
return Arrays.<ReactPackage>asList(
146146
new MainReactPackage(),
147-
new FirestackPackage(getApplicationContext())
147+
new FirestackPackage()
148148
);
149149
}
150150
};

android/src/main/java/io/fullstack/firestack/FirestackPackage.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
public class FirestackPackage implements ReactPackage {
1616
private Context mContext;
1717

18-
public FirestackPackage(Context ctx) {
19-
mContext = ctx;
18+
public FirestackPackage() {
2019
}
2120
/**
2221
* @param reactContext react application context that can be used to create modules
@@ -26,7 +25,7 @@ public FirestackPackage(Context ctx) {
2625
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
2726
List<NativeModule> modules = new ArrayList<>();
2827

29-
modules.add(new FirestackModule(reactContext, mContext));
28+
modules.add(new FirestackModule(reactContext, reactContext.getBaseContext()));
3029
modules.add(new FirestackAuthModule(reactContext));
3130
modules.add(new FirestackDatabaseModule(reactContext));
3231
modules.add(new FirestackAnalyticsModule(reactContext));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"project": "ios/Firestack.xcodeproj"
4848
},
4949
"android": {
50-
"packageInstance": "new FirestackPackage(getApplicationContext())"
50+
"packageInstance": "new FirestackPackage()"
5151
}
5252
},
5353
"devDependencies": {

0 commit comments

Comments
 (0)