Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Android) Trying to resolve view with tag which doesn't exist #7

Closed
mooqoo opened this issue Sep 6, 2016 · 16 comments
Closed

(Android) Trying to resolve view with tag which doesn't exist #7

mooqoo opened this issue Sep 6, 2016 · 16 comments

Comments

@mooqoo
Copy link

mooqoo commented Sep 6, 2016

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.

@gre
Copy link
Owner

gre commented Sep 6, 2016

Android or iOS?

@mooqoo
Copy link
Author

mooqoo commented Sep 6, 2016

on Android

@mooqoo mooqoo changed the title Trying to resolve view with tag which doesn't exist (Android) Trying to resolve view with tag which doesn't exist Sep 6, 2016
@gre
Copy link
Owner

gre commented Sep 6, 2016

it might be a bug in React Native then, that if an element don't have a style, it's not even in the resolveView list..
For now, you will have to provide a style I guess.

@gaguirre
Copy link

gaguirre commented Sep 7, 2016

Probably related to the collapsable property for Android Views.
Setting it to false could fix the problem.

@gre
Copy link
Owner

gre commented Sep 7, 2016

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.

@gre gre closed this as completed Sep 7, 2016
@gre
Copy link
Owner

gre commented Sep 7, 2016

I'll add a note in README

@faxioman
Copy link

I'm not able to fix this issue.
I'm trying to take a screenshot for the main navigator ... setting collapsable on the navigator component or on his parent doesn't solve the issue. Some ideas?

@faxioman
Copy link

faxioman commented Jan 19, 2017

solved passing a reference of the view which contains the main navigator.

@gre
Copy link
Owner

gre commented Jan 19, 2017

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)

@manivannan-mp
Copy link

Resolved by adding collapsable={false} to view

<View collapsable={false} style={{backgroundColor: 'yellow'}} ref={ref => viewRefSuccess = ref}> <Text> Hello View Snap Shot </Text> </View>

@rameshvishnoi90904
Copy link

Resolved by adding collapsable={false} to view

<View collapsable={false} style={{backgroundColor: 'yellow'}} ref={ref => viewRefSuccess = ref}> <Text> Hello View Snap Shot </Text> </View>

Still works

@hanancs
Copy link

hanancs commented Nov 4, 2021

Resolved by adding collapsable={false} to view

<View collapsable={false} style={{backgroundColor: 'yellow'}} ref={ref => viewRefSuccess = ref}> <Text> Hello View Snap Shot </Text> </View>

Thanks @manivannan-mp

@yaser-elbatal
Copy link

Resolved by adding collapsable={false} to view

<View collapsable={false} style={{backgroundColor: 'yellow'}} ref={ref => viewRefSuccess = ref}> <Text> Hello View Snap Shot </Text> </View>

when add ref To View
give error
Oops, snapshot failed [Error: Failed to capture view snapshot]

@dev-alix
Copy link

Resolved by adding collapsable={false} to view

<View collapsable={false} style={{backgroundColor: 'yellow'}} ref={ref => viewRefSuccess = ref}> <Text> Hello View Snap Shot </Text> </View>

Yeah it's working for me

"react-native": "0.70.5",
"react-native-view-shot": "^3.5.0",

thanks

@nijarv
Copy link

nijarv commented Oct 16, 2023

Still getting same error

@Ronaldo-Kadenasty
Copy link

Resolved by adding collapsable={false} to view

<View collapsable={false} style={{backgroundColor: 'yellow'}} ref={ref => viewRefSuccess = ref}> <Text> Hello View Snap Shot </Text> </View>

Still working thanks !!

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

No branches or pull requests