also looking at this
fix(native): retain keyed controls and correct map and tab chrome
#368
32 files
+449
-100
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -4935,8 +4935,11 @@ class MainActivity : AppCompatActivity() { | ||
| 4935 | 4935 | val explicitKey = authoredKey(node, props) |
| 4936 | 4936 | // Descendants are scoped to this retained identity, not its sibling |
| 4937 | 4937 | // position. Moving a keyed parent must retain its nested inputs too. |
| 4938 | // A test selector may intentionally identify several list rows. The | |
| 4939 | // compiler's unique protocol ID must win over that legacy fallback. | |
| 4938 | 4940 | val identity = explicitKey?.let { "${path.substringBeforeLast('.', "")}/$it" } |
| 4939 | 4941 | ?: protocolId?.let { "id:$it" } |
| 4942 | ?: props.optString("testID").takeIf { it.isNotBlank() }?.let { "${path.substringBeforeLast('.', "")}/$it" } | |
| 4940 | 4943 | ?: path |
| 4941 | 4944 | val previous = previousControls[identity] |
| 4942 | 4945 | val reusableInput = previous as? EditText |
| @@ -5822,7 +5825,7 @@ class MainActivity : AppCompatActivity() { | ||
| 5822 | 5825 | } |
| 5823 | 5826 | |
| 5824 | 5827 | private fun authoredKey(node: JSONObject, props: JSONObject): String? { |
| 5825 | val direct = listOf(node.optString("key"), props.optString("key"), props.optString("testID")) | |
| 5828 | val direct = listOf(node.optString("key"), props.optString("key")) | |
| 5826 | 5829 | .firstOrNull { it.isNotBlank() } |
| 5827 | 5830 | if (direct != null) return direct |
| 5828 | 5831 | return null |