@onekeyfe/react-native-text-input 6.7.0-3 → 6.7.0-31
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.
|
@@ -100,7 +100,7 @@ class TextInputViewPasteTest {
|
|
|
100
100
|
ClipData(ClipDescription("uri", arrayOf("text/uri-list")), ClipData.Item(uri))
|
|
101
101
|
|
|
102
102
|
private class TestReactContext(base: Context) : BridgeReactContext(base) {
|
|
103
|
-
override fun <T : NativeModule
|
|
103
|
+
override fun <T : NativeModule> getNativeModule(nativeModuleInterface: Class<T>): T? = null
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
private class MimeProvider(private val mime: String?) : ContentProvider() {
|
|
@@ -13,13 +13,17 @@ static dispatch_semaphore_t OneKeyTestReleaseRead;
|
|
|
13
13
|
|
|
14
14
|
- (BOOL)onekey_test_hasImages
|
|
15
15
|
{
|
|
16
|
-
dispatch_semaphore_t releaseRead;
|
|
17
|
-
dispatch_semaphore_t readStarted;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
dispatch_semaphore_t releaseRead = nil;
|
|
17
|
+
dispatch_semaphore_t readStarted = nil;
|
|
18
|
+
if (!NSThread.isMainThread) {
|
|
19
|
+
@synchronized (UIPasteboard.class) {
|
|
20
|
+
releaseRead = OneKeyTestReleaseRead;
|
|
21
|
+
readStarted = OneKeyTestReadStarted;
|
|
22
|
+
OneKeyTestReleaseRead = nil;
|
|
23
|
+
OneKeyTestReadStarted = nil;
|
|
24
|
+
}
|
|
21
25
|
}
|
|
22
|
-
if (
|
|
26
|
+
if (releaseRead != nil && readStarted != nil) {
|
|
23
27
|
dispatch_semaphore_signal(readStarted);
|
|
24
28
|
dispatch_semaphore_wait(releaseRead, dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC));
|
|
25
29
|
}
|
|
@@ -39,6 +43,8 @@ static dispatch_semaphore_t OneKeyTestReleaseRead;
|
|
|
39
43
|
NSArray<NSDictionary<NSString *, id> *> *previousItems = pasteboard.items;
|
|
40
44
|
RCTUITextField *field = [[RCTUITextField alloc] initWithFrame:CGRectZero];
|
|
41
45
|
SEL paste = @selector(paste:);
|
|
46
|
+
dispatch_semaphore_t readStarted = dispatch_semaphore_create(0);
|
|
47
|
+
dispatch_semaphore_t releaseRead = dispatch_semaphore_create(0);
|
|
42
48
|
|
|
43
49
|
@try {
|
|
44
50
|
pasteboard.items = @[];
|
|
@@ -49,8 +55,8 @@ static dispatch_semaphore_t OneKeyTestReleaseRead;
|
|
|
49
55
|
XCTAssertFalse([field canPerformAction:paste withSender:nil]);
|
|
50
56
|
|
|
51
57
|
@synchronized (UIPasteboard.class) {
|
|
52
|
-
OneKeyTestReadStarted =
|
|
53
|
-
OneKeyTestReleaseRead =
|
|
58
|
+
OneKeyTestReadStarted = readStarted;
|
|
59
|
+
OneKeyTestReleaseRead = releaseRead;
|
|
54
60
|
}
|
|
55
61
|
static dispatch_once_t onceToken;
|
|
56
62
|
dispatch_once(&onceToken, ^{
|
|
@@ -60,25 +66,22 @@ static dispatch_semaphore_t OneKeyTestReleaseRead;
|
|
|
60
66
|
});
|
|
61
67
|
|
|
62
68
|
UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:CGSizeMake(1, 1)];
|
|
63
|
-
|
|
69
|
+
UIImage *image = [renderer imageWithActions:^(UIGraphicsImageRendererContext *context) {
|
|
64
70
|
[UIColor.blackColor setFill];
|
|
65
71
|
UIRectFill(CGRectMake(0, 0, 1, 1));
|
|
66
72
|
}];
|
|
73
|
+
[pasteboard setData:UIImagePNGRepresentation(image) forPasteboardType:@"public.png"];
|
|
67
74
|
[NSNotificationCenter.defaultCenter postNotificationName:UIPasteboardChangedNotification object:pasteboard];
|
|
68
|
-
XCTAssertEqual(dispatch_semaphore_wait(
|
|
75
|
+
XCTAssertEqual(dispatch_semaphore_wait(readStarted, dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC)), 0L);
|
|
69
76
|
|
|
70
77
|
[NSNotificationCenter.defaultCenter postNotificationName:name object:field];
|
|
71
78
|
XCTAssertTrue([field canPerformAction:paste withSender:nil]);
|
|
72
79
|
} @finally {
|
|
73
|
-
dispatch_semaphore_t releaseRead;
|
|
74
80
|
@synchronized (UIPasteboard.class) {
|
|
75
|
-
releaseRead = OneKeyTestReleaseRead;
|
|
76
81
|
OneKeyTestReleaseRead = nil;
|
|
77
82
|
OneKeyTestReadStarted = nil;
|
|
78
83
|
}
|
|
79
|
-
|
|
80
|
-
dispatch_semaphore_signal(releaseRead);
|
|
81
|
-
}
|
|
84
|
+
dispatch_semaphore_signal(releaseRead);
|
|
82
85
|
pasteboard.items = previousItems;
|
|
83
86
|
}
|
|
84
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-text-input",
|
|
3
|
-
"version": "6.7.0-
|
|
3
|
+
"version": "6.7.0-31",
|
|
4
4
|
"description": "React Native TextInput with native paste events",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"registry": "https://registry.npmjs.org/"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@react-native/babel-preset": "0.
|
|
58
|
-
"@types/react": "^19.
|
|
57
|
+
"@react-native/babel-preset": "0.88.0",
|
|
58
|
+
"@types/react": "^19.3.0",
|
|
59
59
|
"del-cli": "^6.0.0",
|
|
60
|
-
"react": "19.
|
|
61
|
-
"react-native": "patch:react-native@npm%3A0.
|
|
60
|
+
"react": "19.3.0",
|
|
61
|
+
"react-native": "patch:react-native@npm%3A0.88.0#~/.yarn/patches/react-native-npm-0.88.0-60c6201dd2.patch",
|
|
62
62
|
"react-native-builder-bob": "^0.40.13",
|
|
63
63
|
"typescript": "^5.9.2"
|
|
64
64
|
},
|