@ansight/react-native 1.3.0-preview.1 → 1.3.0-preview.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/README.md +2 -2
- package/android/build.gradle +2 -2
- package/index.js +43 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,8 +77,8 @@ bundle; its API requires the native Ansight module.
|
|
|
77
77
|
|
|
78
78
|
This package version expects matching native SDK packages:
|
|
79
79
|
|
|
80
|
-
- CocoaPods: `Ansight`, `AnsightObjC` version `1.3.0-preview.
|
|
81
|
-
- Maven: `ai.ansight:ansight-android:1.3.0-preview.
|
|
80
|
+
- CocoaPods: `Ansight`, `AnsightObjC` version `1.3.0-preview.2`
|
|
81
|
+
- Maven: `ai.ansight:ansight-android:1.3.0-preview.2`
|
|
82
82
|
|
|
83
83
|
## Quickstart
|
|
84
84
|
|
package/android/build.gradle
CHANGED
|
@@ -67,6 +67,6 @@ repositories {
|
|
|
67
67
|
dependencies {
|
|
68
68
|
implementation("com.facebook.react:react-android")
|
|
69
69
|
def ansightAndroidVersion =
|
|
70
|
-
findProperty("ansightAndroidVersion") ?: "1.3.0-preview.
|
|
71
|
-
implementation("ai.ansight:ansight-android:1.3.0-preview.
|
|
70
|
+
findProperty("ansightAndroidVersion") ?: "1.3.0-preview.2"
|
|
71
|
+
implementation("ai.ansight:ansight-android:1.3.0-preview.2")
|
|
72
72
|
}
|
package/index.js
CHANGED
|
@@ -1391,7 +1391,7 @@ function summarizeProps(props) {
|
|
|
1391
1391
|
}
|
|
1392
1392
|
const keys = Object.keys(props).filter((key) => key !== "children");
|
|
1393
1393
|
const summary = { keys };
|
|
1394
|
-
["testID", "nativeID", "accessibilityLabel", "role"].forEach((key) => {
|
|
1394
|
+
["testID", "nativeID", "accessibilityLabel", "accessibilityRole", "role"].forEach((key) => {
|
|
1395
1395
|
if (props[key] != null && !isSensitiveKey(key)) {
|
|
1396
1396
|
summary[key] = String(props[key]);
|
|
1397
1397
|
}
|
|
@@ -1403,6 +1403,42 @@ function summarizeProps(props) {
|
|
|
1403
1403
|
return summary;
|
|
1404
1404
|
}
|
|
1405
1405
|
|
|
1406
|
+
function reactSemanticRole(type, props, fiberTag) {
|
|
1407
|
+
const declared = props && (props.accessibilityRole || props.role);
|
|
1408
|
+
if (declared) return String(declared).toLowerCase();
|
|
1409
|
+
if (fiberTag === 6 || /text/i.test(type)) return "text";
|
|
1410
|
+
if (/button|pressable|touchable/i.test(type)) return "button";
|
|
1411
|
+
if (/textinput/i.test(type)) return "textbox";
|
|
1412
|
+
if (/switch/i.test(type)) return "switch";
|
|
1413
|
+
if (/scrollview|flatlist|sectionlist/i.test(type)) return "scrollview";
|
|
1414
|
+
return "view";
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
function reactSupportedActions(type, props) {
|
|
1418
|
+
const actions = [];
|
|
1419
|
+
if (props && typeof props.onPress === "function") actions.push("tap");
|
|
1420
|
+
if (props && (typeof props.onChangeText === "function" || /textinput/i.test(type))) {
|
|
1421
|
+
actions.push("typeText", "focus");
|
|
1422
|
+
}
|
|
1423
|
+
if (/scrollview|flatlist|sectionlist/i.test(type) || (props && typeof props.onScroll === "function")) {
|
|
1424
|
+
actions.push("scroll", "swipe");
|
|
1425
|
+
}
|
|
1426
|
+
return actions;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
function applyReactTargetability(node, fiber, props, type) {
|
|
1430
|
+
const style = StyleSheet && typeof StyleSheet.flatten === "function"
|
|
1431
|
+
? StyleSheet.flatten(props && props.style)
|
|
1432
|
+
: props && props.style;
|
|
1433
|
+
node.text = node.label || (node.visual && node.visual.text) || null;
|
|
1434
|
+
node.role = reactSemanticRole(type, props, fiber.tag);
|
|
1435
|
+
node.supportedActions = reactSupportedActions(type, props);
|
|
1436
|
+
node.visible = !(style && style.display === "none") && !(props && props.accessibilityElementsHidden);
|
|
1437
|
+
node.enabled = !(props && (props.disabled === true || props.accessibilityState && props.accessibilityState.disabled === true));
|
|
1438
|
+
node.focusable = !!(props && props.focusable) || node.supportedActions.includes("focus");
|
|
1439
|
+
node.interactable = node.visible && node.enabled && node.supportedActions.length > 0;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1406
1442
|
function reactColorToArgbHex(value) {
|
|
1407
1443
|
if (value == null) {
|
|
1408
1444
|
return undefined;
|
|
@@ -1577,6 +1613,8 @@ function serializeFiber(fiber, context, depth) {
|
|
|
1577
1613
|
node.state = sanitizeValue(fiber.memoizedState, context);
|
|
1578
1614
|
}
|
|
1579
1615
|
|
|
1616
|
+
applyReactTargetability(node, fiber, props, type);
|
|
1617
|
+
|
|
1580
1618
|
if (depth < context.maxDepth) {
|
|
1581
1619
|
let child = fiber.child;
|
|
1582
1620
|
while (child) {
|
|
@@ -1600,9 +1638,10 @@ function isShadowTreeFiber(fiber) {
|
|
|
1600
1638
|
|
|
1601
1639
|
function createShadowTreeNode(fiber, context, depth) {
|
|
1602
1640
|
const props = fiber.memoizedProps || fiber.pendingProps || {};
|
|
1641
|
+
const type = reactFiberTypeName(fiber);
|
|
1603
1642
|
const node = {
|
|
1604
1643
|
id: reactFiberId(fiber),
|
|
1605
|
-
type
|
|
1644
|
+
type,
|
|
1606
1645
|
kind: fiber.tag === 3 ? "root" : fiber.tag === 6 ? "text" : "host",
|
|
1607
1646
|
tag: fiber.tag,
|
|
1608
1647
|
key: fiber.key == null ? null : String(fiber.key),
|
|
@@ -1635,6 +1674,8 @@ function createShadowTreeNode(fiber, context, depth) {
|
|
|
1635
1674
|
}
|
|
1636
1675
|
}
|
|
1637
1676
|
|
|
1677
|
+
applyReactTargetability(node, fiber, props, type);
|
|
1678
|
+
|
|
1638
1679
|
return node;
|
|
1639
1680
|
}
|
|
1640
1681
|
|