react-native-windows 0.81.19 → 0.81.21
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/Folly/TEMP_UntilFollyUpdate/hash/SpookyHashV2.h +334 -0
- package/Libraries/Modal/Modal.d.ts +4 -0
- package/Libraries/Modal/Modal.windows.js +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +43 -23
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +63 -15
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +80 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.h +17 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/codegen/react/components/rnwcore/ModalHostView.g.h +8 -0
- package/codegen/react/components/rnwcore/Props.cpp +11 -1
- package/codegen/react/components/rnwcore/Props.h +2 -0
- package/package.json +1 -1
- package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +4 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// This is version 2 of SpookyHash, incompatible with version 1.
|
|
18
|
+
//
|
|
19
|
+
// SpookyHash: a 128-bit noncryptographic hash function
|
|
20
|
+
// By Bob Jenkins, public domain
|
|
21
|
+
// Oct 31 2010: alpha, framework + SpookyHash::Mix appears right
|
|
22
|
+
// Oct 31 2011: alpha again, Mix only good to 2^^69 but rest appears right
|
|
23
|
+
// Dec 31 2011: beta, improved Mix, tested it for 2-bit deltas
|
|
24
|
+
// Feb 2 2012: production, same bits as beta
|
|
25
|
+
// Feb 5 2012: adjusted definitions of uint* to be more portable
|
|
26
|
+
// Mar 30 2012: 3 bytes/cycle, not 4. Alpha was 4 but wasn't thorough enough.
|
|
27
|
+
// August 5 2012: SpookyV2 (different results)
|
|
28
|
+
//
|
|
29
|
+
// Up to 3 bytes/cycle for long messages. Reasonably fast for short messages.
|
|
30
|
+
// All 1 or 2 bit deltas achieve avalanche within 1% bias per output bit.
|
|
31
|
+
//
|
|
32
|
+
// This was developed for and tested on 64-bit x86-compatible processors.
|
|
33
|
+
// It assumes the processor is little-endian. There is a macro
|
|
34
|
+
// controlling whether unaligned reads are allowed (by default they are).
|
|
35
|
+
// This should be an equally good hash on big-endian machines, but it will
|
|
36
|
+
// compute different results on them than on little-endian machines.
|
|
37
|
+
//
|
|
38
|
+
// Google's CityHash has similar specs to SpookyHash, and CityHash is faster
|
|
39
|
+
// on new Intel boxes. MD4 and MD5 also have similar specs, but they are orders
|
|
40
|
+
// of magnitude slower. CRCs are two or more times slower, but unlike
|
|
41
|
+
// SpookyHash, they have nice math for combining the CRCs of pieces to form
|
|
42
|
+
// the CRCs of wholes. There are also cryptographic hashes, but those are even
|
|
43
|
+
// slower than MD5.
|
|
44
|
+
//
|
|
45
|
+
|
|
46
|
+
#pragma once
|
|
47
|
+
|
|
48
|
+
#include <cassert>
|
|
49
|
+
#include <cstddef>
|
|
50
|
+
#include <cstdint>
|
|
51
|
+
|
|
52
|
+
#include <folly/CPortability.h>
|
|
53
|
+
#include <folly/Portability.h>
|
|
54
|
+
#include <folly/lang/CString.h>
|
|
55
|
+
|
|
56
|
+
namespace folly {
|
|
57
|
+
namespace hash {
|
|
58
|
+
|
|
59
|
+
// clang-format off
|
|
60
|
+
|
|
61
|
+
class SpookyHashV2
|
|
62
|
+
{
|
|
63
|
+
public:
|
|
64
|
+
//
|
|
65
|
+
// SpookyHash: hash a single message in one call, produce 128-bit output
|
|
66
|
+
//
|
|
67
|
+
static void Hash128(
|
|
68
|
+
const void *message, // message to hash
|
|
69
|
+
size_t length, // length of message in bytes
|
|
70
|
+
uint64_t *hash1, // in/out: in seed 1, out hash value 1
|
|
71
|
+
uint64_t *hash2); // in/out: in seed 2, out hash value 2
|
|
72
|
+
|
|
73
|
+
//
|
|
74
|
+
// Hash64: hash a single message in one call, return 64-bit output
|
|
75
|
+
//
|
|
76
|
+
static uint64_t Hash64(
|
|
77
|
+
const void *message, // message to hash
|
|
78
|
+
size_t length, // length of message in bytes
|
|
79
|
+
uint64_t seed) // seed
|
|
80
|
+
{
|
|
81
|
+
uint64_t hash1 = seed;
|
|
82
|
+
Hash128(message, length, &hash1, &seed);
|
|
83
|
+
return hash1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//
|
|
87
|
+
// Hash32: hash a single message in one call, produce 32-bit output
|
|
88
|
+
//
|
|
89
|
+
static uint32_t Hash32(
|
|
90
|
+
const void *message, // message to hash
|
|
91
|
+
size_t length, // length of message in bytes
|
|
92
|
+
uint32_t seed) // seed
|
|
93
|
+
{
|
|
94
|
+
uint64_t hash1 = seed, hash2 = seed;
|
|
95
|
+
Hash128(message, length, &hash1, &hash2);
|
|
96
|
+
return (uint32_t)hash1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//
|
|
100
|
+
// Init: initialize the context of a SpookyHash
|
|
101
|
+
//
|
|
102
|
+
void Init(
|
|
103
|
+
uint64_t seed1, // any 64-bit value will do, including 0
|
|
104
|
+
uint64_t seed2); // different seeds produce independent hashes
|
|
105
|
+
|
|
106
|
+
//
|
|
107
|
+
// Update: add a piece of a message to a SpookyHash state
|
|
108
|
+
//
|
|
109
|
+
void Update(
|
|
110
|
+
const void *message, // message fragment
|
|
111
|
+
size_t length); // length of message fragment in bytes
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
//
|
|
115
|
+
// Final: compute the hash for the current SpookyHash state
|
|
116
|
+
//
|
|
117
|
+
// This does not modify the state; you can keep updating it afterward
|
|
118
|
+
//
|
|
119
|
+
// The result is the same as if SpookyHash() had been called with
|
|
120
|
+
// all the pieces concatenated into one message.
|
|
121
|
+
//
|
|
122
|
+
void Final(
|
|
123
|
+
uint64_t *hash1, // out only: first 64 bits of hash value.
|
|
124
|
+
uint64_t *hash2) const; // out only: second 64 bits of hash value.
|
|
125
|
+
|
|
126
|
+
//
|
|
127
|
+
// left rotate a 64-bit value by k bytes
|
|
128
|
+
//
|
|
129
|
+
static inline uint64_t Rot64(uint64_t x, int k)
|
|
130
|
+
{
|
|
131
|
+
return (x << k) | (x >> (64 - k));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
//
|
|
135
|
+
// This is used if the input is 96 bytes long or longer.
|
|
136
|
+
//
|
|
137
|
+
// The internal state is fully overwritten every 96 bytes.
|
|
138
|
+
// Every input bit appears to cause at least 128 bits of entropy
|
|
139
|
+
// before 96 other bytes are combined, when run forward or backward
|
|
140
|
+
// For every input bit,
|
|
141
|
+
// Two inputs differing in just that input bit
|
|
142
|
+
// Where "differ" means xor or subtraction
|
|
143
|
+
// And the base value is random
|
|
144
|
+
// When run forward or backwards one Mix
|
|
145
|
+
// I tried 3 pairs of each; they all differed by at least 212 bits.
|
|
146
|
+
//
|
|
147
|
+
static inline void Mix(
|
|
148
|
+
const uint64_t *data,
|
|
149
|
+
uint64_t &s0, uint64_t &s1, uint64_t &s2, uint64_t &s3,
|
|
150
|
+
uint64_t &s4, uint64_t &s5, uint64_t &s6, uint64_t &s7,
|
|
151
|
+
uint64_t &s8, uint64_t &s9, uint64_t &s10,uint64_t &s11)
|
|
152
|
+
{
|
|
153
|
+
auto read = [&](auto off) { return Read8(data, off); };
|
|
154
|
+
s0 += read(0); s2 ^= s10; s11 ^= s0; s0 = Rot64(s0,11); s11 += s1;
|
|
155
|
+
s1 += read(1); s3 ^= s11; s0 ^= s1; s1 = Rot64(s1,32); s0 += s2;
|
|
156
|
+
s2 += read(2); s4 ^= s0; s1 ^= s2; s2 = Rot64(s2,43); s1 += s3;
|
|
157
|
+
s3 += read(3); s5 ^= s1; s2 ^= s3; s3 = Rot64(s3,31); s2 += s4;
|
|
158
|
+
s4 += read(4); s6 ^= s2; s3 ^= s4; s4 = Rot64(s4,17); s3 += s5;
|
|
159
|
+
s5 += read(5); s7 ^= s3; s4 ^= s5; s5 = Rot64(s5,28); s4 += s6;
|
|
160
|
+
s6 += read(6); s8 ^= s4; s5 ^= s6; s6 = Rot64(s6,39); s5 += s7;
|
|
161
|
+
s7 += read(7); s9 ^= s5; s6 ^= s7; s7 = Rot64(s7,57); s6 += s8;
|
|
162
|
+
s8 += read(8); s10 ^= s6; s7 ^= s8; s8 = Rot64(s8,55); s7 += s9;
|
|
163
|
+
s9 += read(9); s11 ^= s7; s8 ^= s9; s9 = Rot64(s9,54); s8 += s10;
|
|
164
|
+
s10 += read(10); s0 ^= s8; s9 ^= s10; s10 = Rot64(s10,22); s9 += s11;
|
|
165
|
+
s11 += read(11); s1 ^= s9; s10 ^= s11; s11 = Rot64(s11,46); s10 += s0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
//
|
|
169
|
+
// Mix all 12 inputs together so that h0, h1 are a hash of them all.
|
|
170
|
+
//
|
|
171
|
+
// For two inputs differing in just the input bits
|
|
172
|
+
// Where "differ" means xor or subtraction
|
|
173
|
+
// And the base value is random, or a counting value starting at that bit
|
|
174
|
+
// The final result will have each bit of h0, h1 flip
|
|
175
|
+
// For every input bit,
|
|
176
|
+
// with probability 50 +- .3%
|
|
177
|
+
// For every pair of input bits,
|
|
178
|
+
// with probability 50 +- 3%
|
|
179
|
+
//
|
|
180
|
+
// This does not rely on the last Mix() call having already mixed some.
|
|
181
|
+
// Two iterations was almost good enough for a 64-bit result, but a
|
|
182
|
+
// 128-bit result is reported, so End() does three iterations.
|
|
183
|
+
//
|
|
184
|
+
static inline void EndPartial(
|
|
185
|
+
uint64_t &h0, uint64_t &h1, uint64_t &h2, uint64_t &h3,
|
|
186
|
+
uint64_t &h4, uint64_t &h5, uint64_t &h6, uint64_t &h7,
|
|
187
|
+
uint64_t &h8, uint64_t &h9, uint64_t &h10,uint64_t &h11)
|
|
188
|
+
{
|
|
189
|
+
h11+= h1; h2 ^= h11; h1 = Rot64(h1,44);
|
|
190
|
+
h0 += h2; h3 ^= h0; h2 = Rot64(h2,15);
|
|
191
|
+
h1 += h3; h4 ^= h1; h3 = Rot64(h3,34);
|
|
192
|
+
h2 += h4; h5 ^= h2; h4 = Rot64(h4,21);
|
|
193
|
+
h3 += h5; h6 ^= h3; h5 = Rot64(h5,38);
|
|
194
|
+
h4 += h6; h7 ^= h4; h6 = Rot64(h6,33);
|
|
195
|
+
h5 += h7; h8 ^= h5; h7 = Rot64(h7,10);
|
|
196
|
+
h6 += h8; h9 ^= h6; h8 = Rot64(h8,13);
|
|
197
|
+
h7 += h9; h10^= h7; h9 = Rot64(h9,38);
|
|
198
|
+
h8 += h10; h11^= h8; h10= Rot64(h10,53);
|
|
199
|
+
h9 += h11; h0 ^= h9; h11= Rot64(h11,42);
|
|
200
|
+
h10+= h0; h1 ^= h10; h0 = Rot64(h0,54);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
static inline void End(
|
|
204
|
+
const uint64_t *data,
|
|
205
|
+
uint64_t &h0, uint64_t &h1, uint64_t &h2, uint64_t &h3,
|
|
206
|
+
uint64_t &h4, uint64_t &h5, uint64_t &h6, uint64_t &h7,
|
|
207
|
+
uint64_t &h8, uint64_t &h9, uint64_t &h10,uint64_t &h11)
|
|
208
|
+
{
|
|
209
|
+
h0 += data[0]; h1 += data[1]; h2 += data[2]; h3 += data[3];
|
|
210
|
+
h4 += data[4]; h5 += data[5]; h6 += data[6]; h7 += data[7];
|
|
211
|
+
h8 += data[8]; h9 += data[9]; h10 += data[10]; h11 += data[11];
|
|
212
|
+
EndPartial(h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
|
213
|
+
EndPartial(h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
|
214
|
+
EndPartial(h0,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
//
|
|
218
|
+
// The goal is for each bit of the input to expand into 128 bits of
|
|
219
|
+
// apparent entropy before it is fully overwritten.
|
|
220
|
+
// n trials both set and cleared at least m bits of h0 h1 h2 h3
|
|
221
|
+
// n: 2 m: 29
|
|
222
|
+
// n: 3 m: 46
|
|
223
|
+
// n: 4 m: 57
|
|
224
|
+
// n: 5 m: 107
|
|
225
|
+
// n: 6 m: 146
|
|
226
|
+
// n: 7 m: 152
|
|
227
|
+
// when run forwards or backwards
|
|
228
|
+
// for all 1-bit and 2-bit diffs
|
|
229
|
+
// with diffs defined by either xor or subtraction
|
|
230
|
+
// with a base of all zeros plus a counter, or plus another bit, or random
|
|
231
|
+
//
|
|
232
|
+
static inline void ShortMix(uint64_t &h0, uint64_t &h1,
|
|
233
|
+
uint64_t &h2, uint64_t &h3)
|
|
234
|
+
{
|
|
235
|
+
h2 = Rot64(h2,50); h2 += h3; h0 ^= h2;
|
|
236
|
+
h3 = Rot64(h3,52); h3 += h0; h1 ^= h3;
|
|
237
|
+
h0 = Rot64(h0,30); h0 += h1; h2 ^= h0;
|
|
238
|
+
h1 = Rot64(h1,41); h1 += h2; h3 ^= h1;
|
|
239
|
+
h2 = Rot64(h2,54); h2 += h3; h0 ^= h2;
|
|
240
|
+
h3 = Rot64(h3,48); h3 += h0; h1 ^= h3;
|
|
241
|
+
h0 = Rot64(h0,38); h0 += h1; h2 ^= h0;
|
|
242
|
+
h1 = Rot64(h1,37); h1 += h2; h3 ^= h1;
|
|
243
|
+
h2 = Rot64(h2,62); h2 += h3; h0 ^= h2;
|
|
244
|
+
h3 = Rot64(h3,34); h3 += h0; h1 ^= h3;
|
|
245
|
+
h0 = Rot64(h0,5); h0 += h1; h2 ^= h0;
|
|
246
|
+
h1 = Rot64(h1,36); h1 += h2; h3 ^= h1;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
//
|
|
250
|
+
// Mix all 4 inputs together so that h0, h1 are a hash of them all.
|
|
251
|
+
//
|
|
252
|
+
// For two inputs differing in just the input bits
|
|
253
|
+
// Where "differ" means xor or subtraction
|
|
254
|
+
// And the base value is random, or a counting value starting at that bit
|
|
255
|
+
// The final result will have each bit of h0, h1 flip
|
|
256
|
+
// For every input bit,
|
|
257
|
+
// with probability 50 +- .3% (it is probably better than that)
|
|
258
|
+
// For every pair of input bits,
|
|
259
|
+
// with probability 50 +- .75% (the worst case is approximately that)
|
|
260
|
+
//
|
|
261
|
+
static inline void ShortEnd(uint64_t &h0, uint64_t &h1,
|
|
262
|
+
uint64_t &h2, uint64_t &h3)
|
|
263
|
+
{
|
|
264
|
+
h3 ^= h2; h2 = Rot64(h2,15); h3 += h2;
|
|
265
|
+
h0 ^= h3; h3 = Rot64(h3,52); h0 += h3;
|
|
266
|
+
h1 ^= h0; h0 = Rot64(h0,26); h1 += h0;
|
|
267
|
+
h2 ^= h1; h1 = Rot64(h1,51); h2 += h1;
|
|
268
|
+
h3 ^= h2; h2 = Rot64(h2,28); h3 += h2;
|
|
269
|
+
h0 ^= h3; h3 = Rot64(h3,9); h0 += h3;
|
|
270
|
+
h1 ^= h0; h0 = Rot64(h0,47); h1 += h0;
|
|
271
|
+
h2 ^= h1; h1 = Rot64(h1,54); h2 += h1;
|
|
272
|
+
h3 ^= h2; h2 = Rot64(h2,32); h3 += h2;
|
|
273
|
+
h0 ^= h3; h3 = Rot64(h3,25); h0 += h3;
|
|
274
|
+
h1 ^= h0; h0 = Rot64(h0,63); h1 += h0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private:
|
|
278
|
+
|
|
279
|
+
//
|
|
280
|
+
// Short is used for messages under 192 bytes in length
|
|
281
|
+
// Short has a low startup cost, the normal mode is good for long
|
|
282
|
+
// keys, the cost crossover is at about 192 bytes. The two modes were
|
|
283
|
+
// held to the same quality bar.
|
|
284
|
+
//
|
|
285
|
+
static void Short(
|
|
286
|
+
const void *message, // message (byte array, not necessarily aligned)
|
|
287
|
+
size_t length, // length of message (in bytes)
|
|
288
|
+
uint64_t *hash1, // in/out: in the seed, out the hash value
|
|
289
|
+
uint64_t *hash2); // in/out: in the seed, out the hash value
|
|
290
|
+
|
|
291
|
+
//
|
|
292
|
+
// Helper to read 8 consecutive bytes from a buffer
|
|
293
|
+
// If the platform has unaligned access, may be called with unaligned buf
|
|
294
|
+
// Otherwise, must be called only with aligned buf
|
|
295
|
+
//
|
|
296
|
+
FOLLY_ALWAYS_INLINE static uint64_t Read8(const uint64_t* buf, size_t off) {
|
|
297
|
+
if constexpr (kHasUnalignedAccess) {
|
|
298
|
+
uint64_t out;
|
|
299
|
+
FOLLY_BUILTIN_MEMCPY(&out, buf + off, sizeof(out));
|
|
300
|
+
return out;
|
|
301
|
+
} else {
|
|
302
|
+
//assert(0 == reinterpret_cast<uintptr_t>(buf) % sizeof(*buf)); // Windows
|
|
303
|
+
return buf[off];
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// number of uint64_t's in internal state
|
|
308
|
+
static constexpr size_t sc_numVars = 12;
|
|
309
|
+
|
|
310
|
+
// size of the internal state
|
|
311
|
+
static constexpr size_t sc_blockSize = sc_numVars*8;
|
|
312
|
+
|
|
313
|
+
// size of buffer of unhashed data, in bytes
|
|
314
|
+
static constexpr size_t sc_bufSize = 2*sc_blockSize;
|
|
315
|
+
|
|
316
|
+
//
|
|
317
|
+
// sc_const: a constant which:
|
|
318
|
+
// * is not zero
|
|
319
|
+
// * is odd
|
|
320
|
+
// * is a not-very-regular mix of 1's and 0's
|
|
321
|
+
// * does not need any other special mathematical properties
|
|
322
|
+
//
|
|
323
|
+
static constexpr uint64_t sc_const = 0xdeadbeefdeadbeefULL;
|
|
324
|
+
|
|
325
|
+
uint64_t m_data[2*sc_numVars]; // unhashed data, for partial messages
|
|
326
|
+
uint64_t m_state[sc_numVars]; // internal state of the hash
|
|
327
|
+
size_t m_length; // total length of the input so far
|
|
328
|
+
uint8_t m_remainder; // length of unhashed data stashed in m_data
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// clang-format on
|
|
332
|
+
|
|
333
|
+
} // namespace hash
|
|
334
|
+
} // namespace folly
|
|
@@ -117,6 +117,10 @@ export interface ModalWindowsProps {
|
|
|
117
117
|
/* title for the modal, shown in the title bar */
|
|
118
118
|
// [Windows
|
|
119
119
|
title?: string | undefined;
|
|
120
|
+
|
|
121
|
+
hideTitleBar?: boolean | undefined;
|
|
122
|
+
|
|
123
|
+
hideBorder?: boolean | undefined;
|
|
120
124
|
// Windows]
|
|
121
125
|
}
|
|
122
126
|
|
|
@@ -174,6 +174,8 @@ export type ModalPropsWindows = {
|
|
|
174
174
|
* [Windows] The `title` prop sets the title of the modal window.
|
|
175
175
|
*/
|
|
176
176
|
title?: ?string,
|
|
177
|
+
hideTitleBar?: ?boolean,
|
|
178
|
+
hideBorder?: ?boolean,
|
|
177
179
|
};
|
|
178
180
|
|
|
179
181
|
export type ModalProps = {
|
|
@@ -352,6 +354,8 @@ class Modal extends React.Component<ModalProps, ModalState> {
|
|
|
352
354
|
onOrientationChange={this.props.onOrientationChange}
|
|
353
355
|
allowSwipeDismissal={this.props.allowSwipeDismissal}
|
|
354
356
|
testID={this.props.testID}
|
|
357
|
+
hideTitleBar={this.props.hideTitleBar} // [Windows]
|
|
358
|
+
hideBorder={this.props.hideBorder} // [Windows]
|
|
355
359
|
title={this.props.title}>
|
|
356
360
|
<VirtualizedListContextResetter>
|
|
357
361
|
<ScrollView.Context.Provider value={null}>
|
|
@@ -1122,6 +1122,25 @@ void CompositionEventHandler::onPointerCaptureLost(
|
|
|
1122
1122
|
|
|
1123
1123
|
m_pointerCapturingComponentTag = -1;
|
|
1124
1124
|
}
|
|
1125
|
+
|
|
1126
|
+
// Also cancel any active touch for the specific pointer that lost capture, even
|
|
1127
|
+
// when no JS-level CapturePointer was ever issued. This handles ScrollView (and
|
|
1128
|
+
// any other VisualInteractionSource) calling TryRedirectForManipulation: the OS
|
|
1129
|
+
// reassigns the pointer to the InteractionTracker, fires PointerCaptureLost, and
|
|
1130
|
+
// then stops delivering PointerMoved/PointerReleased to us. Without this cleanup
|
|
1131
|
+
// m_activeTouches keeps a zombie entry whose target is the originally-pressed
|
|
1132
|
+
// Pressable, leaving it visually pressed and causing later taps to be attributed
|
|
1133
|
+
// to that original target. If the entry was already cleared above (for a JS-level
|
|
1134
|
+
// capture) or by onPointerReleased running first, the find() is a no-op.
|
|
1135
|
+
PointerId pointerId = pointerPoint.PointerId();
|
|
1136
|
+
auto activeTouch = m_activeTouches.find(pointerId);
|
|
1137
|
+
if (activeTouch != m_activeTouches.end()) {
|
|
1138
|
+
ActiveTouch cancelledTouchCopy = std::move(activeTouch->second);
|
|
1139
|
+
m_activeTouches.erase(activeTouch);
|
|
1140
|
+
if (cancelledTouchCopy.eventEmitter) {
|
|
1141
|
+
DispatchSynthesizedTouchCancelForActiveTouch(cancelledTouchCopy, pointerPoint, keyModifiers);
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1125
1144
|
}
|
|
1126
1145
|
|
|
1127
1146
|
void CompositionEventHandler::onPointerMoved(
|
|
@@ -1372,7 +1391,7 @@ void CompositionEventHandler::onPointerPressed(
|
|
|
1372
1391
|
|
|
1373
1392
|
UpdateActiveTouch(activeTouch, ptScaled, ptLocal);
|
|
1374
1393
|
|
|
1375
|
-
activeTouch.isPrimary =
|
|
1394
|
+
activeTouch.isPrimary = pointerPoint.Properties().IsPrimary();
|
|
1376
1395
|
// Map the Windows pointer ID to a small identifier (0–19) safe for use as a JS array index.
|
|
1377
1396
|
// Windows touch IDs can be arbitrarily large (e.g. 2233), which causes React Native to warn
|
|
1378
1397
|
// and corrupts touch state, leaving Pressables stuck after a scroll.
|
|
@@ -1620,16 +1639,6 @@ bool CompositionEventHandler::IsPointerWithinInitialTree(const ActiveTouch &acti
|
|
|
1620
1639
|
currentView = currentView.Parent();
|
|
1621
1640
|
}
|
|
1622
1641
|
|
|
1623
|
-
// Fallback: if the pointer drifted spatially but the original target
|
|
1624
|
-
// is still structurally within the initial tree, honor the tap.
|
|
1625
|
-
// This provides touch-device tolerance for finger drift.
|
|
1626
|
-
auto targetView = viewRegistry.componentViewDescriptorWithTag(activeTouch.touch.target).view;
|
|
1627
|
-
while (targetView) {
|
|
1628
|
-
if (targetView.Tag() == initialTag)
|
|
1629
|
-
return true;
|
|
1630
|
-
targetView = targetView.Parent();
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
1642
|
return false;
|
|
1634
1643
|
}
|
|
1635
1644
|
|
|
@@ -1691,7 +1700,15 @@ void CompositionEventHandler::DispatchTouchEvent(
|
|
|
1691
1700
|
|
|
1692
1701
|
facebook::react::TouchEvent event;
|
|
1693
1702
|
|
|
1694
|
-
|
|
1703
|
+
// First pass: build changedTouches and the set of unique emitters from every active
|
|
1704
|
+
// touch. The per-pointer PointerEvent dispatch (onPointerDown/Move/Up/Cancel/Click) is
|
|
1705
|
+
// fired only for the touch whose state actually changed — non-changed touches contribute
|
|
1706
|
+
// to the W3C TouchEvent's touches/targetTouches sets in the loops below but must not
|
|
1707
|
+
// re-fire pointer events of their own. Previously we dispatched the per-pointer event
|
|
1708
|
+
// for every entry in m_activeTouches, which produced duplicated onPointerMove on
|
|
1709
|
+
// non-moving fingers and replayed onPointerUp/onClick on stale targets after the OS
|
|
1710
|
+
// reclaimed a pointer (e.g. ScrollView manipulation redirect leaving a zombie touch).
|
|
1711
|
+
const ActiveTouch *changedTouch = nullptr;
|
|
1695
1712
|
for (const auto &pair : m_activeTouches) {
|
|
1696
1713
|
const auto &activeTouch = pair.second;
|
|
1697
1714
|
|
|
@@ -1700,14 +1717,17 @@ void CompositionEventHandler::DispatchTouchEvent(
|
|
|
1700
1717
|
}
|
|
1701
1718
|
|
|
1702
1719
|
if (pair.first == pointerId) {
|
|
1720
|
+
changedTouch = &activeTouch;
|
|
1703
1721
|
event.changedTouches.insert(activeTouch.touch);
|
|
1704
1722
|
}
|
|
1705
1723
|
uniqueEventEmitters.insert(activeTouch.eventEmitter);
|
|
1724
|
+
}
|
|
1706
1725
|
|
|
1707
|
-
|
|
1726
|
+
if (changedTouch) {
|
|
1727
|
+
facebook::react::PointerEvent pointerEvent = CreatePointerEventFromActiveTouch(*changedTouch, eventType);
|
|
1708
1728
|
|
|
1709
1729
|
winrt::Microsoft::ReactNative::ComponentView targetView{nullptr};
|
|
1710
|
-
bool shouldLeave = (eventType == TouchEventType::End &&
|
|
1730
|
+
bool shouldLeave = (eventType == TouchEventType::End && changedTouch->shouldLeaveWhenReleased) ||
|
|
1711
1731
|
eventType == TouchEventType::Cancel;
|
|
1712
1732
|
if (!shouldLeave) {
|
|
1713
1733
|
auto *rootViewForHit = RootComponentView();
|
|
@@ -1722,29 +1742,29 @@ void CompositionEventHandler::DispatchTouchEvent(
|
|
|
1722
1742
|
}
|
|
1723
1743
|
}
|
|
1724
1744
|
|
|
1725
|
-
auto handler = [this,
|
|
1745
|
+
auto handler = [this, changedTouch, eventType, &pointerEvent](
|
|
1726
1746
|
std::vector<winrt::Microsoft::ReactNative::ComponentView> &eventPathViews) {
|
|
1727
1747
|
switch (eventType) {
|
|
1728
1748
|
case TouchEventType::Start:
|
|
1729
|
-
|
|
1749
|
+
changedTouch->eventEmitter->onPointerDown(pointerEvent);
|
|
1730
1750
|
break;
|
|
1731
1751
|
case TouchEventType::Move: {
|
|
1732
|
-
|
|
1752
|
+
changedTouch->eventEmitter->onPointerMove(pointerEvent);
|
|
1733
1753
|
break;
|
|
1734
1754
|
}
|
|
1735
1755
|
case TouchEventType::End:
|
|
1736
|
-
|
|
1756
|
+
changedTouch->eventEmitter->onPointerUp(pointerEvent);
|
|
1737
1757
|
if (pointerEvent.isPrimary && pointerEvent.button == 0) {
|
|
1738
|
-
if (IsPointerWithinInitialTree(
|
|
1739
|
-
|
|
1758
|
+
if (IsPointerWithinInitialTree(*changedTouch)) {
|
|
1759
|
+
changedTouch->eventEmitter->onClick(pointerEvent);
|
|
1740
1760
|
}
|
|
1741
|
-
} else if (IsPointerWithinInitialTree(
|
|
1742
|
-
|
|
1761
|
+
} else if (IsPointerWithinInitialTree(*changedTouch)) {
|
|
1762
|
+
changedTouch->eventEmitter->onAuxClick(pointerEvent);
|
|
1743
1763
|
}
|
|
1744
1764
|
break;
|
|
1745
1765
|
case TouchEventType::Cancel:
|
|
1746
1766
|
case TouchEventType::CaptureLost:
|
|
1747
|
-
|
|
1767
|
+
changedTouch->eventEmitter->onPointerCancel(pointerEvent);
|
|
1748
1768
|
break;
|
|
1749
1769
|
}
|
|
1750
1770
|
};
|
|
@@ -131,6 +131,7 @@ void ImageComponentView::didReceiveImage(const std::shared_ptr<ImageResponseImag
|
|
|
131
131
|
#endif
|
|
132
132
|
|
|
133
133
|
m_imageResponseImage = imageResponseImage;
|
|
134
|
+
m_requiresImageRedraw = true;
|
|
134
135
|
ensureDrawingSurface();
|
|
135
136
|
}
|
|
136
137
|
|
|
@@ -316,6 +317,9 @@ void ImageComponentView::ensureDrawingSurface() noexcept {
|
|
|
316
317
|
} else if (m_imageResponseImage->m_brushFactory) {
|
|
317
318
|
Visual().as<Experimental::ISpriteVisual>().Brush(
|
|
318
319
|
m_imageResponseImage->m_brushFactory(m_reactContext.Handle(), m_compContext));
|
|
320
|
+
} else if (m_requiresImageRedraw) {
|
|
321
|
+
m_requiresImageRedraw = false;
|
|
322
|
+
DrawImage();
|
|
319
323
|
}
|
|
320
324
|
}
|
|
321
325
|
|
|
@@ -99,6 +99,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ViewComponen
|
|
|
99
99
|
winrt::Microsoft::ReactNative::Composition::Experimental::IDrawingSurfaceBrush m_drawingSurface;
|
|
100
100
|
std::shared_ptr<ImageResponseImage> m_imageResponseImage;
|
|
101
101
|
std::shared_ptr<WindowsImageResponseObserver> m_imageResponseObserver;
|
|
102
|
+
bool m_requiresImageRedraw{true};
|
|
102
103
|
facebook::react::ImageShadowNode::ConcreteState::Shared m_state;
|
|
103
104
|
};
|
|
104
105
|
|
package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#include "../../../codegen/react/components/rnwcore/ModalHostView.g.h"
|
|
9
9
|
#include <ComponentView.Experimental.interop.h>
|
|
10
|
+
#include <dwmapi.h>
|
|
10
11
|
#include <winrt/Microsoft.UI.Content.h>
|
|
11
12
|
#include <winrt/Microsoft.UI.Input.h>
|
|
12
13
|
#include <winrt/Microsoft.UI.Windowing.h>
|
|
@@ -112,6 +113,12 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
112
113
|
m_rnWindow.AppWindow().Title(titleValue);
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
if (m_rnWindow &&
|
|
117
|
+
(newViewProps.hideTitleBar != oldViewProps.hideTitleBar ||
|
|
118
|
+
newViewProps.hideBorder != oldViewProps.hideBorder)) {
|
|
119
|
+
UpdateTitleBarAndBorder();
|
|
120
|
+
}
|
|
121
|
+
|
|
115
122
|
::Microsoft::ReactNativeSpecs::BaseModalHostView<ModalHostView>::UpdateProps(view, newProps, oldProps);
|
|
116
123
|
}
|
|
117
124
|
|
|
@@ -258,6 +265,61 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
258
265
|
}
|
|
259
266
|
}
|
|
260
267
|
|
|
268
|
+
void UpdateTitleBarAndBorder() noexcept {
|
|
269
|
+
if (!m_rnWindow) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
auto overlappedPresenter = winrt::Microsoft::UI::Windowing::OverlappedPresenter::Create();
|
|
274
|
+
|
|
275
|
+
// Configure presenter for modal behavior
|
|
276
|
+
overlappedPresenter.IsModal(true);
|
|
277
|
+
|
|
278
|
+
// modal should only have close button
|
|
279
|
+
overlappedPresenter.IsMinimizable(false);
|
|
280
|
+
overlappedPresenter.IsMaximizable(false);
|
|
281
|
+
|
|
282
|
+
// Apply the presenter to the window
|
|
283
|
+
m_rnWindow.AppWindow().SetPresenter(overlappedPresenter);
|
|
284
|
+
|
|
285
|
+
// We only hide the borders if the titlebar is also hidden.
|
|
286
|
+
const bool hideBorders = m_localProps->hideTitleBar.value_or(false) && m_localProps->hideBorder.value_or(false);
|
|
287
|
+
|
|
288
|
+
auto titleBar = m_rnWindow.AppWindow().TitleBar();
|
|
289
|
+
titleBar.ResetToDefault();
|
|
290
|
+
overlappedPresenter.IsResizable(false);
|
|
291
|
+
|
|
292
|
+
overlappedPresenter.SetBorderAndTitleBar(!hideBorders, !m_localProps->hideTitleBar.value_or(false));
|
|
293
|
+
|
|
294
|
+
auto hwnd = GetWindowFromWindowId(m_rnWindow.AppWindow().Id());
|
|
295
|
+
|
|
296
|
+
if (hideBorders) {
|
|
297
|
+
const DWMNCRENDERINGPOLICY ncPolicy = DWMNCRP_DISABLED;
|
|
298
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &ncPolicy, sizeof(ncPolicy));
|
|
299
|
+
|
|
300
|
+
const DWM_WINDOW_CORNER_PREFERENCE cornerPref = DWMWCP_DEFAULT;
|
|
301
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPref, sizeof(cornerPref));
|
|
302
|
+
|
|
303
|
+
const COLORREF zeroColor = 0;
|
|
304
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_BORDER_COLOR, &zeroColor, sizeof(zeroColor));
|
|
305
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &zeroColor, sizeof(zeroColor));
|
|
306
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_TEXT_COLOR, &zeroColor, sizeof(zeroColor));
|
|
307
|
+
} else {
|
|
308
|
+
const DWMNCRENDERINGPOLICY ncPolicy = DWMNCRP_USEWINDOWSTYLE;
|
|
309
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &ncPolicy, sizeof(ncPolicy));
|
|
310
|
+
|
|
311
|
+
const DWM_WINDOW_CORNER_PREFERENCE cornerPref = DWMWCP_DEFAULT;
|
|
312
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPref, sizeof(cornerPref));
|
|
313
|
+
|
|
314
|
+
const COLORREF zeroColor = DWMWA_COLOR_DEFAULT;
|
|
315
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_BORDER_COLOR, &zeroColor, sizeof(zeroColor));
|
|
316
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_CAPTION_COLOR, &zeroColor, sizeof(zeroColor));
|
|
317
|
+
::DwmSetWindowAttribute(hwnd, DWMWA_TEXT_COLOR, &zeroColor, sizeof(zeroColor));
|
|
318
|
+
|
|
319
|
+
titleBar.IconShowOptions(winrt::Microsoft::UI::Windowing::IconShowOptions::HideIconAndSystemMenu);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
261
323
|
// creates a new modal window
|
|
262
324
|
void EnsureModalCreated(const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
263
325
|
if (m_popUp) {
|
|
@@ -282,22 +344,8 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
282
344
|
m_rnWindow = winrt::Microsoft::ReactNative::ReactNativeWindow::CreateFromContentSiteBridgeAndIsland(
|
|
283
345
|
m_popUp, winrt::Microsoft::ReactNative::ReactNativeIsland::CreatePortal(portal));
|
|
284
346
|
m_rnWindow.ResizePolicy(winrt::Microsoft::ReactNative::ContentSizePolicy::None);
|
|
285
|
-
auto overlappedPresenter = winrt::Microsoft::UI::Windowing::OverlappedPresenter::Create();
|
|
286
|
-
|
|
287
|
-
// Configure presenter for modal behavior
|
|
288
|
-
overlappedPresenter.IsModal(true);
|
|
289
|
-
overlappedPresenter.SetBorderAndTitleBar(true, true);
|
|
290
|
-
|
|
291
|
-
// modal should only have close button
|
|
292
|
-
overlappedPresenter.IsMinimizable(false);
|
|
293
|
-
overlappedPresenter.IsMaximizable(false);
|
|
294
|
-
|
|
295
|
-
// Apply the presenter to the window
|
|
296
|
-
m_rnWindow.AppWindow().SetPresenter(overlappedPresenter);
|
|
297
347
|
|
|
298
|
-
|
|
299
|
-
m_rnWindow.AppWindow().TitleBar().IconShowOptions(
|
|
300
|
-
winrt::Microsoft::UI::Windowing::IconShowOptions::HideIconAndSystemMenu);
|
|
348
|
+
UpdateTitleBarAndBorder();
|
|
301
349
|
|
|
302
350
|
// Set initial title using the stored local props
|
|
303
351
|
if (m_localProps && m_localProps->title.has_value()) {
|
|
@@ -169,12 +169,22 @@ TooltipTracker::TooltipTracker(
|
|
|
169
169
|
view.PointerEntered({this, &TooltipTracker::OnPointerEntered});
|
|
170
170
|
view.PointerExited({this, &TooltipTracker::OnPointerExited});
|
|
171
171
|
view.PointerMoved({this, &TooltipTracker::OnPointerMoved});
|
|
172
|
+
view.GotFocus({this, &TooltipTracker::OnGotFocus});
|
|
173
|
+
view.LostFocus({this, &TooltipTracker::OnLostFocus});
|
|
172
174
|
view.Unmounted({this, &TooltipTracker::OnUnmounted});
|
|
173
175
|
}
|
|
174
176
|
|
|
175
177
|
TooltipTracker::~TooltipTracker() {
|
|
176
178
|
DestroyTimer();
|
|
177
179
|
DestroyTooltip();
|
|
180
|
+
m_outer->NotifyDismiss(this);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
void TooltipTracker::DismissForExternalRequest() noexcept {
|
|
184
|
+
// Service is already updating its active slot; do not call back into it.
|
|
185
|
+
m_focusTooltip = false;
|
|
186
|
+
DestroyTimer();
|
|
187
|
+
DestroyTooltip();
|
|
178
188
|
}
|
|
179
189
|
|
|
180
190
|
facebook::react::Tag TooltipTracker::Tag() const noexcept {
|
|
@@ -192,6 +202,9 @@ void TooltipTracker::OnPointerEntered(
|
|
|
192
202
|
auto pp = args.GetCurrentPoint(-1);
|
|
193
203
|
m_pos = pp.Position();
|
|
194
204
|
|
|
205
|
+
// Claim the single tooltip slot, dismissing any other tracker's pending or visible tooltip.
|
|
206
|
+
m_outer->NotifyShow(this);
|
|
207
|
+
|
|
195
208
|
m_timer = winrt::Microsoft::ReactNative::Timer::Create(m_properties.Handle());
|
|
196
209
|
m_timer.Interval(std::chrono::milliseconds(toolTipTimeToShowMs));
|
|
197
210
|
m_timer.Tick({this, &TooltipTracker::OnTick});
|
|
@@ -225,6 +238,56 @@ void TooltipTracker::OnPointerExited(
|
|
|
225
238
|
return;
|
|
226
239
|
DestroyTimer();
|
|
227
240
|
DestroyTooltip();
|
|
241
|
+
m_outer->NotifyDismiss(this);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
void TooltipTracker::OnGotFocus(
|
|
245
|
+
const winrt::Windows::Foundation::IInspectable & /*sender*/,
|
|
246
|
+
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs & /*args*/) noexcept {
|
|
247
|
+
// Skip if a mouse-driven tooltip or its dwell timer is already in flight on this view.
|
|
248
|
+
if (m_hwndTip || m_timer) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
auto view = m_view.view();
|
|
253
|
+
if (!view) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
auto viewCompView = view.try_as<winrt::Microsoft::ReactNative::Composition::ViewComponentView>();
|
|
258
|
+
if (!viewCompView) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
auto selfView =
|
|
262
|
+
winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>(viewCompView);
|
|
263
|
+
RECT rc = selfView->getClientRect();
|
|
264
|
+
auto scaleFactor = view.LayoutMetrics().PointScaleFactor;
|
|
265
|
+
if (scaleFactor <= 0) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Anchor in DIPs at the horizontal center of the view's top edge; ShowTooltip re-applies scaleFactor.
|
|
270
|
+
m_pos = {static_cast<float>(rc.left + rc.right) / 2.0f / scaleFactor, static_cast<float>(rc.top) / scaleFactor};
|
|
271
|
+
|
|
272
|
+
m_focusTooltip = true;
|
|
273
|
+
// Claim the single tooltip slot, dismissing any other tracker's pending or visible tooltip.
|
|
274
|
+
m_outer->NotifyShow(this);
|
|
275
|
+
m_timer = winrt::Microsoft::ReactNative::Timer::Create(m_properties.Handle());
|
|
276
|
+
m_timer.Interval(std::chrono::milliseconds(toolTipTimeToShowMs));
|
|
277
|
+
m_timer.Tick({this, &TooltipTracker::OnTick});
|
|
278
|
+
m_timer.Start();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
void TooltipTracker::OnLostFocus(
|
|
282
|
+
const winrt::Windows::Foundation::IInspectable & /*sender*/,
|
|
283
|
+
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs & /*args*/) noexcept {
|
|
284
|
+
if (!m_focusTooltip) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
m_focusTooltip = false;
|
|
288
|
+
DestroyTimer();
|
|
289
|
+
DestroyTooltip();
|
|
290
|
+
m_outer->NotifyDismiss(this);
|
|
228
291
|
}
|
|
229
292
|
|
|
230
293
|
void TooltipTracker::OnUnmounted(
|
|
@@ -232,6 +295,7 @@ void TooltipTracker::OnUnmounted(
|
|
|
232
295
|
const winrt::Microsoft::ReactNative::ComponentView &) noexcept {
|
|
233
296
|
DestroyTimer();
|
|
234
297
|
DestroyTooltip();
|
|
298
|
+
m_outer->NotifyDismiss(this);
|
|
235
299
|
}
|
|
236
300
|
|
|
237
301
|
void TooltipTracker::ShowTooltip(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
@@ -326,6 +390,22 @@ void TooltipService::StopTracking(const winrt::Microsoft::ReactNative::Component
|
|
|
326
390
|
}
|
|
327
391
|
}
|
|
328
392
|
|
|
393
|
+
void TooltipService::NotifyShow(TooltipTracker *tracker) noexcept {
|
|
394
|
+
if (m_activeTracker == tracker) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (m_activeTracker) {
|
|
398
|
+
m_activeTracker->DismissForExternalRequest();
|
|
399
|
+
}
|
|
400
|
+
m_activeTracker = tracker;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
void TooltipService::NotifyDismiss(TooltipTracker *tracker) noexcept {
|
|
404
|
+
if (m_activeTracker == tracker) {
|
|
405
|
+
m_activeTracker = nullptr;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
329
409
|
static const ReactPropertyId<winrt::Microsoft::ReactNative::ReactNonAbiValue<std::shared_ptr<TooltipService>>>
|
|
330
410
|
&TooltipServicePropertyId() noexcept {
|
|
331
411
|
static const ReactPropertyId<winrt::Microsoft::ReactNative::ReactNonAbiValue<std::shared_ptr<TooltipService>>> prop{
|
|
@@ -27,6 +27,12 @@ struct TooltipTracker {
|
|
|
27
27
|
void OnPointerExited(
|
|
28
28
|
const winrt::Windows::Foundation::IInspectable &sender,
|
|
29
29
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept;
|
|
30
|
+
void OnGotFocus(
|
|
31
|
+
const winrt::Windows::Foundation::IInspectable &sender,
|
|
32
|
+
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept;
|
|
33
|
+
void OnLostFocus(
|
|
34
|
+
const winrt::Windows::Foundation::IInspectable &sender,
|
|
35
|
+
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept;
|
|
30
36
|
void OnTick(
|
|
31
37
|
const winrt::Windows::Foundation::IInspectable &,
|
|
32
38
|
const winrt::Windows::Foundation::IInspectable &) noexcept;
|
|
@@ -36,6 +42,10 @@ struct TooltipTracker {
|
|
|
36
42
|
|
|
37
43
|
facebook::react::Tag Tag() const noexcept;
|
|
38
44
|
|
|
45
|
+
// Cancel pending dwell timer and close any visible tooltip popup; used by the service when another tracker takes
|
|
46
|
+
// over.
|
|
47
|
+
void DismissForExternalRequest() noexcept;
|
|
48
|
+
|
|
39
49
|
private:
|
|
40
50
|
void ShowTooltip(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept;
|
|
41
51
|
void DestroyTimer() noexcept;
|
|
@@ -46,6 +56,7 @@ struct TooltipTracker {
|
|
|
46
56
|
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
47
57
|
winrt::Microsoft::ReactNative::ITimer m_timer;
|
|
48
58
|
HWND m_hwndTip{nullptr};
|
|
59
|
+
bool m_focusTooltip{false};
|
|
49
60
|
winrt::Microsoft::ReactNative::ReactPropertyBag m_properties;
|
|
50
61
|
};
|
|
51
62
|
|
|
@@ -54,12 +65,18 @@ struct TooltipService {
|
|
|
54
65
|
void StartTracking(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept;
|
|
55
66
|
void StopTracking(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept;
|
|
56
67
|
|
|
68
|
+
// Enforce "only one tooltip visible at a time": dismisses the previously active tracker, if any.
|
|
69
|
+
void NotifyShow(TooltipTracker *tracker) noexcept;
|
|
70
|
+
// Clears the active-tracker slot if it still points at `tracker`.
|
|
71
|
+
void NotifyDismiss(TooltipTracker *tracker) noexcept;
|
|
72
|
+
|
|
57
73
|
static std::shared_ptr<TooltipService> GetCurrent(
|
|
58
74
|
const winrt::Microsoft::ReactNative::ReactPropertyBag &properties) noexcept;
|
|
59
75
|
|
|
60
76
|
private:
|
|
61
77
|
std::vector<std::shared_ptr<TooltipTracker>> m_enteredTrackers;
|
|
62
78
|
std::vector<std::shared_ptr<TooltipTracker>> m_trackers;
|
|
79
|
+
TooltipTracker *m_activeTracker{nullptr};
|
|
63
80
|
winrt::Microsoft::ReactNative::ReactPropertyBag m_properties;
|
|
64
81
|
};
|
|
65
82
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.81.
|
|
13
|
+
<ReactNativeWindowsVersion>0.81.21</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>81</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>21</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>8620c45845172a7428e8d0e27037515b6382e5dd</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -37,6 +37,8 @@ struct ModalHostViewProps : winrt::implements<ModalHostViewProps, winrt::Microso
|
|
|
37
37
|
supportedOrientations = cloneFromProps->supportedOrientations;
|
|
38
38
|
identifier = cloneFromProps->identifier;
|
|
39
39
|
title = cloneFromProps->title;
|
|
40
|
+
hideTitleBar = cloneFromProps->hideTitleBar;
|
|
41
|
+
hideBorder = cloneFromProps->hideBorder;
|
|
40
42
|
onRequestClose = cloneFromProps->onRequestClose;
|
|
41
43
|
onShow = cloneFromProps->onShow;
|
|
42
44
|
onDismiss = cloneFromProps->onDismiss;
|
|
@@ -84,6 +86,12 @@ struct ModalHostViewProps : winrt::implements<ModalHostViewProps, winrt::Microso
|
|
|
84
86
|
REACT_FIELD(title)
|
|
85
87
|
std::optional<std::string> title;
|
|
86
88
|
|
|
89
|
+
REACT_FIELD(hideTitleBar)
|
|
90
|
+
std::optional<bool> hideTitleBar{};
|
|
91
|
+
|
|
92
|
+
REACT_FIELD(hideBorder)
|
|
93
|
+
std::optional<bool> hideBorder{};
|
|
94
|
+
|
|
87
95
|
// These fields can be used to determine if JS has registered for this event
|
|
88
96
|
REACT_FIELD(onRequestClose)
|
|
89
97
|
bool onRequestClose{false};
|
|
@@ -477,7 +477,9 @@ ModalHostViewProps::ModalHostViewProps(
|
|
|
477
477
|
allowSwipeDismissal(convertRawProp(context, rawProps, "allowSwipeDismissal", sourceProps.allowSwipeDismissal, {false})),
|
|
478
478
|
supportedOrientations(convertRawProp(context, rawProps, "supportedOrientations", ModalHostViewSupportedOrientationsMaskWrapped{ .value = sourceProps.supportedOrientations }, {static_cast<ModalHostViewSupportedOrientationsMask>(ModalHostViewSupportedOrientations::Portrait)}).value),
|
|
479
479
|
identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {0})),
|
|
480
|
-
title(convertRawProp(context, rawProps, "title", sourceProps.title, {}))
|
|
480
|
+
title(convertRawProp(context, rawProps, "title", sourceProps.title, {})),
|
|
481
|
+
hideTitleBar(convertRawProp(context, rawProps, "hideTitleBar", sourceProps.hideTitleBar, {false})),
|
|
482
|
+
hideBorder(convertRawProp(context, rawProps, "hideBorder", sourceProps.hideBorder, {false})) {}
|
|
481
483
|
|
|
482
484
|
#ifdef RN_SERIALIZABLE_STATE
|
|
483
485
|
ComponentName ModalHostViewProps::getDiffPropsImplementationTarget() const {
|
|
@@ -542,6 +544,14 @@ folly::dynamic ModalHostViewProps::getDiffProps(
|
|
|
542
544
|
if (title != oldProps->title) {
|
|
543
545
|
result["title"] = title;
|
|
544
546
|
}
|
|
547
|
+
|
|
548
|
+
if (hideTitleBar != oldProps->hideTitleBar) {
|
|
549
|
+
result["hideTitleBar"] = hideTitleBar;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (hideBorder != oldProps->hideBorder) {
|
|
553
|
+
result["hideBorder"] = hideBorder;
|
|
554
|
+
}
|
|
545
555
|
return result;
|
|
546
556
|
}
|
|
547
557
|
#endif
|
|
@@ -470,6 +470,8 @@ class ModalHostViewProps final : public ViewProps {
|
|
|
470
470
|
ModalHostViewSupportedOrientationsMask supportedOrientations{static_cast<ModalHostViewSupportedOrientationsMask>(ModalHostViewSupportedOrientations::Portrait)};
|
|
471
471
|
int identifier{0};
|
|
472
472
|
std::string title{};
|
|
473
|
+
bool hideTitleBar{false};
|
|
474
|
+
bool hideBorder{false};
|
|
473
475
|
|
|
474
476
|
#ifdef RN_SERIALIZABLE_STATE
|
|
475
477
|
ComponentName getDiffPropsImplementationTarget() const override;
|
package/package.json
CHANGED