stream-chat-react-native-core 9.5.0-beta.2 → 9.5.0-beta.4
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/a11y/hooks/useScreenReaderEnabled.js +4 -24
- package/lib/commonjs/a11y/hooks/useScreenReaderEnabled.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +15 -12
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/screenReaderContext/ScreenReaderContext.js +52 -0
- package/lib/commonjs/contexts/screenReaderContext/ScreenReaderContext.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/a11y/hooks/useScreenReaderEnabled.js +4 -24
- package/lib/module/a11y/hooks/useScreenReaderEnabled.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +15 -12
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/screenReaderContext/ScreenReaderContext.js +52 -0
- package/lib/module/contexts/screenReaderContext/ScreenReaderContext.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/a11y/hooks/useScreenReaderEnabled.d.ts +1 -1
- package/lib/typescript/a11y/hooks/useScreenReaderEnabled.d.ts.map +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayProvider.d.ts.map +1 -1
- package/lib/typescript/contexts/screenReaderContext/ScreenReaderContext.d.ts +17 -0
- package/lib/typescript/contexts/screenReaderContext/ScreenReaderContext.d.ts.map +1 -0
- package/lib/typescript/hooks/useTranslatedMessage.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/a11y/hooks/useScreenReaderEnabled.ts +4 -29
- package/src/contexts/overlayContext/OverlayProvider.tsx +18 -15
- package/src/contexts/screenReaderContext/ScreenReaderContext.tsx +64 -0
- package/src/version.json +1 -1
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
1
|
Object.defineProperty(exports, "__esModule", {
|
|
3
2
|
value: true
|
|
4
3
|
});
|
|
5
4
|
exports.useScreenReaderEnabled = void 0;
|
|
6
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
5
|
var _AccessibilityContext = require("../../contexts/accessibilityContext/AccessibilityContext");
|
|
6
|
+
var _ScreenReaderContext = require("../../contexts/screenReaderContext/ScreenReaderContext");
|
|
10
7
|
var useScreenReaderEnabled = () => {
|
|
11
8
|
var _useAccessibilityCont = (0, _AccessibilityContext.useAccessibilityContext)(),
|
|
12
9
|
enabled = _useAccessibilityCont.enabled,
|
|
13
10
|
forceScreenReaderMode = _useAccessibilityCont.forceScreenReaderMode;
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
isEnabled = _useState2[0],
|
|
17
|
-
setIsEnabled = _useState2[1];
|
|
18
|
-
(0, _react.useEffect)(() => {
|
|
19
|
-
if (!enabled) {
|
|
20
|
-
setIsEnabled(false);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
var cancelled = false;
|
|
24
|
-
_reactNative.AccessibilityInfo.isScreenReaderEnabled().then(value => {
|
|
25
|
-
if (!cancelled) setIsEnabled(value);
|
|
26
|
-
}).catch(() => {});
|
|
27
|
-
var subscription = _reactNative.AccessibilityInfo.addEventListener('screenReaderChanged', setIsEnabled);
|
|
28
|
-
return () => {
|
|
29
|
-
cancelled = true;
|
|
30
|
-
subscription?.remove?.();
|
|
31
|
-
};
|
|
32
|
-
}, [enabled]);
|
|
11
|
+
var _useScreenReaderConte = (0, _ScreenReaderContext.useScreenReaderContext)(),
|
|
12
|
+
screenReaderEnabled = _useScreenReaderConte.enabled;
|
|
33
13
|
if (!enabled) return false;
|
|
34
14
|
if (forceScreenReaderMode) return true;
|
|
35
|
-
return
|
|
15
|
+
return screenReaderEnabled;
|
|
36
16
|
};
|
|
37
17
|
exports.useScreenReaderEnabled = useScreenReaderEnabled;
|
|
38
18
|
//# sourceMappingURL=useScreenReaderEnabled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_AccessibilityContext","require","_ScreenReaderContext","useScreenReaderEnabled","_useAccessibilityCont","useAccessibilityContext","enabled","forceScreenReaderMode","_useScreenReaderConte","useScreenReaderContext","screenReaderEnabled","exports"],"sourceRoot":"../../../../src","sources":["a11y/hooks/useScreenReaderEnabled.ts"],"mappings":";;;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAUO,IAAME,sBAAsB,GAAGA,CAAA,KAAe;EACnD,IAAAC,qBAAA,GAA2C,IAAAC,6CAAuB,EAAC,CAAC;IAA5DC,OAAO,GAAAF,qBAAA,CAAPE,OAAO;IAAEC,qBAAqB,GAAAH,qBAAA,CAArBG,qBAAqB;EACtC,IAAAC,qBAAA,GAAyC,IAAAC,2CAAsB,EAAC,CAAC;IAAhDC,mBAAmB,GAAAF,qBAAA,CAA5BF,OAAO;EAEf,IAAI,CAACA,OAAO,EAAE,OAAO,KAAK;EAC1B,IAAIC,qBAAqB,EAAE,OAAO,IAAI;EACtC,OAAOG,mBAAmB;AAC5B,CAAC;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -15,6 +15,7 @@ var _ImageGallery = require("../../components/ImageGallery/ImageGallery");
|
|
|
15
15
|
var _useStreami18n = require("../../hooks/useStreami18n");
|
|
16
16
|
var _AccessibilityContext = require("../accessibilityContext/AccessibilityContext");
|
|
17
17
|
var _ImageGalleryContext = require("../imageGalleryContext/ImageGalleryContext");
|
|
18
|
+
var _ScreenReaderContext = require("../screenReaderContext/ScreenReaderContext");
|
|
18
19
|
var _ThemeContext = require("../themeContext/ThemeContext");
|
|
19
20
|
var _TranslationContext = require("../translationContext/TranslationContext");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -71,18 +72,20 @@ var OverlayProvider = props => {
|
|
|
71
72
|
},
|
|
72
73
|
children: (0, _jsxRuntime.jsx)(_AccessibilityContext.AccessibilityProvider, {
|
|
73
74
|
value: accessibility,
|
|
74
|
-
children: (0, _jsxRuntime.jsx)(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
children:
|
|
82
|
-
children:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
children: (0, _jsxRuntime.jsx)(_ScreenReaderContext.ScreenReaderProvider, {
|
|
76
|
+
children: (0, _jsxRuntime.jsx)(_OverlayContext.OverlayContext.Provider, {
|
|
77
|
+
value: overlayContext,
|
|
78
|
+
children: (0, _jsxRuntime.jsx)(_ImageGalleryContext.ImageGalleryProvider, {
|
|
79
|
+
value: imageGalleryProviderProps,
|
|
80
|
+
children: (0, _jsxRuntime.jsx)(_ThemeContext.ThemeProvider, {
|
|
81
|
+
style: overlayContext.style,
|
|
82
|
+
children: (0, _jsxRuntime.jsxs)(_reactNativeTeleport.PortalProvider, {
|
|
83
|
+
children: [accessibility?.enabled ? (0, _jsxRuntime.jsx)(_OverlayA11yShield.OverlayA11yShield, {
|
|
84
|
+
children: children
|
|
85
|
+
}) : children, overlay === 'gallery' && (0, _jsxRuntime.jsx)(_ImageGallery.ImageGallery, {
|
|
86
|
+
overlayOpacity: overlayOpacity
|
|
87
|
+
}), (0, _jsxRuntime.jsx)(_MessageOverlayHostLayer.MessageOverlayHostLayer, {})]
|
|
88
|
+
})
|
|
86
89
|
})
|
|
87
90
|
})
|
|
88
91
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeTeleport","_MessageOverlayHostLayer","_OverlayContext","_OverlayA11yShield","_ImageGallery","_useStreami18n","_AccessibilityContext","_ImageGalleryContext","_ThemeContext","_TranslationContext","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverlayProvider","props","accessibility","autoPlayVideo","children","giphyVersion","i18nInstance","numberOfImageGalleryGridColumns","value","_useState","useState","overlay","_useState2","_slicedToArray2","setOverlay","overlayOpacity","useSharedValue","translators","useStreami18n","useEffect","backAction","backHandler","BackHandler","addEventListener","remove","cancelAnimation","withTiming","overlayContext","style","imageGalleryProviderProps","useMemo","jsx","TranslationProvider","userLanguage","DEFAULT_USER_LANGUAGE","AccessibilityProvider","OverlayContext","Provider","ImageGalleryProvider","ThemeProvider","jsxs","PortalProvider","enabled","OverlayA11yShield","ImageGallery","MessageOverlayHostLayer","exports"],"sourceRoot":"../../../../src","sources":["contexts/overlayContext/OverlayProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAH,OAAA;AAEA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAEA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeTeleport","_MessageOverlayHostLayer","_OverlayContext","_OverlayA11yShield","_ImageGallery","_useStreami18n","_AccessibilityContext","_ImageGalleryContext","_ScreenReaderContext","_ThemeContext","_TranslationContext","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverlayProvider","props","accessibility","autoPlayVideo","children","giphyVersion","i18nInstance","numberOfImageGalleryGridColumns","value","_useState","useState","overlay","_useState2","_slicedToArray2","setOverlay","overlayOpacity","useSharedValue","translators","useStreami18n","useEffect","backAction","backHandler","BackHandler","addEventListener","remove","cancelAnimation","withTiming","overlayContext","style","imageGalleryProviderProps","useMemo","jsx","TranslationProvider","userLanguage","DEFAULT_USER_LANGUAGE","AccessibilityProvider","ScreenReaderProvider","OverlayContext","Provider","ImageGalleryProvider","ThemeProvider","jsxs","PortalProvider","enabled","OverlayA11yShield","ImageGallery","MessageOverlayHostLayer","exports"],"sourceRoot":"../../../../src","sources":["contexts/overlayContext/OverlayProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAH,OAAA;AAEA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAEA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,oBAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AAEA,IAAAa,mBAAA,GAAAb,OAAA;AAGkD,IAAAc,WAAA,GAAAd,OAAA;AAAA,IAAAe,YAAA;AAAA,SAAAhB,wBAAAiB,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAnB,uBAAA,YAAAA,CAAAiB,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,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exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.useScreenReaderContext = exports.ScreenReaderProvider = exports.ScreenReaderContext = void 0;
|
|
6
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _AccessibilityContext = require("../accessibilityContext/AccessibilityContext");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
var _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/contexts/screenReaderContext/ScreenReaderContext.tsx";
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
|
+
var DEFAULT_SCREEN_READER_CONTEXT_VALUE = {
|
|
14
|
+
enabled: false
|
|
15
|
+
};
|
|
16
|
+
var ScreenReaderContext = exports.ScreenReaderContext = _react.default.createContext(DEFAULT_SCREEN_READER_CONTEXT_VALUE);
|
|
17
|
+
var ScreenReaderProvider = ({
|
|
18
|
+
children
|
|
19
|
+
}) => {
|
|
20
|
+
var _useAccessibilityCont = (0, _AccessibilityContext.useAccessibilityContext)(),
|
|
21
|
+
a11yEnabled = _useAccessibilityCont.enabled;
|
|
22
|
+
var _useState = (0, _react.useState)(false),
|
|
23
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
24
|
+
screenReaderEnabled = _useState2[0],
|
|
25
|
+
setScreenReaderEnabled = _useState2[1];
|
|
26
|
+
(0, _react.useEffect)(() => {
|
|
27
|
+
if (!a11yEnabled) {
|
|
28
|
+
setScreenReaderEnabled(false);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
var cancelled = false;
|
|
32
|
+
_reactNative.AccessibilityInfo.isScreenReaderEnabled().then(value => {
|
|
33
|
+
if (!cancelled) setScreenReaderEnabled(value);
|
|
34
|
+
}).catch(() => {});
|
|
35
|
+
var subscription = _reactNative.AccessibilityInfo.addEventListener('screenReaderChanged', setScreenReaderEnabled);
|
|
36
|
+
return () => {
|
|
37
|
+
cancelled = true;
|
|
38
|
+
subscription?.remove?.();
|
|
39
|
+
};
|
|
40
|
+
}, [a11yEnabled]);
|
|
41
|
+
var value = (0, _react.useMemo)(() => ({
|
|
42
|
+
enabled: screenReaderEnabled
|
|
43
|
+
}), [screenReaderEnabled]);
|
|
44
|
+
return (0, _jsxRuntime.jsx)(ScreenReaderContext.Provider, {
|
|
45
|
+
value: value,
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.ScreenReaderProvider = ScreenReaderProvider;
|
|
50
|
+
var useScreenReaderContext = () => (0, _react.useContext)(ScreenReaderContext);
|
|
51
|
+
exports.useScreenReaderContext = useScreenReaderContext;
|
|
52
|
+
//# sourceMappingURL=ScreenReaderContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_AccessibilityContext","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_SCREEN_READER_CONTEXT_VALUE","enabled","ScreenReaderContext","exports","React","createContext","ScreenReaderProvider","children","_useAccessibilityCont","useAccessibilityContext","a11yEnabled","_useState","useState","_useState2","_slicedToArray2","screenReaderEnabled","setScreenReaderEnabled","useEffect","cancelled","AccessibilityInfo","isScreenReaderEnabled","then","value","catch","subscription","addEventListener","remove","useMemo","jsx","Provider","useScreenReaderContext","useContext"],"sourceRoot":"../../../../src","sources":["contexts/screenReaderContext/ScreenReaderContext.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,qBAAA,GAAAF,OAAA;AAAuF,IAAAG,WAAA,GAAAH,OAAA;AAAA,IAAAI,YAAA;AAAA,SAAAL,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAnB,CAAA,EAAAc,EAAA,OAAAP,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAM,EAAA,EAAAP,CAAA,IAAAC,CAAA,CAAAM,EAAA,IAAAd,CAAA,CAAA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AA,CAAAkD,GAAA,EAAC1B,mBAAmB,CAAC2B,QAAQ;IAACP,KAAK,EAAEA,KAAM;IAAAf,QAAA,EAAEA;EAAQ,CAA+B,CAAC;AAC9F,CAAC;AAACJ,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAEK,IAAMwB,sBAAsB,GAAGA,CAAA,KACpC,IAAAC,iBAAU,EAAC7B,mBAAmB,CAAC;AAACC,OAAA,CAAA2B,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
1
|
Object.defineProperty(exports, "__esModule", {
|
|
3
2
|
value: true
|
|
4
3
|
});
|
|
5
4
|
exports.useScreenReaderEnabled = void 0;
|
|
6
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
5
|
var _AccessibilityContext = require("../../contexts/accessibilityContext/AccessibilityContext");
|
|
6
|
+
var _ScreenReaderContext = require("../../contexts/screenReaderContext/ScreenReaderContext");
|
|
10
7
|
var useScreenReaderEnabled = () => {
|
|
11
8
|
var _useAccessibilityCont = (0, _AccessibilityContext.useAccessibilityContext)(),
|
|
12
9
|
enabled = _useAccessibilityCont.enabled,
|
|
13
10
|
forceScreenReaderMode = _useAccessibilityCont.forceScreenReaderMode;
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
isEnabled = _useState2[0],
|
|
17
|
-
setIsEnabled = _useState2[1];
|
|
18
|
-
(0, _react.useEffect)(() => {
|
|
19
|
-
if (!enabled) {
|
|
20
|
-
setIsEnabled(false);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
var cancelled = false;
|
|
24
|
-
_reactNative.AccessibilityInfo.isScreenReaderEnabled().then(value => {
|
|
25
|
-
if (!cancelled) setIsEnabled(value);
|
|
26
|
-
}).catch(() => {});
|
|
27
|
-
var subscription = _reactNative.AccessibilityInfo.addEventListener('screenReaderChanged', setIsEnabled);
|
|
28
|
-
return () => {
|
|
29
|
-
cancelled = true;
|
|
30
|
-
subscription?.remove?.();
|
|
31
|
-
};
|
|
32
|
-
}, [enabled]);
|
|
11
|
+
var _useScreenReaderConte = (0, _ScreenReaderContext.useScreenReaderContext)(),
|
|
12
|
+
screenReaderEnabled = _useScreenReaderConte.enabled;
|
|
33
13
|
if (!enabled) return false;
|
|
34
14
|
if (forceScreenReaderMode) return true;
|
|
35
|
-
return
|
|
15
|
+
return screenReaderEnabled;
|
|
36
16
|
};
|
|
37
17
|
exports.useScreenReaderEnabled = useScreenReaderEnabled;
|
|
38
18
|
//# sourceMappingURL=useScreenReaderEnabled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_AccessibilityContext","require","_ScreenReaderContext","useScreenReaderEnabled","_useAccessibilityCont","useAccessibilityContext","enabled","forceScreenReaderMode","_useScreenReaderConte","useScreenReaderContext","screenReaderEnabled","exports"],"sourceRoot":"../../../../src","sources":["a11y/hooks/useScreenReaderEnabled.ts"],"mappings":";;;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AAUO,IAAME,sBAAsB,GAAGA,CAAA,KAAe;EACnD,IAAAC,qBAAA,GAA2C,IAAAC,6CAAuB,EAAC,CAAC;IAA5DC,OAAO,GAAAF,qBAAA,CAAPE,OAAO;IAAEC,qBAAqB,GAAAH,qBAAA,CAArBG,qBAAqB;EACtC,IAAAC,qBAAA,GAAyC,IAAAC,2CAAsB,EAAC,CAAC;IAAhDC,mBAAmB,GAAAF,qBAAA,CAA5BF,OAAO;EAEf,IAAI,CAACA,OAAO,EAAE,OAAO,KAAK;EAC1B,IAAIC,qBAAqB,EAAE,OAAO,IAAI;EACtC,OAAOG,mBAAmB;AAC5B,CAAC;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -15,6 +15,7 @@ var _ImageGallery = require("../../components/ImageGallery/ImageGallery");
|
|
|
15
15
|
var _useStreami18n = require("../../hooks/useStreami18n");
|
|
16
16
|
var _AccessibilityContext = require("../accessibilityContext/AccessibilityContext");
|
|
17
17
|
var _ImageGalleryContext = require("../imageGalleryContext/ImageGalleryContext");
|
|
18
|
+
var _ScreenReaderContext = require("../screenReaderContext/ScreenReaderContext");
|
|
18
19
|
var _ThemeContext = require("../themeContext/ThemeContext");
|
|
19
20
|
var _TranslationContext = require("../translationContext/TranslationContext");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -71,18 +72,20 @@ var OverlayProvider = props => {
|
|
|
71
72
|
},
|
|
72
73
|
children: (0, _jsxRuntime.jsx)(_AccessibilityContext.AccessibilityProvider, {
|
|
73
74
|
value: accessibility,
|
|
74
|
-
children: (0, _jsxRuntime.jsx)(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
children:
|
|
82
|
-
children:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
children: (0, _jsxRuntime.jsx)(_ScreenReaderContext.ScreenReaderProvider, {
|
|
76
|
+
children: (0, _jsxRuntime.jsx)(_OverlayContext.OverlayContext.Provider, {
|
|
77
|
+
value: overlayContext,
|
|
78
|
+
children: (0, _jsxRuntime.jsx)(_ImageGalleryContext.ImageGalleryProvider, {
|
|
79
|
+
value: imageGalleryProviderProps,
|
|
80
|
+
children: (0, _jsxRuntime.jsx)(_ThemeContext.ThemeProvider, {
|
|
81
|
+
style: overlayContext.style,
|
|
82
|
+
children: (0, _jsxRuntime.jsxs)(_reactNativeTeleport.PortalProvider, {
|
|
83
|
+
children: [accessibility?.enabled ? (0, _jsxRuntime.jsx)(_OverlayA11yShield.OverlayA11yShield, {
|
|
84
|
+
children: children
|
|
85
|
+
}) : children, overlay === 'gallery' && (0, _jsxRuntime.jsx)(_ImageGallery.ImageGallery, {
|
|
86
|
+
overlayOpacity: overlayOpacity
|
|
87
|
+
}), (0, _jsxRuntime.jsx)(_MessageOverlayHostLayer.MessageOverlayHostLayer, {})]
|
|
88
|
+
})
|
|
86
89
|
})
|
|
87
90
|
})
|
|
88
91
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeTeleport","_MessageOverlayHostLayer","_OverlayContext","_OverlayA11yShield","_ImageGallery","_useStreami18n","_AccessibilityContext","_ImageGalleryContext","_ThemeContext","_TranslationContext","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverlayProvider","props","accessibility","autoPlayVideo","children","giphyVersion","i18nInstance","numberOfImageGalleryGridColumns","value","_useState","useState","overlay","_useState2","_slicedToArray2","setOverlay","overlayOpacity","useSharedValue","translators","useStreami18n","useEffect","backAction","backHandler","BackHandler","addEventListener","remove","cancelAnimation","withTiming","overlayContext","style","imageGalleryProviderProps","useMemo","jsx","TranslationProvider","userLanguage","DEFAULT_USER_LANGUAGE","AccessibilityProvider","OverlayContext","Provider","ImageGalleryProvider","ThemeProvider","jsxs","PortalProvider","enabled","OverlayA11yShield","ImageGallery","MessageOverlayHostLayer","exports"],"sourceRoot":"../../../../src","sources":["contexts/overlayContext/OverlayProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAH,OAAA;AAEA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAEA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeTeleport","_MessageOverlayHostLayer","_OverlayContext","_OverlayA11yShield","_ImageGallery","_useStreami18n","_AccessibilityContext","_ImageGalleryContext","_ScreenReaderContext","_ThemeContext","_TranslationContext","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OverlayProvider","props","accessibility","autoPlayVideo","children","giphyVersion","i18nInstance","numberOfImageGalleryGridColumns","value","_useState","useState","overlay","_useState2","_slicedToArray2","setOverlay","overlayOpacity","useSharedValue","translators","useStreami18n","useEffect","backAction","backHandler","BackHandler","addEventListener","remove","cancelAnimation","withTiming","overlayContext","style","imageGalleryProviderProps","useMemo","jsx","TranslationProvider","userLanguage","DEFAULT_USER_LANGUAGE","AccessibilityProvider","ScreenReaderProvider","OverlayContext","Provider","ImageGalleryProvider","ThemeProvider","jsxs","PortalProvider","enabled","OverlayA11yShield","ImageGallery","MessageOverlayHostLayer","exports"],"sourceRoot":"../../../../src","sources":["contexts/overlayContext/OverlayProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,IAAAG,oBAAA,GAAAH,OAAA;AAEA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAEA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAA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E,YAAY;kBAAC9B,cAAc,EAAEA;gBAAe,CAAE,CAAC,EAC1E,IAAArC,WAAA,CAAAqD,GAAA,EAAC/D,wBAAA,CAAA8E,uBAAuB,IAAE,CAAC;cAAA,CACb;YAAC,CACJ;UAAC,CACI;QAAC,CACA;MAAC,CACN;IAAC,CACF;EAAC,CACL,CAAC;AAE1B,CAAC;AAACC,OAAA,CAAA/C,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.useScreenReaderContext = exports.ScreenReaderProvider = exports.ScreenReaderContext = void 0;
|
|
6
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _AccessibilityContext = require("../accessibilityContext/AccessibilityContext");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
var _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/contexts/screenReaderContext/ScreenReaderContext.tsx";
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
|
+
var DEFAULT_SCREEN_READER_CONTEXT_VALUE = {
|
|
14
|
+
enabled: false
|
|
15
|
+
};
|
|
16
|
+
var ScreenReaderContext = exports.ScreenReaderContext = _react.default.createContext(DEFAULT_SCREEN_READER_CONTEXT_VALUE);
|
|
17
|
+
var ScreenReaderProvider = ({
|
|
18
|
+
children
|
|
19
|
+
}) => {
|
|
20
|
+
var _useAccessibilityCont = (0, _AccessibilityContext.useAccessibilityContext)(),
|
|
21
|
+
a11yEnabled = _useAccessibilityCont.enabled;
|
|
22
|
+
var _useState = (0, _react.useState)(false),
|
|
23
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
24
|
+
screenReaderEnabled = _useState2[0],
|
|
25
|
+
setScreenReaderEnabled = _useState2[1];
|
|
26
|
+
(0, _react.useEffect)(() => {
|
|
27
|
+
if (!a11yEnabled) {
|
|
28
|
+
setScreenReaderEnabled(false);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
var cancelled = false;
|
|
32
|
+
_reactNative.AccessibilityInfo.isScreenReaderEnabled().then(value => {
|
|
33
|
+
if (!cancelled) setScreenReaderEnabled(value);
|
|
34
|
+
}).catch(() => {});
|
|
35
|
+
var subscription = _reactNative.AccessibilityInfo.addEventListener('screenReaderChanged', setScreenReaderEnabled);
|
|
36
|
+
return () => {
|
|
37
|
+
cancelled = true;
|
|
38
|
+
subscription?.remove?.();
|
|
39
|
+
};
|
|
40
|
+
}, [a11yEnabled]);
|
|
41
|
+
var value = (0, _react.useMemo)(() => ({
|
|
42
|
+
enabled: screenReaderEnabled
|
|
43
|
+
}), [screenReaderEnabled]);
|
|
44
|
+
return (0, _jsxRuntime.jsx)(ScreenReaderContext.Provider, {
|
|
45
|
+
value: value,
|
|
46
|
+
children: children
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
exports.ScreenReaderProvider = ScreenReaderProvider;
|
|
50
|
+
var useScreenReaderContext = () => (0, _react.useContext)(ScreenReaderContext);
|
|
51
|
+
exports.useScreenReaderContext = useScreenReaderContext;
|
|
52
|
+
//# sourceMappingURL=ScreenReaderContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_AccessibilityContext","_jsxRuntime","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DEFAULT_SCREEN_READER_CONTEXT_VALUE","enabled","ScreenReaderContext","exports","React","createContext","ScreenReaderProvider","children","_useAccessibilityCont","useAccessibilityContext","a11yEnabled","_useState","useState","_useState2","_slicedToArray2","screenReaderEnabled","setScreenReaderEnabled","useEffect","cancelled","AccessibilityInfo","isScreenReaderEnabled","then","value","catch","subscription","addEventListener","remove","useMemo","jsx","Provider","useScreenReaderContext","useContext"],"sourceRoot":"../../../../src","sources":["contexts/screenReaderContext/ScreenReaderContext.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,qBAAA,GAAAF,OAAA;AAAuF,IAAAG,WAAA,GAAAH,OAAA;AAAA,IAAAI,YAAA;AAAA,SAAAL,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,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AEb,CAAC,CAAC;IAEJ,IAAMC,YAAY,GAAGL,8BAAiB,CAACM,gBAAgB,CACrD,qBAAqB,EACrBT,sBACF,CAAC;IAED,OAAO,MAAM;MACXE,SAAS,GAAG,IAAI;MAChBM,YAAY,EAAEE,MAAM,GAAG,CAAC;IAC1B,CAAC;EACH,CAAC,EAAE,CAAChB,WAAW,CAAC,CAAC;EAEjB,IAAMY,KAAK,GAAG,IAAAK,cAAO,EACnB,OAAO;IAAE1B,OAAO,EAAEc;EAAoB,CAAC,CAAC,EACxC,CAACA,mBAAmB,CACtB,CAAC;EAED,OAAO,IAAArC,WAAA,CAAAkD,GAAA,EAAC1B,mBAAmB,CAAC2B,QAAQ;IAACP,KAAK,EAAEA,KAAM;IAAAf,QAAA,EAAEA;EAAQ,CAA+B,CAAC;AAC9F,CAAC;AAACJ,OAAA,CAAAG,oBAAA,GAAAA,oBAAA;AAEK,IAAMwB,sBAAsB,GAAGA,CAAA,KACpC,IAAAC,iBAAU,EAAC7B,mBAAmB,CAAC;AAACC,OAAA,CAAA2B,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
package/lib/module/version.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Returns the live screen-reader state from the app-wide {@link ScreenReaderContext}.
|
|
3
3
|
* Returns false when the AccessibilityContext is disabled, regardless of the OS state,
|
|
4
4
|
* so consumers don't pay the listener cost when the SDK's a11y is opted out.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScreenReaderEnabled.d.ts","sourceRoot":"","sources":["../../../../src/a11y/hooks/useScreenReaderEnabled.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useScreenReaderEnabled.d.ts","sourceRoot":"","sources":["../../../../src/a11y/hooks/useScreenReaderEnabled.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,QAAO,OAOzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayProvider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/overlayContext/OverlayProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAgC,MAAM,OAAO,CAAC;AAS/E,OAAO,EAAkB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"OverlayProvider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/overlayContext/OverlayProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAgC,MAAM,OAAO,CAAC;AAS/E,OAAO,EAAkB,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAgBxE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,iBAAiB,CAAC,oBAAoB,CAAC,sBAkF7E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
export type ScreenReaderContextValue = {
|
|
3
|
+
/** True when an OS screen reader (VoiceOver / TalkBack) is currently active. */
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const ScreenReaderContext: React.Context<ScreenReaderContextValue>;
|
|
7
|
+
/**
|
|
8
|
+
* Owns the single, app wide screen reader subscription. One `isScreenReaderEnabled()`
|
|
9
|
+
* query and one `screenReaderChanged` listener for the whole tree; every consumer reads
|
|
10
|
+
* the resulting boolean from context instead of attaching its own listener per mount.
|
|
11
|
+
*
|
|
12
|
+
* Gated on the AccessibilityContext `enabled` flag: when the SDK's a11y is opted out, no
|
|
13
|
+
* query is made and no listener is attached.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ScreenReaderProvider: ({ children }: PropsWithChildren) => React.JSX.Element;
|
|
16
|
+
export declare const useScreenReaderContext: () => ScreenReaderContextValue;
|
|
17
|
+
//# sourceMappingURL=ScreenReaderContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScreenReaderContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/screenReaderContext/ScreenReaderContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAA4C,MAAM,OAAO,CAAC;AAK3F,MAAM,MAAM,wBAAwB,GAAG;IACrC,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAIF,eAAO,MAAM,mBAAmB,yCAE/B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,cAAc,iBAAiB,sBAoCnE,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAO,wBACT,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslatedMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTranslatedMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMvF,eAAO,MAAM,oBAAoB,GAAI,UAAU,YAAY,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useTranslatedMessage.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTranslatedMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMvF,eAAO,MAAM,oBAAoB,GAAI,UAAU,YAAY,GAAG,eAAe;;;;;;;;;;;;;;;;;;;;;;;YAkBi4kB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAAD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAD98kB,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.5.0-beta.
|
|
4
|
+
"version": "9.5.0-beta.4",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"path": "0.12.7",
|
|
79
79
|
"react-native-markdown-package": "1.8.2",
|
|
80
80
|
"react-native-url-polyfill": "^2.0.0",
|
|
81
|
-
"stream-chat": "^9.47.
|
|
81
|
+
"stream-chat": "^9.47.1",
|
|
82
82
|
"use-sync-external-store": "^1.5.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { AccessibilityInfo } from 'react-native';
|
|
3
|
-
|
|
4
1
|
import { useAccessibilityContext } from '../../contexts/accessibilityContext/AccessibilityContext';
|
|
2
|
+
import { useScreenReaderContext } from '../../contexts/screenReaderContext/ScreenReaderContext';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
|
-
*
|
|
5
|
+
* Returns the live screen-reader state from the app-wide {@link ScreenReaderContext}.
|
|
8
6
|
* Returns false when the AccessibilityContext is disabled, regardless of the OS state,
|
|
9
7
|
* so consumers don't pay the listener cost when the SDK's a11y is opted out.
|
|
10
8
|
*
|
|
@@ -13,32 +11,9 @@ import { useAccessibilityContext } from '../../contexts/accessibilityContext/Acc
|
|
|
13
11
|
*/
|
|
14
12
|
export const useScreenReaderEnabled = (): boolean => {
|
|
15
13
|
const { enabled, forceScreenReaderMode } = useAccessibilityContext();
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (!enabled) {
|
|
20
|
-
setIsEnabled(false);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let cancelled = false;
|
|
25
|
-
AccessibilityInfo.isScreenReaderEnabled()
|
|
26
|
-
.then((value) => {
|
|
27
|
-
if (!cancelled) setIsEnabled(value);
|
|
28
|
-
})
|
|
29
|
-
.catch(() => {
|
|
30
|
-
// Some platforms / environments may not implement this; fall back to false.
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const subscription = AccessibilityInfo.addEventListener('screenReaderChanged', setIsEnabled);
|
|
34
|
-
|
|
35
|
-
return () => {
|
|
36
|
-
cancelled = true;
|
|
37
|
-
subscription?.remove?.();
|
|
38
|
-
};
|
|
39
|
-
}, [enabled]);
|
|
14
|
+
const { enabled: screenReaderEnabled } = useScreenReaderContext();
|
|
40
15
|
|
|
41
16
|
if (!enabled) return false;
|
|
42
17
|
if (forceScreenReaderMode) return true;
|
|
43
|
-
return
|
|
18
|
+
return screenReaderEnabled;
|
|
44
19
|
};
|
|
@@ -15,6 +15,7 @@ import { useStreami18n } from '../../hooks/useStreami18n';
|
|
|
15
15
|
|
|
16
16
|
import { AccessibilityProvider } from '../accessibilityContext/AccessibilityContext';
|
|
17
17
|
import { ImageGalleryProvider } from '../imageGalleryContext/ImageGalleryContext';
|
|
18
|
+
import { ScreenReaderProvider } from '../screenReaderContext/ScreenReaderContext';
|
|
18
19
|
import { ThemeProvider } from '../themeContext/ThemeContext';
|
|
19
20
|
|
|
20
21
|
import {
|
|
@@ -104,21 +105,23 @@ export const OverlayProvider = (props: PropsWithChildren<OverlayProviderProps>)
|
|
|
104
105
|
return (
|
|
105
106
|
<TranslationProvider value={{ ...translators, userLanguage: DEFAULT_USER_LANGUAGE }}>
|
|
106
107
|
<AccessibilityProvider value={accessibility}>
|
|
107
|
-
<
|
|
108
|
-
<
|
|
109
|
-
<
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
108
|
+
<ScreenReaderProvider>
|
|
109
|
+
<OverlayContext.Provider value={overlayContext}>
|
|
110
|
+
<ImageGalleryProvider value={imageGalleryProviderProps}>
|
|
111
|
+
<ThemeProvider style={overlayContext.style}>
|
|
112
|
+
<PortalProvider>
|
|
113
|
+
{accessibility?.enabled ? (
|
|
114
|
+
<OverlayA11yShield>{children}</OverlayA11yShield>
|
|
115
|
+
) : (
|
|
116
|
+
children
|
|
117
|
+
)}
|
|
118
|
+
{overlay === 'gallery' && <ImageGallery overlayOpacity={overlayOpacity} />}
|
|
119
|
+
<MessageOverlayHostLayer />
|
|
120
|
+
</PortalProvider>
|
|
121
|
+
</ThemeProvider>
|
|
122
|
+
</ImageGalleryProvider>
|
|
123
|
+
</OverlayContext.Provider>
|
|
124
|
+
</ScreenReaderProvider>
|
|
122
125
|
</AccessibilityProvider>
|
|
123
126
|
</TranslationProvider>
|
|
124
127
|
);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { PropsWithChildren, useContext, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { AccessibilityInfo } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useAccessibilityContext } from '../accessibilityContext/AccessibilityContext';
|
|
5
|
+
|
|
6
|
+
export type ScreenReaderContextValue = {
|
|
7
|
+
/** True when an OS screen reader (VoiceOver / TalkBack) is currently active. */
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const DEFAULT_SCREEN_READER_CONTEXT_VALUE: ScreenReaderContextValue = { enabled: false };
|
|
12
|
+
|
|
13
|
+
export const ScreenReaderContext = React.createContext<ScreenReaderContextValue>(
|
|
14
|
+
DEFAULT_SCREEN_READER_CONTEXT_VALUE,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Owns the single, app wide screen reader subscription. One `isScreenReaderEnabled()`
|
|
19
|
+
* query and one `screenReaderChanged` listener for the whole tree; every consumer reads
|
|
20
|
+
* the resulting boolean from context instead of attaching its own listener per mount.
|
|
21
|
+
*
|
|
22
|
+
* Gated on the AccessibilityContext `enabled` flag: when the SDK's a11y is opted out, no
|
|
23
|
+
* query is made and no listener is attached.
|
|
24
|
+
*/
|
|
25
|
+
export const ScreenReaderProvider = ({ children }: PropsWithChildren) => {
|
|
26
|
+
const { enabled: a11yEnabled } = useAccessibilityContext();
|
|
27
|
+
const [screenReaderEnabled, setScreenReaderEnabled] = useState(false);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (!a11yEnabled) {
|
|
31
|
+
setScreenReaderEnabled(false);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let cancelled = false;
|
|
36
|
+
AccessibilityInfo.isScreenReaderEnabled()
|
|
37
|
+
.then((value) => {
|
|
38
|
+
if (!cancelled) setScreenReaderEnabled(value);
|
|
39
|
+
})
|
|
40
|
+
.catch(() => {
|
|
41
|
+
// Some platforms / environments may not implement this; fall back to false.
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const subscription = AccessibilityInfo.addEventListener(
|
|
45
|
+
'screenReaderChanged',
|
|
46
|
+
setScreenReaderEnabled,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
cancelled = true;
|
|
51
|
+
subscription?.remove?.();
|
|
52
|
+
};
|
|
53
|
+
}, [a11yEnabled]);
|
|
54
|
+
|
|
55
|
+
const value = useMemo<ScreenReaderContextValue>(
|
|
56
|
+
() => ({ enabled: screenReaderEnabled }),
|
|
57
|
+
[screenReaderEnabled],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return <ScreenReaderContext.Provider value={value}>{children}</ScreenReaderContext.Provider>;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const useScreenReaderContext = (): ScreenReaderContextValue =>
|
|
64
|
+
useContext(ScreenReaderContext);
|
package/src/version.json
CHANGED