B. The first inner View should be self-closing since it has no children
C. The outer View is missing a closing tag
D. The second inner View has incorrect width value
Solution
Step 1: Check JSX syntax for empty Views
The first inner View has no children but uses opening and closing tags instead of self-closing.
Step 2: Confirm correct self-closing syntax
In React Native, empty Views should be self-closed like <View ... /> to avoid warnings.
Final Answer:
The first inner View should be self-closing since it has no children -> Option B
Quick Check:
Empty View tags must self-close [OK]
Hint: Empty Views must use self-closing tags [OK]
Common Mistakes:
Leaving empty Views with separate opening and closing tags
Misreading style object keys as invalid
Ignoring JSX tag closing rules
5. You want to create a skeleton loading screen that adapts to different content widths dynamically. Which approach best achieves this in React Native?
hard
A. Use images as placeholders instead of Views
B. Set fixed pixel widths for all skeleton bars
C. Render skeleton only after data loads
D. Use Animated.View with width set to a percentage and animate opacity
Solution
Step 1: Understand dynamic width needs
Using percentage widths allows skeleton bars to adapt to different screen sizes and content widths.
Step 2: Use animation for better UX
Animating opacity with Animated.View creates a shimmer effect, improving user experience during loading.
Step 3: Eliminate incorrect options
Fixed widths don't adapt; images are static; rendering after data loads defeats skeleton purpose.
Final Answer:
Use Animated.View with width set to a percentage and animate opacity -> Option D
Quick Check:
Dynamic width + animation = Use Animated.View with width set to a percentage and animate opacity [OK]
Hint: Use Animated.View with percent width and opacity animation [OK]
Common Mistakes:
Using fixed widths that don't adapt to screen size
Using static images instead of Views for placeholders
Showing skeleton after data is loaded
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.