iOS setValue to textField times out

I’m writing tests for ios native app using appium and jasmine. There is this screen on the app where there are two forms. One for shipping address and one for billing address. The accessibility IDs of the text fields are the same. For shipping address part I’m using $("~firstNameTextField).setValue(“abc”) and it works fine. But for billing address I’m using chain selectors to not get it confused with the shipping address’ firstNameTextField. Like this:
$("~BillingAddress").$("~firstNameTextField).setValue(“abc”);

The thing is it takes so much time to setValue for the billing address. By the time it gets to the last name part it is giving me a timeout error. How can I achieve this without timing out?

try use $$ and .get(index)

@Aleksei It worked! Thank you so much! Is chaining selectors like I did bad practice? Because I used that method in other parts of the script.

not bad. i just suggested workaround that had chances to work faster. it depends on some factors and way how people writing code. you use CSS celector with jasmine. And this is comfortable form for you. there are better methods that chaining BUT sometimes chaining is a must. Also many depends on screen of you app under test.