She was ready to be a guinea pig for the fireflies and probably had a feeling she was giving up her life for that fact but Joel saved her and she kind of lost her purpose, that's part of it anyway.
Spoiler:
…ahh yeah, thank you for that……I did realise that, that had taken away her ‘purpose’ but missed that it had created such a rift between her and Joel…with the incident at the dance as well…?…she’s also pushing for her own independence as well and to feel her own ability to ‘fight her own battles and make her own decisions…’….so as Moira Rose has said, is displaying behaviour and emotions attached to her age as well as all of the survival techniques etc she’s having to implement…