const wrapper = shallow(<Component />)
console.log(wrapper.instance()) // undefined
console.log(wrapper.renderer._instance) // correctly logs the instance
console.log(wrapper.renderer._instance._instance) // undefined
This is using React Native 0.45.1
, and React 16.0.0-alpha.12
. Is it possible that React has changed its instance structure in v16
?
Not just possible, they did.
Enzyme however does not yet support react 16, because it doesn't exist yet - and we don't support alphas. npm ls
shouldmbe erroring for you right now.
Fair enough, it's unfortunate that they made 16 the default version of react in the latest stable version of react native!
I wholeheartedly agree.
Most helpful comment
I wholeheartedly agree.