Skip to content

Commit

Permalink
Merge branch 'master' into feat/disable_buttons_action_sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored Oct 1, 2020
2 parents 873d154 + dd35bf5 commit 893cb69
Show file tree
Hide file tree
Showing 144 changed files with 8,809 additions and 4,671 deletions.
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ untyped-import
untyped-type-import

[version]
^0.134.0
^0.135.0
2 changes: 1 addition & 1 deletion .flowconfig.android
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ untyped-import
untyped-type-import

[version]
^0.134.0
^0.135.0
21 changes: 17 additions & 4 deletions Libraries/Components/Picker/AndroidDialogPickerNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow strict-local
* @flow
*/

'use strict';
Expand All @@ -14,6 +14,8 @@ import * as React from 'react';

import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
import requireNativeComponent from '../../ReactNative/requireNativeComponent';
import registerGeneratedViewConfig from '../../Utilities/registerGeneratedViewConfig';
import AndroidDialogPickerViewConfig from './AndroidDialogPickerViewConfig';

import type {
DirectEventHandler,
Expand Down Expand Up @@ -64,6 +66,17 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
supportedCommands: ['setNativeSelectedPosition'],
});

export default (requireNativeComponent<NativeProps>(
'AndroidDialogPicker',
): NativeType);
let AndroidDialogPickerNativeComponent;
if (global.RN$Bridgeless) {
registerGeneratedViewConfig(
'AndroidDialogPicker',
AndroidDialogPickerViewConfig,
);
AndroidDialogPickerNativeComponent = 'AndroidDialogPicker';
} else {
AndroidDialogPickerNativeComponent = requireNativeComponent<NativeProps>(
'AndroidDialogPicker',
);
}

export default ((AndroidDialogPickerNativeComponent: any): NativeType);
30 changes: 30 additions & 0 deletions Libraries/Components/Picker/AndroidDialogPickerViewConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/

'use strict';

import type {GeneratedViewConfig} from '../../Utilities/registerGeneratedViewConfig';

const AndroidDialogPickerViewConfig = {
uiViewClassName: 'AndroidDialogPicker',
bubblingEventTypes: {},
directEventTypes: {},
validAttributes: {
color: {process: require('../../StyleSheet/processColor')},
backgroundColor: {process: require('../../StyleSheet/processColor')},
enabled: true,
items: true,
prompt: true,
selected: true,
onSelect: true,
},
};

module.exports = (AndroidDialogPickerViewConfig: GeneratedViewConfig);
Original file line number Diff line number Diff line change
Expand Up @@ -1610,46 +1610,72 @@ + (RCTManagedPointer *)JS_NativeImagePickerIOS_SpecOpenSelectDialogConfig:(id)js

} // namespace react
} // namespace facebook
@implementation RCTCxxConvert (NativeImageStore_SpecAddImageFromBase64ErrorCallbackError)
+ (RCTManagedPointer *)JS_NativeImageStore_SpecAddImageFromBase64ErrorCallbackError:(id)json
namespace facebook {
namespace react {


static facebook::jsi::Value __hostFunction_NativeImageStoreAndroidSpecJSI_getBase64ForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "getBase64ForTag", @selector(getBase64ForTag:successCallback:errorCallback:), args, count);
}


NativeImageStoreAndroidSpecJSI::NativeImageStoreAndroidSpecJSI(const ObjCTurboModule::InitParams &params)
: ObjCTurboModule(params) {

methodMap_["getBase64ForTag"] = MethodMetadata {3, __hostFunction_NativeImageStoreAndroidSpecJSI_getBase64ForTag};



}

} // namespace react
} // namespace facebook
@implementation RCTCxxConvert (NativeImageStoreIOS_SpecGetBase64ForTagErrorCallbackError)
+ (RCTManagedPointer *)JS_NativeImageStoreIOS_SpecGetBase64ForTagErrorCallbackError:(id)json
{
return facebook::react::managedPointer<JS::NativeImageStoreIOS::SpecGetBase64ForTagErrorCallbackError>(json);
}
@end
@implementation RCTCxxConvert (NativeImageStoreIOS_SpecAddImageFromBase64ErrorCallbackError)
+ (RCTManagedPointer *)JS_NativeImageStoreIOS_SpecAddImageFromBase64ErrorCallbackError:(id)json
{
return facebook::react::managedPointer<JS::NativeImageStore::SpecAddImageFromBase64ErrorCallbackError>(json);
return facebook::react::managedPointer<JS::NativeImageStoreIOS::SpecAddImageFromBase64ErrorCallbackError>(json);
}
@end
namespace facebook {
namespace react {


static facebook::jsi::Value __hostFunction_NativeImageStoreSpecJSI_getBase64ForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
static facebook::jsi::Value __hostFunction_NativeImageStoreIOSSpecJSI_getBase64ForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "getBase64ForTag", @selector(getBase64ForTag:successCallback:errorCallback:), args, count);
}

