@tbvjaos510/react-native-paste-input 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +130 -0
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/android/.project +17 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/build.gradle +94 -0
- package/android/generated/java/com/facebook/react/viewmanagers/PasteTextInputManagerDelegate.java +236 -0
- package/android/generated/java/com/facebook/react/viewmanagers/PasteTextInputManagerInterface.java +84 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/PasteTextInputSpecs-generated.cpp +27 -0
- package/android/generated/jni/PasteTextInputSpecs.h +28 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ComponentDescriptors.h +166 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/EventEmitters.cpp +183 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/EventEmitters.h +148 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/PasteTextInputSpecsJSI-generated.cpp +17 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/PasteTextInputSpecsJSI.h +19 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/Props.cpp +640 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/Props.h +144 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ShadowNodes.cpp +247 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/ShadowNodes.h +95 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/States.cpp +14 -0
- package/android/generated/jni/react/renderer/components/PasteTextInputSpecs/States.h +19 -0
- package/android/gradle.properties +6 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/IPasteInputListener.kt +8 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputActionCallback.kt +72 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputEditText.kt +60 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputFileFromUrl.kt +50 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteInputListener.kt +84 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputManager.kt +72 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputPackage.kt +14 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/PasteTextInputPasteEvent.java +41 -0
- package/android/src/main/java/com/mattermost/pasteinputtext/RealPathUtil.kt +174 -0
- package/ios/NSData+MimeType.h +20 -0
- package/ios/NSData+MimeType.m +59 -0
- package/ios/PasteInput-Bridging-Header.h +1 -0
- package/ios/PasteInput.xcodeproj/project.pbxproj +319 -0
- package/ios/PasteInputTextView.h +20 -0
- package/ios/PasteInputTextView.m +68 -0
- package/ios/PasteInputView.h +18 -0
- package/ios/PasteInputView.m +96 -0
- package/ios/PasteTextInput.h +13 -0
- package/ios/PasteTextInput.mm +726 -0
- package/ios/PasteTextInputManager.mm +171 -0
- package/ios/Swime/MimeType.h +70 -0
- package/ios/Swime/MimeType.m +701 -0
- package/ios/Swime/Swime.h +14 -0
- package/ios/Swime/Swime.m +28 -0
- package/ios/Swime/SwimeProxy.h +18 -0
- package/ios/Swime/SwimeProxy.m +66 -0
- package/ios/Swime/SwimeUtils.h +12 -0
- package/ios/Swime/SwimeUtils.m +23 -0
- package/ios/UIImage+ImageEffects.h +112 -0
- package/ios/UIImage+ImageEffects.m +310 -0
- package/ios/UIImage+vImageScaling.h +16 -0
- package/ios/UIImage+vImageScaling.m +48 -0
- package/ios/UIPasteboard+GetImageInfo.h +19 -0
- package/ios/UIPasteboard+GetImageInfo.m +98 -0
- package/ios/generated/PasteTextInputSpecs/ComponentDescriptors.cpp +22 -0
- package/ios/generated/PasteTextInputSpecs/ComponentDescriptors.h +42 -0
- package/ios/generated/PasteTextInputSpecs/EventEmitters.cpp +41 -0
- package/ios/generated/PasteTextInputSpecs/EventEmitters.h +37 -0
- package/ios/generated/PasteTextInputSpecs/PasteTextInputSpecs-generated.mm +16 -0
- package/ios/generated/PasteTextInputSpecs/PasteTextInputSpecs.h +38 -0
- package/ios/generated/PasteTextInputSpecs/Props.cpp +142 -0
- package/ios/generated/PasteTextInputSpecs/Props.h +81 -0
- package/ios/generated/PasteTextInputSpecs/RCTComponentViewHelpers.h +106 -0
- package/ios/generated/PasteTextInputSpecs/ShadowNodes.cpp +127 -0
- package/ios/generated/PasteTextInputSpecs/ShadowNodes.h +85 -0
- package/ios/generated/PasteTextInputSpecs/States.cpp +16 -0
- package/ios/generated/PasteTextInputSpecs/States.h +53 -0
- package/ios/generated/PasteTextInputSpecsJSI-generated.cpp +17 -0
- package/ios/generated/PasteTextInputSpecsJSI.h +19 -0
- package/lib/commonjs/PasteTextInput.js +446 -0
- package/lib/commonjs/PasteTextInput.js.map +1 -0
- package/lib/commonjs/PasteTextInputNativeComponent.ts +277 -0
- package/lib/commonjs/index.js +25 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/module.d.js +2 -0
- package/lib/commonjs/module.d.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/PasteTextInput.js +440 -0
- package/lib/module/PasteTextInput.js.map +1 -0
- package/lib/module/PasteTextInputNativeComponent.ts +277 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/module.d.js +2 -0
- package/lib/module/module.d.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/src/PasteTextInput.d.ts +5 -0
- package/lib/typescript/src/PasteTextInput.d.ts.map +1 -0
- package/lib/typescript/src/PasteTextInputNativeComponent.d.ts +168 -0
- package/lib/typescript/src/PasteTextInputNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +56 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +140 -0
- package/react-native-paste-input.podspec +20 -0
- package/react-native.config.js +13 -0
- package/src/PasteTextInput.tsx +615 -0
- package/src/PasteTextInputNativeComponent.ts +277 -0
- package/src/index.ts +13 -0
- package/src/module.d.ts +4 -0
- package/src/types.ts +71 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIPasteboard+GetImageInfo.m
|
|
3
|
+
// Mattermost
|
|
4
|
+
//
|
|
5
|
+
// Created by Tek Min Ewe on 05/08/2019.
|
|
6
|
+
// Copyright © 2019 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "UIPasteboard+GetImageInfo.h"
|
|
10
|
+
#import "NSData+MimeType.h"
|
|
11
|
+
#import "UIImage+vImageScaling.h"
|
|
12
|
+
#import "Swime/SwimeProxy.h"
|
|
13
|
+
|
|
14
|
+
@implementation UIPasteboard (GetImageInfo)
|
|
15
|
+
|
|
16
|
+
-(NSArray<NSDictionary *> *)getCopiedFiles {
|
|
17
|
+
NSMutableArray<NSDictionary *> *fileInfos = [[NSMutableArray alloc] init];
|
|
18
|
+
NSArray<NSDictionary<NSString *,id> *> *items = self.items;
|
|
19
|
+
for (int i = 0; i < items.count; i++) {
|
|
20
|
+
NSDictionary *item = items[i];
|
|
21
|
+
BOOL added = NO;
|
|
22
|
+
for (int j = 0; j < item.allKeys.count; j++) {
|
|
23
|
+
if (added) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
NSString *type = item.allKeys[j];
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@try {
|
|
31
|
+
NSString *uri = self.string;
|
|
32
|
+
NSData *fileData = item[type];
|
|
33
|
+
|
|
34
|
+
if ([type isEqual:@"public.jpeg"] || [type isEqual:@"public.png"]) {
|
|
35
|
+
fileData = [self getDataForImageItem:item[type] type:type];
|
|
36
|
+
} else if ([type isEqual:@"com.compuserve.gif"] || [type isEqual:@"public.heic"]) {
|
|
37
|
+
fileData = [self dataForPasteboardType:type];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
SwimeProxy *swimeProxy = [SwimeProxy shared];
|
|
41
|
+
MimeTypeProxy *mimeProxy = [swimeProxy getMimeAndExtension:fileData uti:type];
|
|
42
|
+
NSString *extension;
|
|
43
|
+
NSString *mimeType;
|
|
44
|
+
if (mimeProxy != nil) {
|
|
45
|
+
extension = mimeProxy.ext;
|
|
46
|
+
mimeType = mimeProxy.mime;
|
|
47
|
+
} else {
|
|
48
|
+
extension = [fileData extension];
|
|
49
|
+
mimeType = [fileData mimeType];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if ([extension length] == 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
NSString *tempFilename = [NSString stringWithFormat:@"%@.%@", [[NSProcessInfo processInfo] globallyUniqueString], extension];
|
|
57
|
+
NSURL *tempFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:tempFilename]];
|
|
58
|
+
BOOL success = [fileData writeToURL:tempFileURL atomically:YES];
|
|
59
|
+
if (success) {
|
|
60
|
+
added = YES;
|
|
61
|
+
uri = tempFileURL.absoluteString;
|
|
62
|
+
[fileInfos addObject:@{
|
|
63
|
+
@"fileName": tempFilename,
|
|
64
|
+
@"fileSize": @([fileData length]),
|
|
65
|
+
@"type": mimeType,
|
|
66
|
+
@"uri": uri,
|
|
67
|
+
}];
|
|
68
|
+
}
|
|
69
|
+
} @catch (NSException *exception) {
|
|
70
|
+
[fileInfos addObject:@{
|
|
71
|
+
@"type": type,
|
|
72
|
+
@"error": exception.reason,
|
|
73
|
+
}];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
return fileInfos;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
-(NSData *) getDataForImageItem:(NSData *)imageData type:(NSString *)type {
|
|
83
|
+
UIImage *image;
|
|
84
|
+
image = (UIImage *)imageData;
|
|
85
|
+
size_t width = CGImageGetWidth(image.CGImage);
|
|
86
|
+
size_t height = CGImageGetHeight(image.CGImage);
|
|
87
|
+
if (width > 6048 || height > 4032) {
|
|
88
|
+
image = [image vImageScaledImageWithSize:CGSizeMake(2048, 2048) contentMode:UIViewContentModeScaleAspectFit];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if ([type isEqual:@"public.png"]) {
|
|
92
|
+
return UIImagePNGRepresentation(image);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return UIImageJPEGRepresentation(image, 1.0);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ComponentDescriptors.h"
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
//namespace facebook::react {
|
|
16
|
+
//
|
|
17
|
+
//void PasteTextInputSpecs_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
// std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
//registry->add(concreteComponentDescriptorProvider<PasteTextInputComponentDescriptor>());
|
|
20
|
+
//}
|
|
21
|
+
//
|
|
22
|
+
//} // namespace facebook::react
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ShadowNodes.h"
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
|
|
16
|
+
namespace facebook::react {
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* Descriptor for <PasteTextInput> component.
|
|
20
|
+
*/
|
|
21
|
+
class PasteTextInputComponentDescriptor final
|
|
22
|
+
: public ConcreteComponentDescriptor<PasteTextInputShadowNode> {
|
|
23
|
+
public:
|
|
24
|
+
PasteTextInputComponentDescriptor(const ComponentDescriptorParameters& parameters)
|
|
25
|
+
: ConcreteComponentDescriptor<PasteTextInputShadowNode>(parameters) {
|
|
26
|
+
textLayoutManager_ =
|
|
27
|
+
std::make_shared<const TextLayoutManager>(contextContainer_);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
protected:
|
|
31
|
+
void adopt(ShadowNode& shadowNode) const override {
|
|
32
|
+
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
33
|
+
|
|
34
|
+
auto& concreteShadowNode = static_cast<PasteTextInputShadowNode&>(shadowNode);
|
|
35
|
+
concreteShadowNode.setTextLayoutManager(textLayoutManager_);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private:
|
|
39
|
+
std::shared_ptr<const TextLayoutManager> textLayoutManager_;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
void PasteTextInputEventEmitter::onPaste(OnPaste $event) const {
|
|
17
|
+
dispatchEvent("paste", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
|
+
auto $payload = jsi::Object(runtime);
|
|
19
|
+
|
|
20
|
+
auto data = jsi::Array(runtime, $event.data.size());
|
|
21
|
+
size_t dataIndex = 0;
|
|
22
|
+
for (auto dataValue : $event.data) {
|
|
23
|
+
auto dataObject = jsi::Object(runtime);
|
|
24
|
+
dataObject.setProperty(runtime, "fileName", dataValue.fileName);
|
|
25
|
+
dataObject.setProperty(runtime, "fileSize", dataValue.fileSize);
|
|
26
|
+
dataObject.setProperty(runtime, "type", dataValue.type);
|
|
27
|
+
dataObject.setProperty(runtime, "uri", dataValue.uri);
|
|
28
|
+
data.setValueAtIndex(runtime, dataIndex++, dataObject);
|
|
29
|
+
}
|
|
30
|
+
$payload.setProperty(runtime, "data", data);
|
|
31
|
+
|
|
32
|
+
{
|
|
33
|
+
auto error = jsi::Object(runtime);
|
|
34
|
+
error.setProperty(runtime, "message", $event.error.message);
|
|
35
|
+
$payload.setProperty(runtime, "error", error);
|
|
36
|
+
}
|
|
37
|
+
return $payload;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include "TextInputEventEmitter.h"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
class PasteTextInputEventEmitter : public TextInputEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using TextInputEventEmitter::TextInputEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnPasteData {
|
|
21
|
+
std::string fileName;
|
|
22
|
+
int fileSize;
|
|
23
|
+
std::string type;
|
|
24
|
+
std::string uri;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
struct OnPasteError {
|
|
28
|
+
std::string message;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
struct OnPaste {
|
|
32
|
+
std::vector<OnPasteData> data;
|
|
33
|
+
OnPasteError error;
|
|
34
|
+
};
|
|
35
|
+
void onPaste(OnPaste value) const;
|
|
36
|
+
};
|
|
37
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#import "PasteTextInputSpecs.h"
|
|
15
|
+
|
|
16
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Avoid multiple includes of PasteTextInputSpecs symbols
|
|
19
|
+
#ifndef PasteTextInputSpecs_H
|
|
20
|
+
#define PasteTextInputSpecs_H
|
|
21
|
+
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <RCTRequired/RCTRequired.h>
|
|
24
|
+
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
+
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTCxxConvert.h>
|
|
28
|
+
#import <React/RCTManagedPointer.h>
|
|
29
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
+
#import <optional>
|
|
31
|
+
#import <vector>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
NS_ASSUME_NONNULL_END
|
|
38
|
+
#endif // PasteTextInputSpecs_H
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "Props.h"
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
#include <react/renderer/attributedstring/conversions.h>
|
|
16
|
+
#include <react/renderer/components/iostextinput/propsConversions.h>
|
|
17
|
+
#include <react/renderer/core/graphicsConversions.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
PasteTextInputProps::PasteTextInputProps(
|
|
22
|
+
const PropsParserContext &context,
|
|
23
|
+
const PasteTextInputProps &sourceProps,
|
|
24
|
+
const RawProps& rawProps)
|
|
25
|
+
: BaseTextInputProps(context, sourceProps, rawProps),
|
|
26
|
+
traits(convertRawProp(context, rawProps, sourceProps.traits, {})),
|
|
27
|
+
smartPunctuation(convertRawProp(context, rawProps, "smartPunctuation", sourceProps.smartPunctuation, {})),
|
|
28
|
+
disableCopyPaste(convertRawProp(context, rawProps, "disableCopyPaste", sourceProps.disableCopyPaste, {false})),
|
|
29
|
+
paragraphAttributes(convertRawProp(
|
|
30
|
+
context,
|
|
31
|
+
rawProps,
|
|
32
|
+
sourceProps.paragraphAttributes,
|
|
33
|
+
{})),
|
|
34
|
+
defaultValue(convertRawProp(
|
|
35
|
+
context,
|
|
36
|
+
rawProps,
|
|
37
|
+
"defaultValue",
|
|
38
|
+
sourceProps.defaultValue,
|
|
39
|
+
{})),
|
|
40
|
+
placeholder(convertRawProp(
|
|
41
|
+
context,
|
|
42
|
+
rawProps,
|
|
43
|
+
"placeholder",
|
|
44
|
+
sourceProps.placeholder,
|
|
45
|
+
{})),
|
|
46
|
+
placeholderTextColor(convertRawProp(
|
|
47
|
+
context,
|
|
48
|
+
rawProps,
|
|
49
|
+
"placeholderTextColor",
|
|
50
|
+
sourceProps.placeholderTextColor,
|
|
51
|
+
{})),
|
|
52
|
+
maxLength(convertRawProp(
|
|
53
|
+
context,
|
|
54
|
+
rawProps,
|
|
55
|
+
"maxLength",
|
|
56
|
+
sourceProps.maxLength,
|
|
57
|
+
{})),
|
|
58
|
+
cursorColor(convertRawProp(
|
|
59
|
+
context,
|
|
60
|
+
rawProps,
|
|
61
|
+
"cursorColor",
|
|
62
|
+
sourceProps.cursorColor,
|
|
63
|
+
{})),
|
|
64
|
+
selectionColor(convertRawProp(
|
|
65
|
+
context,
|
|
66
|
+
rawProps,
|
|
67
|
+
"selectionColor",
|
|
68
|
+
sourceProps.selectionColor,
|
|
69
|
+
{})),
|
|
70
|
+
selectionHandleColor(convertRawProp(
|
|
71
|
+
context,
|
|
72
|
+
rawProps,
|
|
73
|
+
"selectionHandleColor",
|
|
74
|
+
sourceProps.selectionHandleColor,
|
|
75
|
+
{})),
|
|
76
|
+
underlineColorAndroid(convertRawProp(
|
|
77
|
+
context,
|
|
78
|
+
rawProps,
|
|
79
|
+
"underlineColorAndroid",
|
|
80
|
+
sourceProps.underlineColorAndroid,
|
|
81
|
+
{})),
|
|
82
|
+
text(convertRawProp(context, rawProps, "text", sourceProps.text, {})),
|
|
83
|
+
mostRecentEventCount(convertRawProp(
|
|
84
|
+
context,
|
|
85
|
+
rawProps,
|
|
86
|
+
"mostRecentEventCount",
|
|
87
|
+
sourceProps.mostRecentEventCount,
|
|
88
|
+
{})),
|
|
89
|
+
autoFocus(convertRawProp(
|
|
90
|
+
context,
|
|
91
|
+
rawProps,
|
|
92
|
+
"autoFocus",
|
|
93
|
+
sourceProps.autoFocus,
|
|
94
|
+
{})),
|
|
95
|
+
selection(convertRawProp(
|
|
96
|
+
context,
|
|
97
|
+
rawProps,
|
|
98
|
+
"selection",
|
|
99
|
+
sourceProps.selection,
|
|
100
|
+
std::optional<Selection>())),
|
|
101
|
+
inputAccessoryViewID(convertRawProp(
|
|
102
|
+
context,
|
|
103
|
+
rawProps,
|
|
104
|
+
"inputAccessoryViewID",
|
|
105
|
+
sourceProps.inputAccessoryViewID,
|
|
106
|
+
{})){};
|
|
107
|
+
|
|
108
|
+
void PasteTextInputProps::setProp(
|
|
109
|
+
const PropsParserContext& context,
|
|
110
|
+
RawPropsPropNameHash hash,
|
|
111
|
+
const char* propName,
|
|
112
|
+
const RawValue& value) {
|
|
113
|
+
ViewProps::setProp(context, hash, propName, value);
|
|
114
|
+
BaseTextProps::setProp(context, hash, propName, value);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
TextAttributes PasteTextInputProps::getEffectiveTextAttributes(Float fontSizeMultiplier) const {
|
|
118
|
+
auto result = TextAttributes::defaultTextAttributes();
|
|
119
|
+
result.fontSizeMultiplier = fontSizeMultiplier;
|
|
120
|
+
result.apply(textAttributes);
|
|
121
|
+
|
|
122
|
+
/*
|
|
123
|
+
* These props are applied to `View`, therefore they must not be a part of
|
|
124
|
+
* base text attributes.
|
|
125
|
+
*/
|
|
126
|
+
result.backgroundColor = clearColor();
|
|
127
|
+
result.opacity = 1;
|
|
128
|
+
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
ParagraphAttributes PasteTextInputProps::getEffectiveParagraphAttributes() const {
|
|
133
|
+
auto result = paragraphAttributes;
|
|
134
|
+
|
|
135
|
+
if (!multiline) {
|
|
136
|
+
result.maximumNumberOfLines = 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/attributedstring/ParagraphAttributes.h>
|
|
14
|
+
#include <react/renderer/attributedstring/TextAttributes.h>
|
|
15
|
+
#include <react/renderer/components/iostextinput/conversions.h>
|
|
16
|
+
#include <react/renderer/components/iostextinput/primitives.h>
|
|
17
|
+
#include <react/renderer/components/text/BaseTextProps.h>
|
|
18
|
+
#include <react/renderer/components/textinput/BaseTextInputProps.h>
|
|
19
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
20
|
+
#include <react/renderer/core/Props.h>
|
|
21
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
22
|
+
#include <react/renderer/core/propsConversions.h>
|
|
23
|
+
#include <react/renderer/graphics/Color.h>
|
|
24
|
+
#include <react/renderer/imagemanager/primitives.h>
|
|
25
|
+
#include <vector>
|
|
26
|
+
|
|
27
|
+
namespace facebook::react {
|
|
28
|
+
|
|
29
|
+
class PasteTextInputProps final : public BaseTextInputProps {
|
|
30
|
+
public:
|
|
31
|
+
PasteTextInputProps() = default;
|
|
32
|
+
PasteTextInputProps(const PropsParserContext& context, const PasteTextInputProps& sourceProps, const RawProps& rawProps);
|
|
33
|
+
|
|
34
|
+
void setProp(
|
|
35
|
+
const PropsParserContext& context,
|
|
36
|
+
RawPropsPropNameHash hash,
|
|
37
|
+
const char* propName,
|
|
38
|
+
const RawValue& value);
|
|
39
|
+
|
|
40
|
+
#pragma mark - Props
|
|
41
|
+
const TextInputTraits traits{};
|
|
42
|
+
const ParagraphAttributes paragraphAttributes{};
|
|
43
|
+
|
|
44
|
+
std::string const defaultValue{};
|
|
45
|
+
|
|
46
|
+
std::string const placeholder{};
|
|
47
|
+
const SharedColor placeholderTextColor{};
|
|
48
|
+
|
|
49
|
+
int maxLength{};
|
|
50
|
+
|
|
51
|
+
std::string smartPunctuation{};
|
|
52
|
+
bool disableCopyPaste{false};
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* Tint colors
|
|
56
|
+
*/
|
|
57
|
+
const SharedColor cursorColor{};
|
|
58
|
+
const SharedColor selectionColor{};
|
|
59
|
+
const SharedColor selectionHandleColor{};
|
|
60
|
+
// TODO: Rename to `tintColor` and make universal.
|
|
61
|
+
const SharedColor underlineColorAndroid{};
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* "Private" (only used by TextInput.js) props
|
|
65
|
+
*/
|
|
66
|
+
std::string const text{};
|
|
67
|
+
const int mostRecentEventCount{0};
|
|
68
|
+
|
|
69
|
+
bool autoFocus{false};
|
|
70
|
+
std::optional<Selection> selection{};
|
|
71
|
+
|
|
72
|
+
std::string const inputAccessoryViewID{};
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Accessors
|
|
76
|
+
*/
|
|
77
|
+
TextAttributes getEffectiveTextAttributes(Float fontSizeMultiplier) const;
|
|
78
|
+
ParagraphAttributes getEffectiveParagraphAttributes() const;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateComponentHObjCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import <Foundation/Foundation.h>
|
|
11
|
+
#import <React/RCTDefines.h>
|
|
12
|
+
#import <React/RCTLog.h>
|
|
13
|
+
|
|
14
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
15
|
+
|
|
16
|
+
@protocol RCTPasteTextInputViewProtocol <NSObject>
|
|
17
|
+
- (void)focus;
|
|
18
|
+
- (void)blur;
|
|
19
|
+
- (void)setTextAndSelection:(NSInteger)eventCount
|
|
20
|
+
value:(NSString *__nullable)value
|
|
21
|
+
start:(NSInteger)start
|
|
22
|
+
end:(NSInteger)end;
|
|
23
|
+
@end
|
|
24
|
+
|
|
25
|
+
RCT_EXTERN inline void
|
|
26
|
+
RCTComponentViewHelpers(id<RCTPasteTextInputViewProtocol> componentView, const NSString *commandName, const NSArray *args)
|
|
27
|
+
{
|
|
28
|
+
if ([commandName isEqualToString:@"focus"]) {
|
|
29
|
+
#if RCT_DEBUG
|
|
30
|
+
if ([args count] != 0) {
|
|
31
|
+
RCTLogError(
|
|
32
|
+
@"%@ command %@ received %d arguments, expected %d.", @"TextInput", commandName, (int)[args count], 0);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
[componentView focus];
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if ([commandName isEqualToString:@"blur"]) {
|
|
42
|
+
#if RCT_DEBUG
|
|
43
|
+
if ([args count] != 0) {
|
|
44
|
+
RCTLogError(
|
|
45
|
+
@"%@ command %@ received %d arguments, expected %d.", @"TextInput", commandName, (int)[args count], 0);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
#endif
|
|
49
|
+
|
|
50
|
+
[componentView blur];
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if ([commandName isEqualToString:@"setTextAndSelection"]) {
|
|
55
|
+
#if RCT_DEBUG
|
|
56
|
+
if ([args count] != 4) {
|
|
57
|
+
RCTLogError(
|
|
58
|
+
@"%@ command %@ received %d arguments, expected %d.", @"TextInput", commandName, (int)[args count], 4);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
NSObject *arg0 = args[0];
|
|
64
|
+
#if RCT_DEBUG
|
|
65
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"TextInput", commandName, @"1st")) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
#endif
|
|
69
|
+
NSInteger eventCount = [(NSNumber *)arg0 intValue];
|
|
70
|
+
|
|
71
|
+
NSObject *arg1 = args[1];
|
|
72
|
+
#if RCT_DEBUG
|
|
73
|
+
if (![arg1 isKindOfClass:[NSNull class]] &&
|
|
74
|
+
!RCTValidateTypeOfViewCommandArgument(arg1, [NSString class], @"string", @"TextInput", commandName, @"2nd")) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
NSString *value = [arg1 isKindOfClass:[NSNull class]] ? nil : (NSString *)arg1;
|
|
80
|
+
|
|
81
|
+
NSObject *arg2 = args[2];
|
|
82
|
+
#if RCT_DEBUG
|
|
83
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg2, [NSNumber class], @"number", @"TextInput", commandName, @"3rd")) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
#endif
|
|
87
|
+
NSInteger start = [(NSNumber *)arg2 intValue];
|
|
88
|
+
|
|
89
|
+
NSObject *arg3 = args[3];
|
|
90
|
+
#if RCT_DEBUG
|
|
91
|
+
if (!RCTValidateTypeOfViewCommandArgument(arg3, [NSNumber class], @"number", @"TextInput", commandName, @"4th")) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
#endif
|
|
95
|
+
NSInteger end = [(NSNumber *)arg3 intValue];
|
|
96
|
+
|
|
97
|
+
[componentView setTextAndSelection:eventCount value:value start:start end:end];
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
#if RCT_DEBUG
|
|
102
|
+
RCTLogError(@"%@ received command %@, which is not a supported command.", @"TextInput", commandName);
|
|
103
|
+
#endif
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
NS_ASSUME_NONNULL_END
|