Skip to content

Commit d03a29c

Browse files
hoxyqfacebook-github-bot
authored andcommitted
refactor(react-native-github): move ImagePickerIOS to internal (facebook#35199)
Summary: Pull Request resolved: facebook#35199 **Changelog:** [iOS][Removed] - Removed ImagePickerIOS module native sources [JS][Removed] - Removed ImagePickerIOS module from react-native Reviewed By: cortinico Differential Revision: D40859520 fbshipit-source-id: a6a114a05574d46ea62600999bff95025ba7cdc8
1 parent fc9954a commit d03a29c

File tree

10 files changed

+16
-386
lines changed

10 files changed

+16
-386
lines changed

Libraries/Image/ImagePickerIOS.d.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

Libraries/Image/ImagePickerIOS.js

Lines changed: 0 additions & 103 deletions
This file was deleted.

Libraries/Image/NativeImagePickerIOS.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

index.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import typeof Dimensions from './Libraries/Utilities/Dimensions';
5959
import typeof Easing from './Libraries/Animated/Easing';
6060
import typeof ReactNative from './Libraries/Renderer/shims/ReactNative';
6161
import typeof I18nManager from './Libraries/ReactNative/I18nManager';
62-
import typeof ImagePickerIOS from './Libraries/Image/ImagePickerIOS';
6362
import typeof InteractionManager from './Libraries/Interaction/InteractionManager';
6463
import typeof Keyboard from './Libraries/Components/Keyboard/Keyboard';
6564
import typeof LayoutAnimation from './Libraries/LayoutAnimation/LayoutAnimation';
@@ -281,16 +280,6 @@ module.exports = {
281280
get I18nManager(): I18nManager {
282281
return require('./Libraries/ReactNative/I18nManager');
283282
},
284-
get ImagePickerIOS(): ImagePickerIOS {
285-
warnOnce(
286-
'imagePickerIOS-moved',
287-
'ImagePickerIOS has been extracted from react-native core and will be removed in a future release. ' +
288-
"Please upgrade to use either '@react-native-community/react-native-image-picker' or 'expo-image-picker'. " +
289-
"If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " +
290-
'See https://github.com/rnc-archive/react-native-image-picker-ios',
291-
);
292-
return require('./Libraries/Image/ImagePickerIOS');
293-
},
294283
get InteractionManager(): InteractionManager {
295284
return require('./Libraries/Interaction/InteractionManager');
296285
},
@@ -765,4 +754,20 @@ if (__DEV__) {
765754
);
766755
},
767756
});
757+
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
758+
* attempting to access ImagePickerIOS. */
759+
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
760+
* attempting to access ImagePickerIOS. */
761+
Object.defineProperty(module.exports, 'ImagePickerIOS', {
762+
configurable: true,
763+
get() {
764+
invariant(
765+
false,
766+
'ImagePickerIOS has been removed from React Native. ' +
767+
"Please upgrade to use either '@react-native-community/react-native-image-picker' or 'expo-image-picker'. " +
768+
"If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " +
769+
'See https://github.com/rnc-archive/react-native-image-picker-ios',
770+
);
771+
},
772+
});
768773
}

packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,73 +1224,6 @@ const REAL_MODULE_EXAMPLE: SchemaType = {
12241224
},
12251225
moduleNames: ['CameraRollManager'],
12261226
},
1227-
NativeImagePickerIOS: {
1228-
type: 'NativeModule',
1229-
aliases: {},
1230-
spec: {
1231-
properties: [
1232-
{
1233-
name: 'openCameraDialog',
1234-
optional: false,
1235-
typeAnnotation: {
1236-
type: 'FunctionTypeAnnotation',
1237-
returnTypeAnnotation: {
1238-
type: 'VoidTypeAnnotation',
1239-
},
1240-
params: [
1241-
{
1242-
optional: false,
1243-
name: 'config',
1244-
typeAnnotation: {
1245-
type: 'ObjectTypeAnnotation',
1246-
properties: [
1247-
{
1248-
optional: false,
1249-
name: 'unmirrorFrontFacingCamera',
1250-
typeAnnotation: {
1251-
type: 'BooleanTypeAnnotation',
1252-
},
1253-
},
1254-
{
1255-
optional: false,
1256-
name: 'videoMode',
1257-
typeAnnotation: {
1258-
type: 'BooleanTypeAnnotation',
1259-
},
1260-
},
1261-
],
1262-
},
1263-
},
1264-
{
1265-
name: 'successCallback',
1266-
optional: false,
1267-
typeAnnotation: {
1268-
type: 'FunctionTypeAnnotation',
1269-
params: [],
1270-
returnTypeAnnotation: {
1271-
type: 'VoidTypeAnnotation',
1272-
},
1273-
},
1274-
},
1275-
{
1276-
name: 'cancelCallback',
1277-
optional: false,
1278-
typeAnnotation: {
1279-
type: 'FunctionTypeAnnotation',
1280-
params: [],
1281-
returnTypeAnnotation: {
1282-
type: 'VoidTypeAnnotation',
1283-
},
1284-
},
1285-
},
1286-
],
1287-
},
1288-
},
1289-
],
1290-
},
1291-
moduleNames: ['ImagePickerIOS'],
1292-
excludedPlatforms: ['android'],
1293-
},
12941227
NativeExceptionsManager: {
12951228
type: 'NativeModule',
12961229
aliases: {

packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleCpp-test.js.snap

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,6 @@ NativeCameraRollManagerCxxSpecJSI::NativeCameraRollManagerCxxSpecJSI(std::shared
240240
methodMap_[\\"saveToCameraRoll\\"] = MethodMetadata {2, __hostFunction_NativeCameraRollManagerCxxSpecJSI_saveToCameraRoll};
241241
methodMap_[\\"deletePhotos\\"] = MethodMetadata {1, __hostFunction_NativeCameraRollManagerCxxSpecJSI_deletePhotos};
242242
}
243-
static jsi::Value __hostFunction_NativeImagePickerIOSCxxSpecJSI_openCameraDialog(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
244-
static_cast<NativeImagePickerIOSCxxSpecJSI *>(&turboModule)->openCameraDialog(rt, args[0].asObject(rt), args[1].asObject(rt).asFunction(rt), args[2].asObject(rt).asFunction(rt));
245-
return jsi::Value::undefined();
246-
}
247-
248-
NativeImagePickerIOSCxxSpecJSI::NativeImagePickerIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
249-
: TurboModule(\\"ImagePickerIOS\\", jsInvoker) {
250-
methodMap_[\\"openCameraDialog\\"] = MethodMetadata {3, __hostFunction_NativeImagePickerIOSCxxSpecJSI_openCameraDialog};
251-
}
252243
static jsi::Value __hostFunction_NativeExceptionsManagerCxxSpecJSI_reportFatalException(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
253244
static_cast<NativeExceptionsManagerCxxSpecJSI *>(&turboModule)->reportFatalException(rt, args[0].asString(rt), args[1].asObject(rt).asArray(rt), args[2].asNumber());
254245
return jsi::Value::undefined();

packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -505,49 +505,6 @@ private:
505505
Delegate delegate_;
506506
};
507507
508-
class JSI_EXPORT NativeImagePickerIOSCxxSpecJSI : public TurboModule {
509-
protected:
510-
NativeImagePickerIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
511-
512-
public:
513-
virtual void openCameraDialog(jsi::Runtime &rt, jsi::Object config, jsi::Function successCallback, jsi::Function cancelCallback) = 0;
514-
515-
};
516-
517-
template <typename T>
518-
class JSI_EXPORT NativeImagePickerIOSCxxSpec : public TurboModule {
519-
public:
520-
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
521-
return delegate_.get(rt, propName);
522-
}
523-
524-
protected:
525-
NativeImagePickerIOSCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
526-
: TurboModule(\\"ImagePickerIOS\\", jsInvoker),
527-
delegate_(static_cast<T*>(this), jsInvoker) {}
528-
529-
private:
530-
class Delegate : public NativeImagePickerIOSCxxSpecJSI {
531-
public:
532-
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
533-
NativeImagePickerIOSCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
534-
535-
void openCameraDialog(jsi::Runtime &rt, jsi::Object config, jsi::Function successCallback, jsi::Function cancelCallback) override {
536-
static_assert(
537-
bridging::getParameterCount(&T::openCameraDialog) == 4,
538-
\\"Expected openCameraDialog(...) to have 4 parameters\\");
539-
540-
return bridging::callFromJs<void>(
541-
rt, &T::openCameraDialog, jsInvoker_, instance_, std::move(config), std::move(successCallback), std::move(cancelCallback));
542-
}
543-
544-
private:
545-
T *instance_;
546-
};
547-
548-
Delegate delegate_;
549-
};
550-
551508
class JSI_EXPORT NativeExceptionsManagerCxxSpecJSI : public TurboModule {
552509
protected:
553510
NativeExceptionsManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);

0 commit comments

Comments
 (0)