~なり(~するとすぐ)
As soon as …, (someone suddenly) …
N1
V (dictionary form) + なり、~ / V-ta + なり (and has stayed so)
Vる+なり says that right after the first action the same subject does a second, often surprising or unusual, action. The subject is usually a third person, not the speaker, and the second clause cannot be a wish or an order. Unlike ~たとたん (N3), なり needs the same person doing both actions. Vた+なり has a different meaning, 'did … and has stayed that way' ({出|で}かけたなり{帰|かえ}ってこない), which is old-fashioned and rare. The pattern is somewhat literary and common in stories and narratives.
Examples
部長は会議室に入るなり、大声で担当者を呼んだ。
The moment the manager entered the meeting room, he loudly called for the person in charge.
娘は電話を切るなり、泣き出してしまった。
My daughter burst into tears as soon as she hung up.
彼は一口食べるなり、「これは塩が多すぎる」と言った。
He had barely taken a bite when he said, 'This has far too much salt.'
Exercises
1.課長は報告書を見る 、顔をしかめた。
2.彼は家に帰る 、何も言わずに自分の部屋にこもった。