static facebook::jsi::Value __hostFunction_NativeImageStoreSpecJSI_hasImageForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
static facebook::jsi::Value __hostFunction_NativeImageStoreIOSSpecJSI_hasImageForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "hasImageForTag", @selector(hasImageForTag:callback:), args, count);
}

static facebook::jsi::Value __hostFunction_NativeImageStoreSpecJSI_removeImageForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
static facebook::jsi::Value __hostFunction_NativeImageStoreIOSSpecJSI_removeImageForTag(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "removeImageForTag", @selector(removeImageForTag:), args, count);
}

static facebook::jsi::Value __hostFunction_NativeImageStoreSpecJSI_addImageFromBase64(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
static facebook::jsi::Value __hostFunction_NativeImageStoreIOSSpecJSI_addImageFromBase64(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, VoidKind, "addImageFromBase64", @selector(addImageFromBase64:successCallback:errorCallback:), args, count);
}


NativeImageStoreSpecJSI::NativeImageStoreSpecJSI(const ObjCTurboModule::InitParams &params)
NativeImageStoreIOSSpecJSI::NativeImageStoreIOSSpecJSI(const ObjCTurboModule::InitParams &params)
: ObjCTurboModule(params) {

methodMap_["getBase64ForTag"] = MethodMetadata {3, __hostFunction_NativeImageStoreSpecJSI_getBase64ForTag};
methodMap_["getBase64ForTag"] = MethodMetadata {3, __hostFunction_NativeImageStoreIOSSpecJSI_getBase64ForTag};


methodMap_["hasImageForTag"] = MethodMetadata {2, __hostFunction_NativeImageStoreSpecJSI_hasImageForTag};
methodMap_["hasImageForTag"] = MethodMetadata {2, __hostFunction_NativeImageStoreIOSSpecJSI_hasImageForTag};


methodMap_["removeImageForTag"] = MethodMetadata {1, __hostFunction_NativeImageStoreSpecJSI_removeImageForTag};
methodMap_["removeImageForTag"] = MethodMetadata {1, __hostFunction_NativeImageStoreIOSSpecJSI_removeImageForTag};


methodMap_["addImageFromBase64"] = MethodMetadata {3, __hostFunction_NativeImageStoreSpecJSI_addImageFromBase64};
methodMap_["addImageFromBase64"] = MethodMetadata {3, __hostFunction_NativeImageStoreIOSSpecJSI_addImageFromBase64};



Expand Down
57 changes: 49 additions & 8 deletions Libraries/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -1525,9 +1525,45 @@ namespace facebook {
};
} // namespace react
} // namespace facebook
@protocol NativeImageStoreAndroidSpec <RCTBridgeModule, RCTTurboModule>

- (void)getBase64ForTag:(NSString *)uri
successCallback:(RCTResponseSenderBlock)successCallback
errorCallback:(RCTResponseSenderBlock)errorCallback;

@end
namespace facebook {
namespace react {
/**
* ObjC++ class for module 'ImageStoreAndroid'
*/

class JSI_EXPORT NativeImageStoreAndroidSpecJSI : public ObjCTurboModule {
public:
NativeImageStoreAndroidSpecJSI(const ObjCTurboModule::InitParams &params);

};
} // namespace react
} // namespace facebook

namespace JS {
namespace NativeImageStore {
namespace NativeImageStoreIOS {
struct SpecGetBase64ForTagErrorCallbackError {
NSString *message() const;

SpecGetBase64ForTagErrorCallbackError(NSDictionary *const v) : _v(v) {}
private:
NSDictionary *_v;
};
}
}

@interface RCTCxxConvert (NativeImageStoreIOS_SpecGetBase64ForTagErrorCallbackError)
+ (RCTManagedPointer *)JS_NativeImageStoreIOS_SpecGetBase64ForTagErrorCallbackError:(id)json;
@end

namespace JS {
namespace NativeImageStoreIOS {
struct SpecAddImageFromBase64ErrorCallbackError {
NSString *message() const;

Expand All @@ -1538,10 +1574,10 @@ namespace JS {
}
}

@interface RCTCxxConvert (NativeImageStore_SpecAddImageFromBase64ErrorCallbackError)
+ (RCTManagedPointer *)JS_NativeImageStore_SpecAddImageFromBase64ErrorCallbackError:(id)json;
@interface RCTCxxConvert (NativeImageStoreIOS_SpecAddImageFromBase64ErrorCallbackError)
+ (RCTManagedPointer *)JS_NativeImageStoreIOS_SpecAddImageFromBase64ErrorCallbackError:(id)json;
@end
@protocol NativeImageStoreSpec <RCTBridgeModule, RCTTurboModule>
@protocol NativeImageStoreIOSSpec <RCTBridgeModule, RCTTurboModule>

- (void)getBase64ForTag:(NSString *)uri
successCallback:(RCTResponseSenderBlock)successCallback
Expand All @@ -1557,12 +1593,12 @@ namespace JS {
namespace facebook {
namespace react {
/**
* ObjC++ class for module 'ImageStore'
* ObjC++ class for module 'ImageStoreIOS'
*/

class JSI_EXPORT NativeImageStoreSpecJSI : public ObjCTurboModule {
class JSI_EXPORT NativeImageStoreIOSSpecJSI : public ObjCTurboModule {
public:
NativeImageStoreSpecJSI(const ObjCTurboModule::InitParams &params);
NativeImageStoreIOSSpecJSI(const ObjCTurboModule::InitParams &params);

};
} // namespace react
Expand Down Expand Up @@ -3298,7 +3334,12 @@ inline bool JS::NativeImagePickerIOS::SpecOpenSelectDialogConfig::showVideos() c
id const p = _v[@"showVideos"];
return RCTBridgingToBool(p);
}
inline NSString *JS::NativeImageStore::SpecAddImageFromBase64ErrorCallbackError::message() const
inline NSString *JS::NativeImageStoreIOS::SpecGetBase64ForTagErrorCallbackError::message() const
{
id const p = _v[@"message"];
return RCTBridgingToString(p);
}
inline NSString *JS::NativeImageStoreIOS::SpecAddImageFromBase64ErrorCallbackError::message() const
{
id const p = _v[@"message"];
return RCTBridgingToString(p);
Expand Down
27 changes: 27 additions & 0 deletions Libraries/Image/NativeImageStoreAndroid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict
* @format
*/

'use strict';

import type {TurboModule} from '../TurboModule/RCTExport';
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
+getConstants: () => {||};
+getBase64ForTag: (
uri: string,
successCallback: (base64ImageData: string) => void,
errorCallback: (error: string) => void,
) => void;
}

export default (TurboModuleRegistry.getEnforcing<Spec>(
'ImageStoreManager',
): Spec);
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,11 @@ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
+getConstants: () => {||};
// Common
+getBase64ForTag: (
uri: string,
successCallback: (base64ImageData: string) => void,

/**
* On Android, the failure callback is called with a string.
* On iOS, the failure callback is called with an error object.
*
* TODO(T47527939) Unify this inconsistency
*/
errorCallback: (error: {|message: string|} | string) => void,
errorCallback: (error: {|message: string|}) => void,
) => void;

// iOS-only
+hasImageForTag: (uri: string, callback: (hasImage: boolean) => void) => void;
+removeImageForTag: (uri: string) => void;
+addImageFromBase64: (
Expand Down
13 changes: 0 additions & 13 deletions Libraries/Image/RCTImageLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -831,19 +831,6 @@ - (NSString *)loaderModuleNameForRequestUrl:(NSURL *)url {
return nil;
}

- (void)trackURLImageContentDidSetForRequest:(RCTImageURLLoaderRequest *)loaderRequest
{
if (!loaderRequest) {
return;
}

// This delegate method is Fabric-only
id<RCTImageURLLoader> loadHandler = [self imageURLLoaderForURL:loaderRequest.imageURL];
if ([loadHandler respondsToSelector:@selector(trackURLImageContentDidSetForRequest:)]) {
[(id<RCTImageURLLoaderWithAttribution>)loadHandler trackURLImageContentDidSetForRequest:loaderRequest];
}
}

- (void)trackURLImageVisibilityForRequest:(RCTImageURLLoaderRequest *)loaderRequest imageView:(UIView *)imageView
{
if (!loaderRequest || !imageView) {
Expand Down
5 changes: 0 additions & 5 deletions Libraries/Image/RCTImageLoaderWithAttributionProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ RCT_EXTERN void RCTEnableImageLoadingPerfInstrumentation(BOOL enabled);
completionBlock:(RCTImageLoaderCompletionBlockWithMetadata)completionBlock;
#endif

/**
* Image instrumentation - notify that the image content (UIImage) has been set on the native view.
*/
- (void)trackURLImageContentDidSetForRequest:(RCTImageURLLoaderRequest *)loaderRequest;

/**
* Image instrumentation - start tracking the on-screen visibility of the native image view.
*/
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Image/RCTImageStoreManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

static NSString *const RCTImageStoreURLScheme = @"rct-image-store";

@interface RCTImageStoreManager() <NativeImageStoreSpec>
@interface RCTImageStoreManager() <NativeImageStoreIOSSpec>
@end

@implementation RCTImageStoreManager
Expand Down Expand Up @@ -236,7 +236,7 @@ - (void)getImageForTag:(NSString *)imageTag withBlock:(void (^)(UIImage *image))

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params
{
return std::make_shared<facebook::react::NativeImageStoreSpecJSI>(params);
return std::make_shared<facebook::react::NativeImageStoreIOSSpecJSI>(params);
}

@end
Expand Down
5 changes: 0 additions & 5 deletions Libraries/Image/RCTImageURLLoaderWithAttribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ struct ImageURLLoaderAttribution {
completionHandler:(RCTImageLoaderCompletionBlockWithMetadata)completionHandler;
#endif

/**
* Image instrumentation - notify that the image content (UIImage) has been set on the native view.
*/
- (void)trackURLImageContentDidSetForRequest:(RCTImageURLLoaderRequest *)loaderRequest;

/**
* Image instrumentation - start tracking the on-screen visibility of the native image view.
*/
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Interaction/PanResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY;
* ### Working Example
*
* To see it in action, try the
* [PanResponder example in RNTester](https://github.com/facebook/react-native/blob/master/RNTester/js/PanResponderExample.js)
* [PanResponder example in RNTester](https://github.com/facebook/react-native/blob/master/packages/rn-tester/js/examples/PanResponder/PanResponderExample.js)
*/

export type GestureState = {|
Expand Down
12 changes: 7 additions & 5 deletions Libraries/Text/TextInput/RCTBaseTextInputView.m
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,13 @@ - (BOOL)textInputShouldReturn
// `onSubmitEditing` is called when "Submit" button
// (the blue key on onscreen keyboard) did pressed
// (no connection to any specific "submitting" process).
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit
reactTag:self.reactTag
text:[self.backedTextInputView.attributedText.string copy]
key:nil
eventCount:_nativeEventCount];
if (_blurOnSubmit) {
[_eventDispatcher sendTextEventWithType:RCTTextEventTypeSubmit
reactTag:self.reactTag
text:[self.backedTextInputView.attributedText.string copy]
key:nil
eventCount:_nativeEventCount];
}

return _blurOnSubmit;
}
Expand Down
Loading

0 comments on commit 893cb69

Please sign in to comment.