Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

How to access elements inside <TouchableOpacity .. /> ? #82

Closed
romanlv opened this issue Jul 18, 2016 · 2 comments
Closed

How to access elements inside <TouchableOpacity .. /> ? #82

romanlv opened this issue Jul 18, 2016 · 2 comments

Comments

@romanlv
Copy link

romanlv commented Jul 18, 2016

I'm trying to test a simple component, where some areas are wrapped with

          <View style={styles.fieldContainer}>
            <TouchableOpacity onPress={() => {onPressHandler(...);}}>
              <IXText text={inputTime}  />
            </TouchableOpacity>
          </View>

I've tried different methods and rendering functions, it only can find/traverse to TouchableOpacity element, but not children inside it? Is it a problem of react-native-mock or enzyme?

Any ideas on how to test this component?

@RealOrangeOne
Copy link
Owner

I believe this is a duplicate of #76. See there for more.

@romanlv
Copy link
Author

romanlv commented Jul 19, 2016

Well, somehow it works for <View> elements, you can wrap TextInput with <View> (with multiple levels) and the whole pack will be rendered by the shallow function.
Can it just reuse the same logic for TouchableOpacity (and similar advanced containers)? For the tests it will be useful to "see through" those system elements...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants