You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seemed like shallow rendering wasn't really rendering the react native component because I kept getting a length of 0 on the wrapper.
Looks like in the latest version of React, we must use .at() on find()?
Looks like you can't use find() on shallowed components with React Native. I liked it when I could find things via data-test attributes in React Web but you can't do that, you are seemingly stuck with the testID attribute with Native, so when I tried the findAll() with node on testID I was not able to call .text() to get the name out of that .
and must use findAll with node we can't use find()?
we already know shallow won't work with React Hooks
The text was updated successfully, but these errors were encountered:
dschinkel
changed the title
The State of Shallow in React Native????
State of the Union on Shallow in React Native????
Oct 15, 2019
As is hopefully stated in #1436, enzyme has zero official support for React Native until a react-native adapter can be created, by whoever is willing to do the work.
Such an adapter would define "host nodes" as things like Text and Image, as opposed to div and other HTML elements; it would reject HTML elements as invalid, etc.
It sounds like shallow rendering does not work well with React Native is that so? Or at least for sure not with Redux connect. Here's what we found:
This worked (Straight Component not wrapped in an HOC):
SomeComponent.js
This Did Not Work (Redux Connect HOC):
Error: Method “text” is meant to be run on 1 node. 0 found instead.
Other Observations / Questions:
To use enzyme to test React Native, you currently need to configure an adapter, and load an emulated DOM
It seemed like shallow rendering wasn't really rendering the react native component because I kept getting a length of 0 on the wrapper.
Looks like in the latest version of React, we must use .at() on find()?
Looks like you can't use
find()
on shallowed components with React Native. I liked it when I could find things viadata-test
attributes inReact Web
but you can't do that, you are seemingly stuck with thetestID
attribute with Native, so when I tried the findAll() with node ontestID
I was not able to call .text() to get the name out of that .and must use
findAll
withnode
we can't use find()?we already know shallow won't work with React Hooks
The text was updated successfully, but these errors were encountered: