@react-native-ama/core 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,16 @@
1
1
  import * as React from 'react';
2
- import { ViewProps } from 'react-native';
3
- type AutofocusContainerProps = React.PropsWithChildren<({
2
+ import { TouchableWithoutFeedbackProps, ViewProps } from 'react-native';
3
+ import { PickAccessibleProps } from '@react-native-ama/internal';
4
+ type TouchableAccessibleProps = PickAccessibleProps<TouchableWithoutFeedbackProps>;
5
+ export type AutofocusContainerProps = React.PropsWithChildren<(({
4
6
  wrapChildrenInAccessibleView?: true;
5
7
  } & ViewProps) | {
6
8
  wrapChildrenInAccessibleView: false;
9
+ }) & {
10
+ /**
11
+ * touchableContainerAccessibilityProps is provided as a workaround for any accessibility props that need to be passed to the TouchableWithoutFeedback component which are not recognized on the accessible view.
12
+ */
13
+ touchableContainerAccessibilityProps?: TouchableAccessibleProps;
7
14
  }>;
8
- export declare const AutofocusContainer: ({ children, wrapChildrenInAccessibleView, ...viewProps }: AutofocusContainerProps) => React.JSX.Element;
15
+ export declare const AutofocusContainer: ({ children, wrapChildrenInAccessibleView, touchableContainerAccessibilityProps, ...viewProps }: AutofocusContainerProps) => React.JSX.Element;
9
16
  export {};
@@ -39,7 +39,7 @@ const React = __importStar(require("react"));
39
39
  const react_native_1 = require("react-native");
40
40
  const useFocus_1 = require("../hooks/useFocus");
41
41
  const AutofocusContainer = (_a) => {
42
- var { children, wrapChildrenInAccessibleView = true } = _a, viewProps = __rest(_a, ["children", "wrapChildrenInAccessibleView"]);
42
+ var { children, wrapChildrenInAccessibleView = true, touchableContainerAccessibilityProps } = _a, viewProps = __rest(_a, ["children", "wrapChildrenInAccessibleView", "touchableContainerAccessibilityProps"]);
43
43
  const containerRef = React.useRef(null);
44
44
  const { setFocus } = (0, useFocus_1.useFocus)();
45
45
  React.useEffect(() => {
@@ -47,11 +47,11 @@ const AutofocusContainer = (_a) => {
47
47
  setFocus(containerRef.current);
48
48
  }, 0);
49
49
  }, [setFocus]);
50
- return wrapChildrenInAccessibleView ? (<react_native_1.TouchableWithoutFeedback ref={containerRef}>
50
+ return wrapChildrenInAccessibleView ? (<react_native_1.TouchableWithoutFeedback ref={containerRef} {...touchableContainerAccessibilityProps}>
51
51
  <react_native_1.View accessible={true} testID="autofocusContainer.accessibleView" {...viewProps}>
52
52
  {children}
53
53
  </react_native_1.View>
54
- </react_native_1.TouchableWithoutFeedback>) : (<react_native_1.TouchableWithoutFeedback ref={containerRef}>
54
+ </react_native_1.TouchableWithoutFeedback>) : (<react_native_1.TouchableWithoutFeedback ref={containerRef} {...touchableContainerAccessibilityProps}>
55
55
  {children}
56
56
  </react_native_1.TouchableWithoutFeedback>);
57
57
  };
@@ -1,4 +1,4 @@
1
- export { AutofocusContainer } from './components/AutofocusContainer';
1
+ export { AutofocusContainer, type AutofocusContainerProps, } from './components/AutofocusContainer';
2
2
  export { AMAProvider, useAMAContext, type AMAContextValue, type AMADevContextValue, type AMAProdContextValue, } from './components/AMAProvider';
3
3
  export { HideChildrenFromAccessibilityTree } from './components/HideChildrenFromAccessibilityTree';
4
4
  export { useButtonChecks } from './hooks/useButtonChecks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ama/core",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "Accessible Mobile App Library for React Native",
5
5
  "react-native": "src/index",
6
6
  "types": "dist/src/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "postinstall": "node ./src/postinstall.js"
27
27
  },
28
28
  "dependencies": {
29
- "@react-native-ama/internal": "~1.1.3"
29
+ "@react-native-ama/internal": "~1.2.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "*",
@@ -1,20 +1,37 @@
1
1
  import * as React from 'react';
2
- import { TouchableWithoutFeedback, View, ViewProps } from 'react-native';
2
+ import {
3
+ TouchableWithoutFeedback,
4
+ TouchableWithoutFeedbackProps,
5
+ View,
6
+ ViewProps,
7
+ } from 'react-native';
3
8
 
4
9
  import { useFocus } from '../hooks/useFocus';
10
+ import { PickAccessibleProps } from '@react-native-ama/internal';
5
11
 
6
- type AutofocusContainerProps = React.PropsWithChildren<
7
- | ({
8
- wrapChildrenInAccessibleView?: true;
9
- } & ViewProps)
10
- | {
11
- wrapChildrenInAccessibleView: false;
12
- }
12
+ type TouchableAccessibleProps =
13
+ PickAccessibleProps<TouchableWithoutFeedbackProps>;
14
+
15
+ export type AutofocusContainerProps = React.PropsWithChildren<
16
+ (
17
+ | ({
18
+ wrapChildrenInAccessibleView?: true;
19
+ } & ViewProps)
20
+ | {
21
+ wrapChildrenInAccessibleView: false;
22
+ }
23
+ ) & {
24
+ /**
25
+ * touchableContainerAccessibilityProps is provided as a workaround for any accessibility props that need to be passed to the TouchableWithoutFeedback component which are not recognized on the accessible view.
26
+ */
27
+ touchableContainerAccessibilityProps?: TouchableAccessibleProps;
28
+ }
13
29
  >;
14
30
 
15
31
  export const AutofocusContainer = ({
16
32
  children,
17
33
  wrapChildrenInAccessibleView = true,
34
+ touchableContainerAccessibilityProps,
18
35
  ...viewProps
19
36
  }: AutofocusContainerProps) => {
20
37
  const containerRef = React.useRef(null);
@@ -27,7 +44,9 @@ export const AutofocusContainer = ({
27
44
  }, [setFocus]);
28
45
 
29
46
  return wrapChildrenInAccessibleView ? (
30
- <TouchableWithoutFeedback ref={containerRef}>
47
+ <TouchableWithoutFeedback
48
+ ref={containerRef}
49
+ {...touchableContainerAccessibilityProps}>
31
50
  <View
32
51
  accessible={true}
33
52
  testID="autofocusContainer.accessibleView"
@@ -36,7 +55,9 @@ export const AutofocusContainer = ({
36
55
  </View>
37
56
  </TouchableWithoutFeedback>
38
57
  ) : (
39
- <TouchableWithoutFeedback ref={containerRef}>
58
+ <TouchableWithoutFeedback
59
+ ref={containerRef}
60
+ {...touchableContainerAccessibilityProps}>
40
61
  {children}
41
62
  </TouchableWithoutFeedback>
42
63
  );
package/src/index.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  // Components
2
- export { AutofocusContainer } from './components/AutofocusContainer';
2
+ export {
3
+ AutofocusContainer,
4
+ type AutofocusContainerProps,
5
+ } from './components/AutofocusContainer';
3
6
  export {
4
7
  AMAProvider,
5
8
  useAMAContext,