Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

react native - How do I set an identifier that will be visible in Safari's element inspector to easily differentiate Views?

I'm trying to build a web app with React Native.

As I'm learning, I'm doing a lot of trial and error debugging, but I haven't found a way to set a property identifier that will tell me what my View is supposed to be.

I.e. I have

<Image
  source={imageSource}
  testID='imageView'
  customID='imageView'
/>

However, when I inspect this element in Safari, I don't see either testID (which the docs say should be a property I can use for end to end debugging), nor do I see customID, which should be a custom property that is visible in the inspector.

The View displays as "div" with a ton of what looks like auto generated gibberish in properties like className that isn't very useful to me, because it's all generated based on style and layout props.

question from:https://stackoverflow.com/questions/65832912/how-do-i-set-an-identifier-that-will-be-visible-in-safaris-element-inspector-to

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...