Skip to content

Commit 6ecf61a

Browse files
committed
fix(android): remove deprecated activity getters
1 parent 9c041cd commit 6ecf61a

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

.github/workflows/ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install dependencies
3232
run: yarn install --immutable
3333
- name: Install pods
34-
run: RCT_NEW_ARCH_ENABLED=0 npx pod-install
34+
run: RCT_NEW_ARCH_ENABLED=0 RCT_USE_PREBUILT_RNCORE=1 RCT_USE_RN_DEP=1 npx pod-install
3535
working-directory: example/ios
3636
- name: Build ios example app on old architecture
3737
run: xcodebuild -scheme ReactTestApp -workspace document-picker-example.xcworkspace ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator -configuration Debug

packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,8 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
8383

8484
@ReactMethod
8585
override fun pick(opts: ReadableMap, promise: Promise) {
86-
val currentActivity = currentActivity
86+
val currentActivity = reactApplicationContext.currentActivity ?: return rejectWithNullActivity(promise)
8787

88-
if (currentActivity == null) {
89-
rejectWithNullActivity(promise)
90-
return
91-
}
9288
if (!promiseWrapper.trySetPromiseRejectingIncoming(promise, "pick")) {
9389
return
9490
}
@@ -145,11 +141,8 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
145141

146142
@ReactMethod
147143
override fun pickDirectory(opts: ReadableMap, promise: Promise) {
148-
val currentActivity = currentActivity
149-
if (currentActivity == null) {
150-
rejectWithNullActivity(promise)
151-
return
152-
}
144+
val currentActivity = reactApplicationContext.currentActivity ?: return rejectWithNullActivity(promise)
145+
153146
if (!promiseWrapper.trySetPromiseRejectingIncoming(promise, "pickDirectory")) {
154147
return
155148
}

0 commit comments

Comments
 (0)