[verb (dictionary form)] + うちに [verb て-form] + いるうちに [verb ない-form] + うちに [i-adj] + うちに [na-adj] + な + うちに [noun] + の + うちに
うちに means "while": you do something while a state still holds, because it won't hold for ever. It follows the dictionary form, the ている form or the ない-form of a verb, an い-adjective as it is, a な-adjective with な, or a noun with の.
With the ない-form, うちに reads "before": do it while the thing has not yet happened. The verb is negative even though English says "before it happens".
After ている, うちに says that while one thing went on, something else changed without anyone meaning it to. The second half is a change: なる, てしまう, a feeling arriving.