'〜なり': Immediate Unexpected Action ('The Moment... Took Action')
[Verb Dict Form] + なり (Immediate spontaneous action by a single third-person subject)
'〜なり' indicates that the instant a person did something, they immediately and abruptly took a surprising subsequent action ('the moment he did X, he immediately did Y').
⚠ Note: Third-person subject rule: Both actions must be performed by the exact same third-person individual. Never used for the speaker's own first-person actions.
彼は部屋に入るなり、倒れこむようにベッドに横たわった。
The moment he entered the room, he threw himself onto the bed as if collapsing.
彼女は電話を切るなり、荷物をまとめて出て行った。
The moment she hung up the phone, she packed her bags and stormed out.