RN v0.62.0-rc.0 - Touchable[Highlight|WithoutFeedback] are rendering into a component without name under jest
See original GitHub issueI am trying to migrate from 0.59.3 to 0.62 rc0
However, I got a strange state of the app. Touchable[Highlight|WithoutFeedback] became to render without display name under jest (see snippets below).
I have the following control:
function backspaceIcon(backspacer: Backspacer, iconProps: IconProps) {
return (
<TouchableHighlight
activeOpacity={1}
underlayColor="#FFF"
onShowUnderlay={() => (backspacer.backspaceUnderlay = true)}
onHideUnderlay={() => (backspacer.backspaceUnderlay = false)}
onPressIn={() => backspacer.backspace()}
delayLongPress={500}
onLongPress={() => backspacer.startBackspace()}
onPressOut={() => backspacer.endBackspace()}
style={styles.backspace}
accessibilityRole="button"
accessibilityLabel="delete"
>
<Icon
{...iconProps}
color={backspacer.backspaceUnderlay ? '#999' : '#333'}
/>
</TouchableHighlight>
)
}
Snapshot before migration:
<TouchableHighlight
accessibilityLabel="delete"
accessibilityRole="button"
activeOpacity={1}
delayLongPress={500}
onHideUnderlay={[Function]}
onLongPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
onShowUnderlay={[Function]}
style={
Object {
"alignItems": "center",
"borderRadius": 15,
"display": "flex",
"height": 60,
"justifyContent": "center",
"width": 60,
}
}
underlayColor="#FFF"
>
<View
color="#333"
name="ios-backspace"
size={30}
/>
</TouchableHighlight>
Snapshot after migration (no TouchableHighlight
name):
<
accessibilityLabel="delete"
accessibilityRole="button"
activeOpacity={1}
delayLongPress={500}
onHideUnderlay={[Function]}
onLongPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
onShowUnderlay={[Function]}
style={
Object {
"alignItems": "center",
"borderRadius": 15,
"display": "flex",
"height": 60,
"justifyContent": "center",
"width": 60,
}
}
underlayColor="#FFF"
>
<View
color="#333"
name="ios-backspace"
size={30}
/>
</>
The same thing happens to TouchableWithoutFeedback. However, other controls look fine.
React Native version: 0.62 rc0
Steps To Reproduce
Not sure.
Describe what you expected to happen: TouchableHighlight rendered to TouchableHighlight TouchableWithoutFeedback rendered to TouchableWithoutFeedback
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:22 (2 by maintainers)
Top Results From Across the Web
Continuous integration for React applications using Jest and ...
In this method, you take snapshots of components and when the component's rendered output changes, you can easily detect the changes made.
Read more >Can't get Jest to work with Styled Components which contain ...
Wrapping the ThemeProvider around the component and passing the theme object to it, works fine for me. import React from 'react'; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Isn’t a simpler version enough:
Currently for my snapshot tests this line seems to be enough. Do you see any problem with that?
Came up with this, snapshots will be changed a little, but events tests will pass: