react-native-view-shot: (Android) Trying to resolve view with tag which doesn't exist
I’m getting this issue if my view reference did not specify a backgroundColor.
so the code works fine if I take a Snapshot with the below viewRef
<View
style={{backgroundColor: 'yellow'}}
ref={ref => viewRefSuccess = ref}>
<Text>
Hello View Snap Shot
</Text>
</View>
However it will crash with the “Trying to resolve view with tag ‘tagID’ which doesn’t exist” if I remove the backgroundColor props.
<View ref={ref => viewRefSuccess = ref}>
<Text>
Hello View Snap Shot
</Text>
</View>
Any thought on why this is happening?
Thanks.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 15
- Comments: 16 (5 by maintainers)
Probably related to the collapsable property for Android Views. Setting it to false could fix the problem.
Resolved by adding collapsable={false} to view
<View collapsable={false} style={{backgroundColor: 'yellow'}} ref={ref => viewRefSuccess = ref}> <Text> Hello View Snap Shot </Text> </View>I’ll add a note in README
Thanks @manivannan-mp
yeah, because
<Navigator>does not have a UIView representation in the native side, it really needs to be on a View / Image / anything that you are sure that a ‘native ui view’ will exists (and that is not collapsed)view is somehow virtual (don’t mirror a real UI View underneath) if you use that property, so it makes sense that resolveView don’t work in that case, it’s not a bug on RN then.