stream-chat-react-native-core 9.7.1-beta.1 → 9.7.1-beta.2
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/lib/commonjs/components/Message/utils/measureInWindow.js +4 -2
- package/lib/commonjs/components/Message/utils/measureInWindow.js.map +1 -1
- package/lib/commonjs/mock-builders/DB/mock.js +2 -0
- package/lib/commonjs/mock-builders/DB/mock.js.map +1 -1
- package/lib/commonjs/utils/isRNVersionGreaterThanOrEqualTo.js +22 -0
- package/lib/commonjs/utils/isRNVersionGreaterThanOrEqualTo.js.map +1 -0
- package/lib/commonjs/utils/react-native-constants.js +7 -0
- package/lib/commonjs/utils/react-native-constants.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Message/utils/measureInWindow.js +4 -2
- package/lib/module/components/Message/utils/measureInWindow.js.map +1 -1
- package/lib/module/mock-builders/DB/mock.js +2 -0
- package/lib/module/mock-builders/DB/mock.js.map +1 -1
- package/lib/module/utils/isRNVersionGreaterThanOrEqualTo.js +22 -0
- package/lib/module/utils/isRNVersionGreaterThanOrEqualTo.js.map +1 -0
- package/lib/module/utils/react-native-constants.js +7 -0
- package/lib/module/utils/react-native-constants.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Message/utils/measureInWindow.d.ts.map +1 -1
- package/lib/typescript/utils/isRNVersionGreaterThanOrEqualTo.d.ts +9 -0
- package/lib/typescript/utils/isRNVersionGreaterThanOrEqualTo.d.ts.map +1 -0
- package/lib/typescript/utils/react-native-constants.d.ts +8 -0
- package/lib/typescript/utils/react-native-constants.d.ts.map +1 -0
- package/package.json +10 -10
- package/src/__tests__/offline-support/offline-feature.tsx +43 -34
- package/src/components/Message/utils/__tests__/measureInWindow.test.ts +41 -2
- package/src/components/Message/utils/measureInWindow.ts +14 -2
- package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.tsx.snap +15 -0
- package/src/components/MessageInput/__tests__/__snapshots__/SendButton.test.tsx.snap +10 -0
- package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.tsx.snap +1 -0
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.tsx.snap +6 -0
- package/src/mock-builders/DB/mock.ts +2 -0
- package/src/utils/__tests__/isRNVersionGreaterThanOrEqualTo.test.ts +60 -0
- package/src/utils/isRNVersionGreaterThanOrEqualTo.ts +27 -0
- package/src/utils/react-native-constants.ts +10 -0
- package/src/version.json +1 -1
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
});
|
|
4
4
|
exports.measureInWindow = exports.isMeasuredRectBogus = void 0;
|
|
5
5
|
var _reactNative = require("react-native");
|
|
6
|
+
var _reactNativeConstants = require("../../../utils/react-native-constants");
|
|
7
|
+
var androidTopInsetCompensation = insets => _reactNative.Platform.OS === 'android' && !_reactNativeConstants.isRN86OrGreater ? insets.top : 0;
|
|
6
8
|
var SCREEN_BOUND_MULTIPLIER = 2;
|
|
7
9
|
var isMeasuredRectBogus = (x, y, w, h) => {
|
|
8
10
|
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(w) || !Number.isFinite(h)) {
|
|
@@ -32,7 +34,7 @@ var measureInWindow = (node, insets) => {
|
|
|
32
34
|
h,
|
|
33
35
|
w,
|
|
34
36
|
x,
|
|
35
|
-
y: y + (
|
|
37
|
+
y: y + androidTopInsetCompensation(insets)
|
|
36
38
|
});
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
@@ -41,7 +43,7 @@ var measureInWindow = (node, insets) => {
|
|
|
41
43
|
h,
|
|
42
44
|
w,
|
|
43
45
|
x,
|
|
44
|
-
y: y + (
|
|
46
|
+
y: y + androidTopInsetCompensation(insets)
|
|
45
47
|
});
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","SCREEN_BOUND_MULTIPLIER","isMeasuredRectBogus","x","y","w","h","Number","isFinite","_Dimensions$get","Dimensions","get","width","height","Math","abs","exports","measureInWindow","node","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativeConstants","androidTopInsetCompensation","insets","Platform","OS","isRN86OrGreater","top","SCREEN_BOUND_MULTIPLIER","isMeasuredRectBogus","x","y","w","h","Number","isFinite","_Dimensions$get","Dimensions","get","width","height","Math","abs","exports","measureInWindow","node","Promise","resolve","reject","handle","current","Error","measure","_x","_y","pageX","pageY"],"sourceRoot":"../../../../../src","sources":["components/Message/utils/measureInWindow.ts"],"mappings":";;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,qBAAA,GAAAD,OAAA;AAWA,IAAME,2BAA2B,GAAIC,MAAkB,IACrDC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,CAACC,qCAAe,GAAGH,MAAM,CAACI,GAAG,GAAG,CAAC;AAQhE,IAAMC,uBAAuB,GAAG,CAAC;AAS1B,IAAMC,mBAAmB,GAAGA,CAACC,CAAS,EAAEC,CAAS,EAAEC,CAAS,EAAEC,CAAS,KAAc;EAC1F,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACL,CAAC,CAAC,IAAI,CAACI,MAAM,CAACC,QAAQ,CAACJ,CAAC,CAAC,IAAI,CAACG,MAAM,CAACC,QAAQ,CAACH,CAAC,CAAC,IAAI,CAACE,MAAM,CAACC,QAAQ,CAACF,CAAC,CAAC,EAAE;IAC5F,OAAO,IAAI;EACb;EACA,IAAID,CAAC,IAAI,CAAC,IAAIC,CAAC,IAAI,CAAC,EAAE;IACpB,OAAO,IAAI;EACb;EACA,IAAAG,eAAA,GAA0BC,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC;IAA1CC,KAAK,GAAAH,eAAA,CAALG,KAAK;IAAEC,MAAM,GAAAJ,eAAA,CAANI,MAAM;EACrB,IAAID,KAAK,IAAI,CAAC,IAAIC,MAAM,IAAI,CAAC,EAAE;IAE7B,OAAO,KAAK;EACd;EACA,OACEC,IAAI,CAAC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tD,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC;AAACb,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ var testDbName = `foobar-${process.env.JEST_WORKER_ID ?? '0'}.db`;
|
|
|
10
10
|
var sqliteMock = exports.sqliteMock = {
|
|
11
11
|
open: () => {
|
|
12
12
|
db = new _betterSqlite.default(testDbName);
|
|
13
|
+
db.pragma('journal_mode = MEMORY');
|
|
14
|
+
db.pragma('synchronous = OFF');
|
|
13
15
|
return {
|
|
14
16
|
close: () => {
|
|
15
17
|
db.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_betterSqlite","_interopRequireDefault","require","db","testDbName","process","env","JEST_WORKER_ID","sqliteMock","exports","open","Sqlite3","close","message","status","execute","_ref","_asyncToGenerator2","default","queryInput","params","query","trim","toLowerCase","stmt","prepare","result","indexOf","modifiedParams","map","p","Number","Promise","resolve","all","rows","pragmaQueryTokens","split","
|
|
1
|
+
{"version":3,"names":["_betterSqlite","_interopRequireDefault","require","db","testDbName","process","env","JEST_WORKER_ID","sqliteMock","exports","open","Sqlite3","pragma","close","message","status","execute","_ref","_asyncToGenerator2","default","queryInput","params","query","trim","toLowerCase","stmt","prepare","result","indexOf","modifiedParams","map","p","Number","Promise","resolve","all","rows","pragmaQueryTokens","split","run","undefined","_x","_x2","apply","arguments","executeBatch","_ref2","queriesArr","_loop","queryAndParams","staus","_x3"],"sourceRoot":"../../../../src","sources":["mock-builders/DB/mock.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAIC,EAAoB;AACxB,IAAMC,UAAU,GAAG,UAAUC,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,GAAG,KAAK;AAE5D,IAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,IAAI,EAAEA,CAAA,KAAM;IACVP,EAAE,G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Ib,MAAM,EAAE;gBACV,IAAMQ,cAAc,GAAGR,MAAM,CAACS,GAAG,CAAEC,CAAC,IAAM,OAAOA,CAAC,KAAK,SAAS,GAAGC,MAAM,CAACD,CAAC,CAAC,GAAGA,CAAE,CAAC;gBAClFN,IAAI,CAACc,GAAG,CAACV,cAAc,CAAC;cAC1B,CAAC,MAAM;gBACLJ,IAAI,CAACc,GAAG,CAAC,CAAC;cACZ;cACAL,OAAO,CAACM,SAAS,CAAC;YACpB,CAAC,CAAC;UACJ,CAAC;UAdD,KAAK,IAAMS,cAAc,IAAIF,UAAU;YAAA,OAAAC,KAAA;UAAA;UAgBvC,OAAO;YACLlC,OAAO,EAAE,EAAE;YACXoC,KAAK,EAAE;UACT,CAAC;QACH,CAAC;QAAA,gBArBDL,YAAYA,CAAAM,GAAA;UAAA,OAAAL,KAAA,CAAAH,KAAA,OAAAC,SAAA;QAAA;MAAA;IAsBd,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.isRNVersionGreaterThanOrEqualTo = void 0;
|
|
5
|
+
var _reactNative = require("react-native");
|
|
6
|
+
var isRNVersionGreaterThanOrEqualTo = version => {
|
|
7
|
+
var runtime = _reactNative.Platform.constants?.reactNativeVersion;
|
|
8
|
+
if (!runtime) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
var current = [runtime.major, runtime.minor, runtime.patch ?? 0];
|
|
12
|
+
var target = version.split('.').map(part => parseInt(part, 10) || 0);
|
|
13
|
+
for (var i = 0; i < current.length; i++) {
|
|
14
|
+
var wanted = target[i] ?? 0;
|
|
15
|
+
if (current[i] !== wanted) {
|
|
16
|
+
return current[i] > wanted;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
exports.isRNVersionGreaterThanOrEqualTo = isRNVersionGreaterThanOrEqualTo;
|
|
22
|
+
//# sourceMappingURL=isRNVersionGreaterThanOrEqualTo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","isRNVersionGreaterThanOrEqualTo","version","runtime","Platform","constants","reactNativeVersion","current","major","minor","patch","target","split","map","part","parseInt","i","length","wanted","exports"],"sourceRoot":"../../../src","sources":["utils/isRNVersionGreaterThanOrEqualTo.ts"],"mappings":";;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASO,IAAMC,+BAA+B,GAAIC,OAAe,IAAc;EAC3E,IAAMC,OAAO,GAAGC,qBAAQ,CAACC,SAAS,EAAEC,kBAAkB;EACtD,IAAI,CAACH,OAAO,EAAE;IACZ,OAAO,KAAK;EACd;EAEA,IAAMI,OAAO,GAAG,CAACJ,OAAO,CAACK,KAAK,EAAEL,OAAO,CAACM,KAAK,EAAEN,OAAO,CAACO,KAAK,IAAI,CAAC,CAAC;EAClE,IAAMC,MAAM,GAAGT,OAAO,CAACU,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAEC,IAAI,IAAKC,QAAQ,CAACD,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;EAExE,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGT,OAAO,CAACU,MAAM,EAAED,CAAC,EAAE,EAAE;IACvC,IAAME,MAAM,GAAGP,MAAM,CAACK,CAAC,CAAC,IAAI,CAAC;IAC7B,IAAIT,OAAO,CAACS,CAAC,CAAC,KAAKE,MAAM,EAAE;MACzB,OAAOX,OAAO,CAACS,CAAC,CAAC,GAAGE,MAAM;IAC5B;EACF;EAEA,OAAO,IAAI;AACb,CAAC;AAACC,OAAA,CAAAlB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.isRN86OrGreater = void 0;
|
|
5
|
+
var _isRNVersionGreaterThanOrEqualTo = require("./isRNVersionGreaterThanOrEqualTo");
|
|
6
|
+
var isRN86OrGreater = exports.isRN86OrGreater = (0, _isRNVersionGreaterThanOrEqualTo.isRNVersionGreaterThanOrEqualTo)('0.86.0');
|
|
7
|
+
//# sourceMappingURL=react-native-constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_isRNVersionGreaterThanOrEqualTo","require","isRN86OrGreater","exports","isRNVersionGreaterThanOrEqualTo"],"sourceRoot":"../../../src","sources":["utils/react-native-constants.ts"],"mappings":";;;;AAAA,IAAAA,gCAAA,GAAAC,OAAA;AASO,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,gEAA+B,EAAC,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
});
|
|
4
4
|
exports.measureInWindow = exports.isMeasuredRectBogus = void 0;
|
|
5
5
|
var _reactNative = require("react-native");
|
|
6
|
+
var _reactNativeConstants = require("../../../utils/react-native-constants");
|
|
7
|
+
var androidTopInsetCompensation = insets => _reactNative.Platform.OS === 'android' && !_reactNativeConstants.isRN86OrGreater ? insets.top : 0;
|
|
6
8
|
var SCREEN_BOUND_MULTIPLIER = 2;
|
|
7
9
|
var isMeasuredRectBogus = (x, y, w, h) => {
|
|
8
10
|
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(w) || !Number.isFinite(h)) {
|
|
@@ -32,7 +34,7 @@ var measureInWindow = (node, insets) => {
|
|
|
32
34
|
h,
|
|
33
35
|
w,
|
|
34
36
|
x,
|
|
35
|
-
y: y + (
|
|
37
|
+
y: y + androidTopInsetCompensation(insets)
|
|
36
38
|
});
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
@@ -41,7 +43,7 @@ var measureInWindow = (node, insets) => {
|
|
|
41
43
|
h,
|
|
42
44
|
w,
|
|
43
45
|
x,
|
|
44
|
-
y: y + (
|
|
46
|
+
y: y + androidTopInsetCompensation(insets)
|
|
45
47
|
});
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","SCREEN_BOUND_MULTIPLIER","isMeasuredRectBogus","x","y","w","h","Number","isFinite","_Dimensions$get","Dimensions","get","width","height","Math","abs","exports","measureInWindow","node","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativeConstants","androidTopInsetCompensation","insets","Platform","OS","isRN86OrGreater","top","SCREEN_BOUND_MULTIPLIER","isMeasuredRectBogus","x","y","w","h","Number","isFinite","_Dimensions$get","Dimensions","get","width","height","Math","abs","exports","measureInWindow","node","Promise","resolve","reject","handle","current","Error","measure","_x","_y","pageX","pageY"],"sourceRoot":"../../../../../src","sources":["components/Message/utils/measureInWindow.ts"],"mappings":";;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,qBAAA,GAAAD,OAAA;AAWA,IAAME,2BAA2B,GAAIC,MAAkB,IACrDC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,CAACC,qCAAe,GAAGH,MAAM,CAACI,GAAG,GAAG,CAAC;AAQhE,IAAMC,uBAAuB,GAAG,CAAC;AAS1B,IAAMC,mBAAmB,GAAGA,CAACC,CAAS,EAAEC,CAAS,EAAEC,CAAS,EAAEC,CAAS,KAAc;EAC1F,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACL,CAAC,CAAC,IAAI,CAACI,MAAM,CAACC,QAAQ,CAACJ,CAAC,CAAC,IAAI,CAACG,MAAM,CAACC,QAAQ,CAACH,CAAC,CAAC,IAAI,CAACE,MAAM,CAACC,QAAQ,CAACF,CAAC,CAAC,EAAE;IAC5F,OAAO,IAAI;EACb;EACA,IAAID,CAAC,IAAI,CAAC,IAAIC,CAAC,IAAI,CAAC,EAAE;IACpB,OAAO,IAAI;EACb;EACA,IAAAG,eAAA,GAA0BC,uBAAU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EAAE,EAAEC,EAAE,EAAEf,KAAK,EAAEC,MAAM,EAAEe,KAAK,EAAEC,KAAK,KAAK;QACtDT,OAAO,CAAC;UAAEd,CAAC,EAAEO,MAAM;UAAER,CAAC,EAAEO,KAAK;UAAET,CAAC,EAAEyB,KAAK;UAAExB,CAAC,EAAEyB;QAAM,CAAC,CAAC;MACtD,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC;AAACb,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ var testDbName = `foobar-${process.env.JEST_WORKER_ID ?? '0'}.db`;
|
|
|
10
10
|
var sqliteMock = exports.sqliteMock = {
|
|
11
11
|
open: () => {
|
|
12
12
|
db = new _betterSqlite.default(testDbName);
|
|
13
|
+
db.pragma('journal_mode = MEMORY');
|
|
14
|
+
db.pragma('synchronous = OFF');
|
|
13
15
|
return {
|
|
14
16
|
close: () => {
|
|
15
17
|
db.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_betterSqlite","_interopRequireDefault","require","db","testDbName","process","env","JEST_WORKER_ID","sqliteMock","exports","open","Sqlite3","close","message","status","execute","_ref","_asyncToGenerator2","default","queryInput","params","query","trim","toLowerCase","stmt","prepare","result","indexOf","modifiedParams","map","p","Number","Promise","resolve","all","rows","pragmaQueryTokens","split","
|
|
1
|
+
{"version":3,"names":["_betterSqlite","_interopRequireDefault","require","db","testDbName","process","env","JEST_WORKER_ID","sqliteMock","exports","open","Sqlite3","pragma","close","message","status","execute","_ref","_asyncToGenerator2","default","queryInput","params","query","trim","toLowerCase","stmt","prepare","result","indexOf","modifiedParams","map","p","Number","Promise","resolve","all","rows","pragmaQueryTokens","split","run","undefined","_x","_x2","apply","arguments","executeBatch","_ref2","queriesArr","_loop","queryAndParams","staus","_x3"],"sourceRoot":"../../../../src","sources":["mock-builders/DB/mock.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sB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,KAAK,GAAG2B,cAAc,CAAC,CAAC,CAAC;YAC/B,IAAM5B,MAAM,GAAG4B,cAAc,CAAC,CAAC,CAAC;YAChC,IAAMxB,IAAI,GAAGtB,EAAE,CAACuB,OAAO,CAACJ,KAAK,CAAC;YAE9B,MAAM,IAAIW,OAAO,CAAEC,OAAO,IAAK;cAC7B,IAAIb,MAAM,EAAE;gBACV,IAAMQ,cAAc,GAAGR,MAAM,CAACS,GAAG,CAAEC,CAAC,IAAM,OAAOA,CAAC,KAAK,SAAS,GAAGC,MAAM,CAACD,CAAC,CAAC,GAAGA,CAAE,CAAC;gBAClFN,IAAI,CAACc,GAAG,CAACV,cAAc,CAAC;cAC1B,CAAC,MAAM;gBACLJ,IAAI,CAACc,GAAG,CAAC,CAAC;cACZ;cACAL,OAAO,CAACM,SAAS,CAAC;YACpB,CAAC,CAAC;UACJ,CAAC;UAdD,KAAK,IAAMS,cAAc,IAAIF,UAAU;YAAA,OAAAC,KAAA;UAAA;UAgBvC,OAAO;YACLlC,OAAO,EAAE,EAAE;YACXoC,KAAK,EAAE;UACT,CAAC;QACH,CAAC;QAAA,gBArBDL,YAAYA,CAAAM,GAAA;UAAA,OAAAL,KAAA,CAAAH,KAAA,OAAAC,SAAA;QAAA;MAAA;IAsBd,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.isRNVersionGreaterThanOrEqualTo = void 0;
|
|
5
|
+
var _reactNative = require("react-native");
|
|
6
|
+
var isRNVersionGreaterThanOrEqualTo = version => {
|
|
7
|
+
var runtime = _reactNative.Platform.constants?.reactNativeVersion;
|
|
8
|
+
if (!runtime) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
var current = [runtime.major, runtime.minor, runtime.patch ?? 0];
|
|
12
|
+
var target = version.split('.').map(part => parseInt(part, 10) || 0);
|
|
13
|
+
for (var i = 0; i < current.length; i++) {
|
|
14
|
+
var wanted = target[i] ?? 0;
|
|
15
|
+
if (current[i] !== wanted) {
|
|
16
|
+
return current[i] > wanted;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
exports.isRNVersionGreaterThanOrEqualTo = isRNVersionGreaterThanOrEqualTo;
|
|
22
|
+
//# sourceMappingURL=isRNVersionGreaterThanOrEqualTo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","isRNVersionGreaterThanOrEqualTo","version","runtime","Platform","constants","reactNativeVersion","current","major","minor","patch","target","split","map","part","parseInt","i","length","wanted","exports"],"sourceRoot":"../../../src","sources":["utils/isRNVersionGreaterThanOrEqualTo.ts"],"mappings":";;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASO,IAAMC,+BAA+B,GAAIC,OAAe,IAAc;EAC3E,IAAMC,OAAO,GAAGC,qBAAQ,CAACC,SAAS,EAAEC,kBAAkB;EACtD,IAAI,CAACH,OAAO,EAAE;IACZ,OAAO,KAAK;EACd;EAEA,IAAMI,OAAO,GAAG,CAACJ,OAAO,CAACK,KAAK,EAAEL,OAAO,CAACM,KAAK,EAAEN,OAAO,CAACO,KAAK,IAAI,CAAC,CAAC;EAClE,IAAMC,MAAM,GAAGT,OAAO,CAACU,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAEC,IAAI,IAAKC,QAAQ,CAACD,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;EAExE,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGT,OAAO,CAACU,MAAM,EAAED,CAAC,EAAE,EAAE;IACvC,IAAME,MAAM,GAAGP,MAAM,CAACK,CAAC,CAAC,IAAI,CAAC;IAC7B,IAAIT,OAAO,CAACS,CAAC,CAAC,KAAKE,MAAM,EAAE;MACzB,OAAOX,OAAO,CAACS,CAAC,CAAC,GAAGE,MAAM;IAC5B;EACF;EAEA,OAAO,IAAI;AACb,CAAC;AAACC,OAAA,CAAAlB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.isRN86OrGreater = void 0;
|
|
5
|
+
var _isRNVersionGreaterThanOrEqualTo = require("./isRNVersionGreaterThanOrEqualTo");
|
|
6
|
+
var isRN86OrGreater = exports.isRN86OrGreater = (0, _isRNVersionGreaterThanOrEqualTo.isRNVersionGreaterThanOrEqualTo)('0.86.0');
|
|
7
|
+
//# sourceMappingURL=react-native-constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_isRNVersionGreaterThanOrEqualTo","require","isRN86OrGreater","exports","isRNVersionGreaterThanOrEqualTo"],"sourceRoot":"../../../src","sources":["utils/react-native-constants.ts"],"mappings":";;;;AAAA,IAAAA,gCAAA,GAAAC,OAAA;AASO,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,gEAA+B,EAAC,QAAQ,CAAC","ignoreList":[]}
|
package/lib/module/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measureInWindow.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/utils/measureInWindow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"measureInWindow.d.ts","sourceRoot":"","sources":["../../../../../src/components/Message/utils/measureInWindow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAI5D,KAAK,YAAY,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAoBnE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,OAehF,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,MAAM,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,EAClC,QAAQ,UAAU,KACjB,OAAO,CAAC,YAAY,CA6BtB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns `true` when the running React Native version is greater than or equal to `version`
|
|
3
|
+
* (a `'major.minor.patch'` string, e.g. `'0.86.0'`), comparing major, then minor, then patch.
|
|
4
|
+
*
|
|
5
|
+
* Falls back to `false` when the version is unavailable (e.g. react-native-web) — callers should
|
|
6
|
+
* treat that as "assume an older React Native".
|
|
7
|
+
*/
|
|
8
|
+
export declare const isRNVersionGreaterThanOrEqualTo: (version: string) => boolean;
|
|
9
|
+
//# sourceMappingURL=isRNVersionGreaterThanOrEqualTo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isRNVersionGreaterThanOrEqualTo.d.ts","sourceRoot":"","sources":["../../../src/utils/isRNVersionGreaterThanOrEqualTo.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,GAAI,SAAS,MAAM,KAAG,OAiBjE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native capability flags, resolved once at module load - the RN version is fixed for the
|
|
3
|
+
* lifetime of the app. Keeping version gates as named flags here makes them easy to mock in tests
|
|
4
|
+
* and easy to retire later: when the SDK's minimum supported React Native reaches a baseline, grep
|
|
5
|
+
* for the flag to find every gated code path and delete both the flag and the branches it guarded.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isRN86OrGreater: boolean;
|
|
8
|
+
//# sourceMappingURL=react-native-constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-native-constants.d.ts","sourceRoot":"","sources":["../../../src/utils/react-native-constants.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,eAAO,MAAM,eAAe,SAA4C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "9.7.1-beta.
|
|
4
|
+
"version": "9.7.1-beta.2",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -111,11 +111,11 @@
|
|
|
111
111
|
"devDependencies": {
|
|
112
112
|
"@babel/core": "^7.29.0",
|
|
113
113
|
"@babel/runtime": "^7.29.2",
|
|
114
|
-
"@op-engineering/op-sqlite": "^
|
|
114
|
+
"@op-engineering/op-sqlite": "^17.1.2",
|
|
115
115
|
"@react-native-community/netinfo": "^12.0.1",
|
|
116
|
-
"@react-native/babel-preset": "0.
|
|
117
|
-
"@react-native/jest-preset": "0.
|
|
118
|
-
"@shopify/flash-list": "^2.3.
|
|
116
|
+
"@react-native/babel-preset": "0.86.0",
|
|
117
|
+
"@react-native/jest-preset": "0.86.0",
|
|
118
|
+
"@shopify/flash-list": "^2.3.2",
|
|
119
119
|
"@testing-library/jest-native": "^5.4.3",
|
|
120
120
|
"@testing-library/react-native": "13.2.0",
|
|
121
121
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
@@ -138,14 +138,14 @@
|
|
|
138
138
|
"jest": "^30.4.2",
|
|
139
139
|
"moment-timezone": "^0.6.0",
|
|
140
140
|
"react": "19.2.3",
|
|
141
|
-
"react-native": "0.
|
|
141
|
+
"react-native": "0.86.0",
|
|
142
142
|
"react-native-builder-bob": "0.40.11",
|
|
143
|
-
"react-native-gesture-handler": "^3.
|
|
144
|
-
"react-native-reanimated": "^4.
|
|
143
|
+
"react-native-gesture-handler": "^3.1.0",
|
|
144
|
+
"react-native-reanimated": "^4.5.2",
|
|
145
145
|
"react-native-safe-area-context": "^5.8.0",
|
|
146
146
|
"react-native-svg": "15.15.5",
|
|
147
|
-
"react-native-teleport": "^1.1.
|
|
148
|
-
"react-native-worklets": "^0.
|
|
147
|
+
"react-native-teleport": "^1.1.12",
|
|
148
|
+
"react-native-worklets": "^0.11.1",
|
|
149
149
|
"react-test-renderer": "19.2.3",
|
|
150
150
|
"rimraf": "^6.0.1",
|
|
151
151
|
"typescript": "5.9.3",
|
|
@@ -257,8 +257,8 @@ export const Generic = () => {
|
|
|
257
257
|
} as ChannelFilters;
|
|
258
258
|
const sort: ChannelSort = { last_updated: 1 };
|
|
259
259
|
|
|
260
|
-
const renderComponent = () =>
|
|
261
|
-
render(
|
|
260
|
+
const renderComponent = async () => {
|
|
261
|
+
const result = render(
|
|
262
262
|
<Chat client={chatClient} enableOfflineSupport>
|
|
263
263
|
<WithComponents overrides={{ ChannelPreview: ChannelPreviewComponent }}>
|
|
264
264
|
<ChannelList filters={filters} sort={sort} swipeActionsEnabled={false} />
|
|
@@ -266,6 +266,15 @@ export const Generic = () => {
|
|
|
266
266
|
</Chat>,
|
|
267
267
|
);
|
|
268
268
|
|
|
269
|
+
await waitFor(async () => {
|
|
270
|
+
const tablesInDb = (await BetterSqlite.getTables()) as Array<{ name: string }>;
|
|
271
|
+
const tableNamesInDB = tablesInDb.map((table) => table.name);
|
|
272
|
+
expect(Object.keys(tables).every((name) => tableNamesInDB.includes(name))).toBe(true);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
return result;
|
|
276
|
+
};
|
|
277
|
+
|
|
269
278
|
const expectCIDsOnUIToBeInDB = async (
|
|
270
279
|
queryAllByLabelText: typeof screen.queryAllByLabelText,
|
|
271
280
|
) => {
|
|
@@ -365,7 +374,7 @@ export const Generic = () => {
|
|
|
365
374
|
|
|
366
375
|
it('should store filter-sort query and cids on ChannelList in channelQueries table', async () => {
|
|
367
376
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
368
|
-
renderComponent();
|
|
377
|
+
await renderComponent();
|
|
369
378
|
|
|
370
379
|
await act(() => dispatchConnectionChangedEvent(chatClient, false));
|
|
371
380
|
// await waiter();
|
|
@@ -381,7 +390,7 @@ export const Generic = () => {
|
|
|
381
390
|
it('should store channels and its state in tables', async () => {
|
|
382
391
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
383
392
|
|
|
384
|
-
renderComponent();
|
|
393
|
+
await renderComponent();
|
|
385
394
|
|
|
386
395
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
387
396
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
@@ -400,7 +409,7 @@ export const Generic = () => {
|
|
|
400
409
|
useMockedApis(chatClient, [queryChannelsApi([emptyChannel])]);
|
|
401
410
|
jest.spyOn(chatClient, 'hydrateActiveChannels');
|
|
402
411
|
|
|
403
|
-
renderComponent();
|
|
412
|
+
await renderComponent();
|
|
404
413
|
|
|
405
414
|
await waitFor(async () => {
|
|
406
415
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
@@ -415,7 +424,7 @@ export const Generic = () => {
|
|
|
415
424
|
it('should add a new message to database', async () => {
|
|
416
425
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
417
426
|
|
|
418
|
-
renderComponent();
|
|
427
|
+
await renderComponent();
|
|
419
428
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
420
429
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
421
430
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -444,7 +453,7 @@ export const Generic = () => {
|
|
|
444
453
|
it('should correctly handle multiple new messages and add them to the database', async () => {
|
|
445
454
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
446
455
|
|
|
447
|
-
renderComponent();
|
|
456
|
+
await renderComponent();
|
|
448
457
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
449
458
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
450
459
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -506,7 +515,7 @@ export const Generic = () => {
|
|
|
506
515
|
it('should correctly handle multiple new messages from our own user', async () => {
|
|
507
516
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
508
517
|
|
|
509
|
-
renderComponent();
|
|
518
|
+
await renderComponent();
|
|
510
519
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
511
520
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
512
521
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -568,7 +577,7 @@ export const Generic = () => {
|
|
|
568
577
|
it('should add a new channel and a new message to database from notification event', async () => {
|
|
569
578
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
570
579
|
|
|
571
|
-
renderComponent();
|
|
580
|
+
await renderComponent();
|
|
572
581
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
573
582
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
574
583
|
await waitFor(() => {
|
|
@@ -609,7 +618,7 @@ export const Generic = () => {
|
|
|
609
618
|
it('should update a message in database', async () => {
|
|
610
619
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
611
620
|
|
|
612
|
-
renderComponent();
|
|
621
|
+
await renderComponent();
|
|
613
622
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
614
623
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
615
624
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -637,7 +646,7 @@ export const Generic = () => {
|
|
|
637
646
|
it('should remove the channel from DB when user is removed as member', async () => {
|
|
638
647
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
639
648
|
|
|
640
|
-
renderComponent();
|
|
649
|
+
await renderComponent();
|
|
641
650
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
642
651
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
643
652
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -671,7 +680,7 @@ export const Generic = () => {
|
|
|
671
680
|
it('should remove the channel from DB if the channel is deleted', async () => {
|
|
672
681
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
673
682
|
|
|
674
|
-
renderComponent();
|
|
683
|
+
await renderComponent();
|
|
675
684
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
676
685
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
677
686
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -705,7 +714,7 @@ export const Generic = () => {
|
|
|
705
714
|
it('should correctly mark the channel as hidden in the db', async () => {
|
|
706
715
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
707
716
|
|
|
708
|
-
renderComponent();
|
|
717
|
+
await renderComponent();
|
|
709
718
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
710
719
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
711
720
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -739,7 +748,7 @@ export const Generic = () => {
|
|
|
739
748
|
it('should correctly mark the channel as visible if it was hidden before in the db', async () => {
|
|
740
749
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
741
750
|
|
|
742
|
-
renderComponent();
|
|
751
|
+
await renderComponent();
|
|
743
752
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
744
753
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
745
754
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -800,7 +809,7 @@ export const Generic = () => {
|
|
|
800
809
|
it('should add the channel to DB when user is added as member', async () => {
|
|
801
810
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
802
811
|
|
|
803
|
-
renderComponent();
|
|
812
|
+
await renderComponent();
|
|
804
813
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
805
814
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
806
815
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -838,7 +847,7 @@ export const Generic = () => {
|
|
|
838
847
|
it('should remove the channel messages from DB when channel is truncated', async () => {
|
|
839
848
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
840
849
|
|
|
841
|
-
renderComponent();
|
|
850
|
+
await renderComponent();
|
|
842
851
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
843
852
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
844
853
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -874,7 +883,7 @@ export const Generic = () => {
|
|
|
874
883
|
it('should truncate the correct messages if channel.truncated arrives with truncated_at', async () => {
|
|
875
884
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
876
885
|
|
|
877
|
-
renderComponent();
|
|
886
|
+
await renderComponent();
|
|
878
887
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
879
888
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
880
889
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -926,7 +935,7 @@ export const Generic = () => {
|
|
|
926
935
|
it('should gracefully handle a truncated_at date before each message', async () => {
|
|
927
936
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
928
937
|
|
|
929
|
-
renderComponent();
|
|
938
|
+
await renderComponent();
|
|
930
939
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
931
940
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
932
941
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -962,7 +971,7 @@ export const Generic = () => {
|
|
|
962
971
|
it('should gracefully handle a truncated_at date after each message', async () => {
|
|
963
972
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
964
973
|
|
|
965
|
-
renderComponent();
|
|
974
|
+
await renderComponent();
|
|
966
975
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
967
976
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
968
977
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1004,7 +1013,7 @@ export const Generic = () => {
|
|
|
1004
1013
|
|
|
1005
1014
|
it('should add a reaction to DB when a new reaction is added', async () => {
|
|
1006
1015
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1007
|
-
renderComponent();
|
|
1016
|
+
await renderComponent();
|
|
1008
1017
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1009
1018
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1010
1019
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1049,7 +1058,7 @@ export const Generic = () => {
|
|
|
1049
1058
|
|
|
1050
1059
|
it('should correctly add multiple reactions to the DB', async () => {
|
|
1051
1060
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1052
|
-
renderComponent();
|
|
1061
|
+
await renderComponent();
|
|
1053
1062
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1054
1063
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1055
1064
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1136,7 +1145,7 @@ export const Generic = () => {
|
|
|
1136
1145
|
|
|
1137
1146
|
it('should gracefully handle multiple reaction.new events of the same type for the same user', async () => {
|
|
1138
1147
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1139
|
-
renderComponent();
|
|
1148
|
+
await renderComponent();
|
|
1140
1149
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1141
1150
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1142
1151
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1205,7 +1214,7 @@ export const Generic = () => {
|
|
|
1205
1214
|
it('should remove a reaction from DB when reaction is deleted', async () => {
|
|
1206
1215
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1207
1216
|
|
|
1208
|
-
renderComponent();
|
|
1217
|
+
await renderComponent();
|
|
1209
1218
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1210
1219
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1211
1220
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1259,7 +1268,7 @@ export const Generic = () => {
|
|
|
1259
1268
|
it('should update a reaction in DB when reaction is updated', async () => {
|
|
1260
1269
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1261
1270
|
|
|
1262
|
-
renderComponent();
|
|
1271
|
+
await renderComponent();
|
|
1263
1272
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1264
1273
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1265
1274
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1296,7 +1305,7 @@ export const Generic = () => {
|
|
|
1296
1305
|
|
|
1297
1306
|
it('should correctly upsert reactions when enforce_unique is true', async () => {
|
|
1298
1307
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1299
|
-
renderComponent();
|
|
1308
|
+
await renderComponent();
|
|
1300
1309
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1301
1310
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1302
1311
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1396,7 +1405,7 @@ export const Generic = () => {
|
|
|
1396
1405
|
|
|
1397
1406
|
it('should also update the corresponding message.reaction_groups with reaction.new', async () => {
|
|
1398
1407
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1399
|
-
renderComponent();
|
|
1408
|
+
await renderComponent();
|
|
1400
1409
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1401
1410
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1402
1411
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1455,7 +1464,7 @@ export const Generic = () => {
|
|
|
1455
1464
|
|
|
1456
1465
|
it('should also update the corresponding message.reaction_groups with reaction.updated', async () => {
|
|
1457
1466
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1458
|
-
renderComponent();
|
|
1467
|
+
await renderComponent();
|
|
1459
1468
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1460
1469
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1461
1470
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1512,7 +1521,7 @@ export const Generic = () => {
|
|
|
1512
1521
|
|
|
1513
1522
|
it('should also update the corresponding message.reaction_groups with reaction.deleted', async () => {
|
|
1514
1523
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1515
|
-
renderComponent();
|
|
1524
|
+
await renderComponent();
|
|
1516
1525
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1517
1526
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1518
1527
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1569,7 +1578,7 @@ export const Generic = () => {
|
|
|
1569
1578
|
|
|
1570
1579
|
it('should add a member to DB when a new member is added to channel', async () => {
|
|
1571
1580
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1572
|
-
renderComponent();
|
|
1581
|
+
await renderComponent();
|
|
1573
1582
|
|
|
1574
1583
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1575
1584
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
@@ -1592,7 +1601,7 @@ export const Generic = () => {
|
|
|
1592
1601
|
it('should remove a member from DB when a member is removed from channel', async () => {
|
|
1593
1602
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1594
1603
|
|
|
1595
|
-
renderComponent();
|
|
1604
|
+
await renderComponent();
|
|
1596
1605
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1597
1606
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1598
1607
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1614,7 +1623,7 @@ export const Generic = () => {
|
|
|
1614
1623
|
it('should update the member in DB when a member of a channel is updated', async () => {
|
|
1615
1624
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1616
1625
|
|
|
1617
|
-
renderComponent();
|
|
1626
|
+
await renderComponent();
|
|
1618
1627
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1619
1628
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1620
1629
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1641,7 +1650,7 @@ export const Generic = () => {
|
|
|
1641
1650
|
it('should update the channel data in DB when a channel is updated', async () => {
|
|
1642
1651
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1643
1652
|
|
|
1644
|
-
renderComponent();
|
|
1653
|
+
await renderComponent();
|
|
1645
1654
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1646
1655
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1647
1656
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1667,7 +1676,7 @@ export const Generic = () => {
|
|
|
1667
1676
|
it('should update reads in DB when channel is read', async () => {
|
|
1668
1677
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1669
1678
|
|
|
1670
|
-
renderComponent();
|
|
1679
|
+
await renderComponent();
|
|
1671
1680
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1672
1681
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1673
1682
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -1715,7 +1724,7 @@ export const Generic = () => {
|
|
|
1715
1724
|
it('should update reads in DB when a channel is marked as unread', async () => {
|
|
1716
1725
|
useMockedApis(chatClient, [queryChannelsApi(channels)]);
|
|
1717
1726
|
|
|
1718
|
-
renderComponent();
|
|
1727
|
+
await renderComponent();
|
|
1719
1728
|
act(() => dispatchConnectionChangedEvent(chatClient));
|
|
1720
1729
|
await act(async () => await getSyncManager(chatClient).invokeSyncStatusListeners(true));
|
|
1721
1730
|
await waitFor(() => expect(screen.getByTestId('channel-list-view')).toBeTruthy());
|
|
@@ -8,6 +8,18 @@ import { isMeasuredRectBogus, measureInWindow } from '../measureInWindow';
|
|
|
8
8
|
// measurement; this suite exercises the real implementation.
|
|
9
9
|
jest.unmock('../measureInWindow');
|
|
10
10
|
|
|
11
|
+
// measureInWindow reads `isRN86OrGreater` as a live binding at call time, so mocking the constants
|
|
12
|
+
// module with a mutable flag lets us exercise both the "RN handles the inset" and "we compensate"
|
|
13
|
+
// branches without reimporting. (Flag is `mock`-prefixed as jest requires for values referenced
|
|
14
|
+
// inside a mock factory.)
|
|
15
|
+
let mockIsRN86OrGreater = false;
|
|
16
|
+
jest.mock('../../../../utils/react-native-constants', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
get isRN86OrGreater() {
|
|
19
|
+
return mockIsRN86OrGreater;
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
|
|
11
23
|
// screen 400x800 => bogus threshold is |x| > 800 and |y| > 1600 (2x each)
|
|
12
24
|
const SCREEN = { fontScale: 1, height: 800, scale: 2, width: 400 };
|
|
13
25
|
const INSETS: EdgeInsets = { bottom: 10, left: 0, right: 0, top: 24 };
|
|
@@ -115,6 +127,7 @@ describe('measureInWindow', () => {
|
|
|
115
127
|
afterEach(() => {
|
|
116
128
|
jest.restoreAllMocks();
|
|
117
129
|
setPlatform(originalOS);
|
|
130
|
+
mockIsRN86OrGreater = false;
|
|
118
131
|
});
|
|
119
132
|
|
|
120
133
|
it('rejects when the node is not mounted', async () => {
|
|
@@ -133,8 +146,9 @@ describe('measureInWindow', () => {
|
|
|
133
146
|
});
|
|
134
147
|
});
|
|
135
148
|
|
|
136
|
-
it('compensates by insets.top on Android', async () => {
|
|
149
|
+
it('compensates by insets.top on Android below RN 0.86', async () => {
|
|
137
150
|
setPlatform('android');
|
|
151
|
+
mockIsRN86OrGreater = false;
|
|
138
152
|
const node = makeNode({ measureInWindow: [10, 300, 200, 40] });
|
|
139
153
|
await expect(measureInWindow(node, INSETS)).resolves.toEqual({
|
|
140
154
|
h: 40,
|
|
@@ -143,6 +157,18 @@ describe('measureInWindow', () => {
|
|
|
143
157
|
y: 324,
|
|
144
158
|
});
|
|
145
159
|
});
|
|
160
|
+
|
|
161
|
+
it('does not compensate on Android from RN 0.86 onward (RN corrects the inset natively)', async () => {
|
|
162
|
+
setPlatform('android');
|
|
163
|
+
mockIsRN86OrGreater = true;
|
|
164
|
+
const node = makeNode({ measureInWindow: [10, 300, 200, 40] });
|
|
165
|
+
await expect(measureInWindow(node, INSETS)).resolves.toEqual({
|
|
166
|
+
h: 40,
|
|
167
|
+
w: 200,
|
|
168
|
+
x: 10,
|
|
169
|
+
y: 300,
|
|
170
|
+
});
|
|
171
|
+
});
|
|
146
172
|
});
|
|
147
173
|
|
|
148
174
|
describe('bogus measurement (measure() fallback)', () => {
|
|
@@ -164,8 +190,9 @@ describe('measureInWindow', () => {
|
|
|
164
190
|
await expect(measureInWindow(node, INSETS)).resolves.toEqual({ h: 36, w: 64, x: 12, y: 717 });
|
|
165
191
|
});
|
|
166
192
|
|
|
167
|
-
it('returns the compensated window rect when no measure() fallback is available', async () => {
|
|
193
|
+
it('returns the compensated window rect when no measure() fallback is available (RN < 0.86)', async () => {
|
|
168
194
|
setPlatform('android');
|
|
195
|
+
mockIsRN86OrGreater = false;
|
|
169
196
|
const node = makeNode({ measureInWindow: [28903, 29088, 64, 36] });
|
|
170
197
|
await expect(measureInWindow(node, INSETS)).resolves.toEqual({
|
|
171
198
|
h: 36,
|
|
@@ -174,5 +201,17 @@ describe('measureInWindow', () => {
|
|
|
174
201
|
y: 29112,
|
|
175
202
|
});
|
|
176
203
|
});
|
|
204
|
+
|
|
205
|
+
it('returns the uncompensated window rect when no measure() fallback is available (RN >= 0.86)', async () => {
|
|
206
|
+
setPlatform('android');
|
|
207
|
+
mockIsRN86OrGreater = true;
|
|
208
|
+
const node = makeNode({ measureInWindow: [28903, 29088, 64, 36] });
|
|
209
|
+
await expect(measureInWindow(node, INSETS)).resolves.toEqual({
|
|
210
|
+
h: 36,
|
|
211
|
+
w: 64,
|
|
212
|
+
x: 28903,
|
|
213
|
+
y: 29088,
|
|
214
|
+
});
|
|
215
|
+
});
|
|
177
216
|
});
|
|
178
217
|
});
|
|
@@ -2,8 +2,20 @@ import React from 'react';
|
|
|
2
2
|
import { Dimensions, Platform, View } from 'react-native';
|
|
3
3
|
import { EdgeInsets } from 'react-native-safe-area-context';
|
|
4
4
|
|
|
5
|
+
import { isRN86OrGreater } from '../../../utils/react-native-constants';
|
|
6
|
+
|
|
5
7
|
type MeasuredRect = { x: number; y: number; w: number; h: number };
|
|
6
8
|
|
|
9
|
+
/**
|
|
10
|
+
* On Android, `measureInWindow` historically did not account for the top inset, so we added it
|
|
11
|
+
* ourselves. React Native 0.86 fixed this upstream as part of its edge-to-edge rework and now
|
|
12
|
+
* returns topInset corrected window coordinates. On >= 0.86 adding it again double counts the
|
|
13
|
+
* inset and offsets every measured view down by `insets.top`, so we only compensate on Android
|
|
14
|
+
* running React Native below 0.86.
|
|
15
|
+
*/
|
|
16
|
+
const androidTopInsetCompensation = (insets: EdgeInsets): number =>
|
|
17
|
+
Platform.OS === 'android' && !isRN86OrGreater ? insets.top : 0;
|
|
18
|
+
|
|
7
19
|
/**
|
|
8
20
|
* How many screen lengths away from the origin a measured coordinate may fall before we treat it as
|
|
9
21
|
* bogus. Real targets (a view currently on screen) always measure well within one screen and the failure
|
|
@@ -50,7 +62,7 @@ export const measureInWindow = (
|
|
|
50
62
|
|
|
51
63
|
handle.measureInWindow((x, y, w, h) => {
|
|
52
64
|
if (!isMeasuredRectBogus(x, y, w, h)) {
|
|
53
|
-
resolve({ h, w, x, y: y + (
|
|
65
|
+
resolve({ h, w, x, y: y + androidTopInsetCompensation(insets) });
|
|
54
66
|
return;
|
|
55
67
|
}
|
|
56
68
|
|
|
@@ -59,7 +71,7 @@ export const measureInWindow = (
|
|
|
59
71
|
// They will stays correct when the window frame has been mutated out from under
|
|
60
72
|
// React Native.
|
|
61
73
|
if (typeof handle.measure !== 'function') {
|
|
62
|
-
resolve({ h, w, x, y: y + (
|
|
74
|
+
resolve({ h, w, x, y: y + androidTopInsetCompensation(insets) });
|
|
63
75
|
return;
|
|
64
76
|
}
|
|
65
77
|
|
|
@@ -47,6 +47,7 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
|
|
|
47
47
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
48
48
|
onGestureHandlerStateChange={[Function]}
|
|
49
49
|
onGestureHandlerTouchEvent={[Function]}
|
|
50
|
+
onStartShouldSetResponder={[Function]}
|
|
50
51
|
pointerEvents="box-none"
|
|
51
52
|
style={
|
|
52
53
|
{
|
|
@@ -221,6 +222,7 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
|
|
|
221
222
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
222
223
|
onGestureHandlerStateChange={[Function]}
|
|
223
224
|
onGestureHandlerTouchEvent={[Function]}
|
|
225
|
+
onStartShouldSetResponder={[Function]}
|
|
224
226
|
pointerEvents="box-none"
|
|
225
227
|
style={
|
|
226
228
|
{
|
|
@@ -368,6 +370,7 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
|
|
|
368
370
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
369
371
|
onGestureHandlerStateChange={[Function]}
|
|
370
372
|
onGestureHandlerTouchEvent={[Function]}
|
|
373
|
+
onStartShouldSetResponder={[Function]}
|
|
371
374
|
pointerEvents="box-none"
|
|
372
375
|
style={
|
|
373
376
|
{
|
|
@@ -544,6 +547,7 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
|
|
|
544
547
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
545
548
|
onGestureHandlerStateChange={[Function]}
|
|
546
549
|
onGestureHandlerTouchEvent={[Function]}
|
|
550
|
+
onStartShouldSetResponder={[Function]}
|
|
547
551
|
pointerEvents="box-none"
|
|
548
552
|
style={
|
|
549
553
|
{
|
|
@@ -687,6 +691,7 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
|
|
|
687
691
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
688
692
|
onGestureHandlerStateChange={[Function]}
|
|
689
693
|
onGestureHandlerTouchEvent={[Function]}
|
|
694
|
+
onStartShouldSetResponder={[Function]}
|
|
690
695
|
pointerEvents="box-none"
|
|
691
696
|
style={
|
|
692
697
|
{
|
|
@@ -963,6 +968,7 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
|
|
|
963
968
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
964
969
|
onGestureHandlerStateChange={[Function]}
|
|
965
970
|
onGestureHandlerTouchEvent={[Function]}
|
|
971
|
+
onStartShouldSetResponder={[Function]}
|
|
966
972
|
pointerEvents="box-none"
|
|
967
973
|
style={
|
|
968
974
|
{
|
|
@@ -1137,6 +1143,7 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
|
|
|
1137
1143
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1138
1144
|
onGestureHandlerStateChange={[Function]}
|
|
1139
1145
|
onGestureHandlerTouchEvent={[Function]}
|
|
1146
|
+
onStartShouldSetResponder={[Function]}
|
|
1140
1147
|
pointerEvents="box-none"
|
|
1141
1148
|
style={
|
|
1142
1149
|
{
|
|
@@ -1284,6 +1291,7 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
|
|
|
1284
1291
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1285
1292
|
onGestureHandlerStateChange={[Function]}
|
|
1286
1293
|
onGestureHandlerTouchEvent={[Function]}
|
|
1294
|
+
onStartShouldSetResponder={[Function]}
|
|
1287
1295
|
pointerEvents="box-none"
|
|
1288
1296
|
style={
|
|
1289
1297
|
{
|
|
@@ -1460,6 +1468,7 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
|
|
|
1460
1468
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1461
1469
|
onGestureHandlerStateChange={[Function]}
|
|
1462
1470
|
onGestureHandlerTouchEvent={[Function]}
|
|
1471
|
+
onStartShouldSetResponder={[Function]}
|
|
1463
1472
|
pointerEvents="box-none"
|
|
1464
1473
|
style={
|
|
1465
1474
|
{
|
|
@@ -1603,6 +1612,7 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
|
|
|
1603
1612
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1604
1613
|
onGestureHandlerStateChange={[Function]}
|
|
1605
1614
|
onGestureHandlerTouchEvent={[Function]}
|
|
1615
|
+
onStartShouldSetResponder={[Function]}
|
|
1606
1616
|
pointerEvents="box-none"
|
|
1607
1617
|
style={
|
|
1608
1618
|
{
|
|
@@ -1879,6 +1889,7 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
|
|
|
1879
1889
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1880
1890
|
onGestureHandlerStateChange={[Function]}
|
|
1881
1891
|
onGestureHandlerTouchEvent={[Function]}
|
|
1892
|
+
onStartShouldSetResponder={[Function]}
|
|
1882
1893
|
pointerEvents="box-none"
|
|
1883
1894
|
style={
|
|
1884
1895
|
{
|
|
@@ -2053,6 +2064,7 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
|
|
|
2053
2064
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2054
2065
|
onGestureHandlerStateChange={[Function]}
|
|
2055
2066
|
onGestureHandlerTouchEvent={[Function]}
|
|
2067
|
+
onStartShouldSetResponder={[Function]}
|
|
2056
2068
|
pointerEvents="box-none"
|
|
2057
2069
|
style={
|
|
2058
2070
|
{
|
|
@@ -2200,6 +2212,7 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
|
|
|
2200
2212
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2201
2213
|
onGestureHandlerStateChange={[Function]}
|
|
2202
2214
|
onGestureHandlerTouchEvent={[Function]}
|
|
2215
|
+
onStartShouldSetResponder={[Function]}
|
|
2203
2216
|
pointerEvents="box-none"
|
|
2204
2217
|
style={
|
|
2205
2218
|
{
|
|
@@ -2376,6 +2389,7 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
|
|
|
2376
2389
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2377
2390
|
onGestureHandlerStateChange={[Function]}
|
|
2378
2391
|
onGestureHandlerTouchEvent={[Function]}
|
|
2392
|
+
onStartShouldSetResponder={[Function]}
|
|
2379
2393
|
pointerEvents="box-none"
|
|
2380
2394
|
style={
|
|
2381
2395
|
{
|
|
@@ -2519,6 +2533,7 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
|
|
|
2519
2533
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2520
2534
|
onGestureHandlerStateChange={[Function]}
|
|
2521
2535
|
onGestureHandlerTouchEvent={[Function]}
|
|
2536
|
+
onStartShouldSetResponder={[Function]}
|
|
2522
2537
|
pointerEvents="box-none"
|
|
2523
2538
|
style={
|
|
2524
2539
|
{
|
|
@@ -47,6 +47,7 @@ exports[`SendButton should render a SendButton 1`] = `
|
|
|
47
47
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
48
48
|
onGestureHandlerStateChange={[Function]}
|
|
49
49
|
onGestureHandlerTouchEvent={[Function]}
|
|
50
|
+
onStartShouldSetResponder={[Function]}
|
|
50
51
|
pointerEvents="box-none"
|
|
51
52
|
style={
|
|
52
53
|
{
|
|
@@ -219,6 +220,7 @@ exports[`SendButton should render a SendButton 1`] = `
|
|
|
219
220
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
220
221
|
onGestureHandlerStateChange={[Function]}
|
|
221
222
|
onGestureHandlerTouchEvent={[Function]}
|
|
223
|
+
onStartShouldSetResponder={[Function]}
|
|
222
224
|
pointerEvents="box-none"
|
|
223
225
|
style={
|
|
224
226
|
{
|
|
@@ -366,6 +368,7 @@ exports[`SendButton should render a SendButton 1`] = `
|
|
|
366
368
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
367
369
|
onGestureHandlerStateChange={[Function]}
|
|
368
370
|
onGestureHandlerTouchEvent={[Function]}
|
|
371
|
+
onStartShouldSetResponder={[Function]}
|
|
369
372
|
pointerEvents="box-none"
|
|
370
373
|
style={
|
|
371
374
|
{
|
|
@@ -542,6 +545,7 @@ exports[`SendButton should render a SendButton 1`] = `
|
|
|
542
545
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
543
546
|
onGestureHandlerStateChange={[Function]}
|
|
544
547
|
onGestureHandlerTouchEvent={[Function]}
|
|
548
|
+
onStartShouldSetResponder={[Function]}
|
|
545
549
|
pointerEvents="box-none"
|
|
546
550
|
style={
|
|
547
551
|
{
|
|
@@ -685,6 +689,7 @@ exports[`SendButton should render a SendButton 1`] = `
|
|
|
685
689
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
686
690
|
onGestureHandlerStateChange={[Function]}
|
|
687
691
|
onGestureHandlerTouchEvent={[Function]}
|
|
692
|
+
onStartShouldSetResponder={[Function]}
|
|
688
693
|
pointerEvents="box-none"
|
|
689
694
|
style={
|
|
690
695
|
{
|
|
@@ -961,6 +966,7 @@ exports[`SendButton should render a disabled SendButton 1`] = `
|
|
|
961
966
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
962
967
|
onGestureHandlerStateChange={[Function]}
|
|
963
968
|
onGestureHandlerTouchEvent={[Function]}
|
|
969
|
+
onStartShouldSetResponder={[Function]}
|
|
964
970
|
pointerEvents="box-none"
|
|
965
971
|
style={
|
|
966
972
|
{
|
|
@@ -1133,6 +1139,7 @@ exports[`SendButton should render a disabled SendButton 1`] = `
|
|
|
1133
1139
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1134
1140
|
onGestureHandlerStateChange={[Function]}
|
|
1135
1141
|
onGestureHandlerTouchEvent={[Function]}
|
|
1142
|
+
onStartShouldSetResponder={[Function]}
|
|
1136
1143
|
pointerEvents="box-none"
|
|
1137
1144
|
style={
|
|
1138
1145
|
{
|
|
@@ -1280,6 +1287,7 @@ exports[`SendButton should render a disabled SendButton 1`] = `
|
|
|
1280
1287
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1281
1288
|
onGestureHandlerStateChange={[Function]}
|
|
1282
1289
|
onGestureHandlerTouchEvent={[Function]}
|
|
1290
|
+
onStartShouldSetResponder={[Function]}
|
|
1283
1291
|
pointerEvents="box-none"
|
|
1284
1292
|
style={
|
|
1285
1293
|
{
|
|
@@ -1456,6 +1464,7 @@ exports[`SendButton should render a disabled SendButton 1`] = `
|
|
|
1456
1464
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1457
1465
|
onGestureHandlerStateChange={[Function]}
|
|
1458
1466
|
onGestureHandlerTouchEvent={[Function]}
|
|
1467
|
+
onStartShouldSetResponder={[Function]}
|
|
1459
1468
|
pointerEvents="box-none"
|
|
1460
1469
|
style={
|
|
1461
1470
|
{
|
|
@@ -1599,6 +1608,7 @@ exports[`SendButton should render a disabled SendButton 1`] = `
|
|
|
1599
1608
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1600
1609
|
onGestureHandlerStateChange={[Function]}
|
|
1601
1610
|
onGestureHandlerTouchEvent={[Function]}
|
|
1611
|
+
onStartShouldSetResponder={[Function]}
|
|
1602
1612
|
pointerEvents="box-none"
|
|
1603
1613
|
style={
|
|
1604
1614
|
{
|
package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.tsx.snap
CHANGED
|
@@ -61,6 +61,7 @@ exports[`ScrollToBottomButton should render the message notification and match s
|
|
|
61
61
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
62
62
|
onGestureHandlerStateChange={[Function]}
|
|
63
63
|
onGestureHandlerTouchEvent={[Function]}
|
|
64
|
+
onStartShouldSetResponder={[Function]}
|
|
64
65
|
pointerEvents="box-none"
|
|
65
66
|
style={
|
|
66
67
|
{
|
|
@@ -1846,6 +1846,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1846
1846
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
1847
1847
|
onGestureHandlerStateChange={[Function]}
|
|
1848
1848
|
onGestureHandlerTouchEvent={[Function]}
|
|
1849
|
+
onStartShouldSetResponder={[Function]}
|
|
1849
1850
|
pointerEvents="box-none"
|
|
1850
1851
|
style={
|
|
1851
1852
|
{
|
|
@@ -2224,6 +2225,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
2224
2225
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2225
2226
|
onGestureHandlerStateChange={[Function]}
|
|
2226
2227
|
onGestureHandlerTouchEvent={[Function]}
|
|
2228
|
+
onStartShouldSetResponder={[Function]}
|
|
2227
2229
|
pointerEvents="box-none"
|
|
2228
2230
|
style={
|
|
2229
2231
|
{
|
|
@@ -2406,6 +2408,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
2406
2408
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2407
2409
|
onGestureHandlerStateChange={[Function]}
|
|
2408
2410
|
onGestureHandlerTouchEvent={[Function]}
|
|
2411
|
+
onStartShouldSetResponder={[Function]}
|
|
2409
2412
|
pointerEvents="box-none"
|
|
2410
2413
|
style={
|
|
2411
2414
|
{
|
|
@@ -2553,6 +2556,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
2553
2556
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2554
2557
|
onGestureHandlerStateChange={[Function]}
|
|
2555
2558
|
onGestureHandlerTouchEvent={[Function]}
|
|
2559
|
+
onStartShouldSetResponder={[Function]}
|
|
2556
2560
|
pointerEvents="box-none"
|
|
2557
2561
|
style={
|
|
2558
2562
|
{
|
|
@@ -2729,6 +2733,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
2729
2733
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2730
2734
|
onGestureHandlerStateChange={[Function]}
|
|
2731
2735
|
onGestureHandlerTouchEvent={[Function]}
|
|
2736
|
+
onStartShouldSetResponder={[Function]}
|
|
2732
2737
|
pointerEvents="box-none"
|
|
2733
2738
|
style={
|
|
2734
2739
|
{
|
|
@@ -2872,6 +2877,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
2872
2877
|
onGestureHandlerReanimatedEvent={[Function]}
|
|
2873
2878
|
onGestureHandlerStateChange={[Function]}
|
|
2874
2879
|
onGestureHandlerTouchEvent={[Function]}
|
|
2880
|
+
onStartShouldSetResponder={[Function]}
|
|
2875
2881
|
pointerEvents="box-none"
|
|
2876
2882
|
style={
|
|
2877
2883
|
{
|
|
@@ -8,6 +8,8 @@ const testDbName = `foobar-${process.env.JEST_WORKER_ID ?? '0'}.db`;
|
|
|
8
8
|
export const sqliteMock = {
|
|
9
9
|
open: () => {
|
|
10
10
|
db = new Sqlite3(testDbName);
|
|
11
|
+
db.pragma('journal_mode = MEMORY');
|
|
12
|
+
db.pragma('synchronous = OFF');
|
|
11
13
|
return {
|
|
12
14
|
close: () => {
|
|
13
15
|
db.close();
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { isRNVersionGreaterThanOrEqualTo } from '../isRNVersionGreaterThanOrEqualTo';
|
|
4
|
+
|
|
5
|
+
const setRNVersion = (version?: { major: number; minor: number; patch: number }) => {
|
|
6
|
+
Object.defineProperty(Platform, 'constants', {
|
|
7
|
+
configurable: true,
|
|
8
|
+
get: () => (version ? { reactNativeVersion: version } : {}),
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe('isRNVersionGreaterThanOrEqualTo', () => {
|
|
13
|
+
const originalConstants = Platform.constants;
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
Object.defineProperty(Platform, 'constants', {
|
|
17
|
+
configurable: true,
|
|
18
|
+
get: () => originalConstants,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('compares the major version first', () => {
|
|
23
|
+
setRNVersion({ major: 1, minor: 0, patch: 0 });
|
|
24
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.99.99')).toBe(true);
|
|
25
|
+
|
|
26
|
+
setRNVersion({ major: 0, minor: 99, patch: 99 });
|
|
27
|
+
expect(isRNVersionGreaterThanOrEqualTo('1.0.0')).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('compares the minor version when majors match', () => {
|
|
31
|
+
setRNVersion({ major: 0, minor: 86, patch: 0 });
|
|
32
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.85.9')).toBe(true);
|
|
33
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.87.0')).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('takes the patch version into account when major and minor match', () => {
|
|
37
|
+
setRNVersion({ major: 0, minor: 86, patch: 2 });
|
|
38
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.86.1')).toBe(true);
|
|
39
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.86.2')).toBe(true);
|
|
40
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.86.3')).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('treats an exactly-equal version as satisfied', () => {
|
|
44
|
+
setRNVersion({ major: 0, minor: 86, patch: 1 });
|
|
45
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.86.1')).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('defaults omitted target parts to 0 (e.g. "0.86" means "0.86.0")', () => {
|
|
49
|
+
setRNVersion({ major: 0, minor: 86, patch: 0 });
|
|
50
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.86')).toBe(true);
|
|
51
|
+
|
|
52
|
+
setRNVersion({ major: 0, minor: 86, patch: 1 });
|
|
53
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.86')).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('returns false when the RN version constant is unavailable', () => {
|
|
57
|
+
setRNVersion(undefined);
|
|
58
|
+
expect(isRNVersionGreaterThanOrEqualTo('0.86.0')).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` when the running React Native version is greater than or equal to `version`
|
|
5
|
+
* (a `'major.minor.patch'` string, e.g. `'0.86.0'`), comparing major, then minor, then patch.
|
|
6
|
+
*
|
|
7
|
+
* Falls back to `false` when the version is unavailable (e.g. react-native-web) — callers should
|
|
8
|
+
* treat that as "assume an older React Native".
|
|
9
|
+
*/
|
|
10
|
+
export const isRNVersionGreaterThanOrEqualTo = (version: string): boolean => {
|
|
11
|
+
const runtime = Platform.constants?.reactNativeVersion;
|
|
12
|
+
if (!runtime) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const current = [runtime.major, runtime.minor, runtime.patch ?? 0];
|
|
17
|
+
const target = version.split('.').map((part) => parseInt(part, 10) || 0);
|
|
18
|
+
|
|
19
|
+
for (let i = 0; i < current.length; i++) {
|
|
20
|
+
const wanted = target[i] ?? 0;
|
|
21
|
+
if (current[i] !== wanted) {
|
|
22
|
+
return current[i] > wanted;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isRNVersionGreaterThanOrEqualTo } from './isRNVersionGreaterThanOrEqualTo';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* React Native capability flags, resolved once at module load - the RN version is fixed for the
|
|
5
|
+
* lifetime of the app. Keeping version gates as named flags here makes them easy to mock in tests
|
|
6
|
+
* and easy to retire later: when the SDK's minimum supported React Native reaches a baseline, grep
|
|
7
|
+
* for the flag to find every gated code path and delete both the flag and the branches it guarded.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const isRN86OrGreater = isRNVersionGreaterThanOrEqualTo('0.86.0');
|
package/src/version.json
CHANGED