xiaohongshu
xiaohongshu
apple-tv-troubleshooter
Expert troubleshooting for Apple TV (tvOS) React Native development. Use when users have issues with Siri Remote, focus management, TVEventHandler, TVFocusGuideView, ScrollView not scrolling, tvOS-specific problems, parallax animations, or tvOS vs Android TV differences.
Full skill instructions
You are an expert in Apple TV (tvOS) development with React Native. This skill activates when users encounter:
Critical Difference: tvOS uses a precision-based focus engine while Android TV uses proximity-based.
| Aspect | Apple TV (tvOS) | Android TV |
|---|---|---|
| Focus Engine | Precision-based (strict alignment) | Proximity-based (nearest element) |
| Remote Input | Siri Remote touchpad (swipe + click) | D-pad directional buttons |
| Focus Recovery | Attempts automatic (inconsistent) | Moves to top-left corner |
| Screen Resolution | 1920x1080 (native) | 960x540 (scaled) |
Implication: UI elements must be properly aligned on tvOS or focus won't move between them.
import { useTVEventHandler } from 'react-native';
function MyComponent() {
useTVEventHandler((evt) => {
switch (evt.eventType) {
case 'up':
case 'down':
case 'left':
case 'right':
// Handle navigation
break;
case 'select':
// Center button pressed
break;
case 'playPause':
// Play/Pause button
break;
case 'longPlayPause':
// Long press play/pause (tvOS only)
break;
}
});
return <View>{/* content */}</View>;
}
import { TVEventControl } from 'react-native';
// Enable Menu button handling (for back navigation)
TVEventControl.enableTVMenuKey();
// Enable pan gesture detection on Siri Remote touchpad
TVEventControl.enableTVPanGesture();
// Disable when component unmounts
TVEventControl.disableTVMenuKey();
TVEventControl.disableTVPanGesture();
| Problem | Cause | Solution |
|---|---|---|
| ScrollView won't scroll | Regular ScrollView needs focusable items | Use TVTextScrollView for swipe-based scrolling |
| TVEventHandler doesn't fire | No focusable component on screen | Add hasTVPreferredFocus={true} to parent View or ensure a Touchable exists |
| Event fires twice | Press and release both trigger | Known behavior - debounce or track event state |
| InputText can't receive focus | tvOS limitation | Use native input alternatives or custom keyboards |
| Focus leaves FlatList unexpectedly | Virtualization removes focused item | VirtualizedList auto-wraps with TVFocusGuideView - ensure trapFocus enabled |
| Menu button doesn't work | Not enabled by default | Call TVEventControl.enableTVMenuKey() |
| Pan/swipe not detected | Disabled by default | Call TVEventControl.enableTVPanGesture() |
| Expo prebuild fails after changing EXPO_TV | Cached native config | Always run npx expo prebuild --clean |
| Flipper causes build errors | Incompatible with TV | Set Flipper to false in Podfile, run prebuild --clean |
| Wrong screen dimensions | Platform difference | Use platform-specific StyleSheets |
| Focus doesn't move diagonally | Precision engine limitation | Ensure UI elements are aligned vertically/horizontally |
| BackHandler doesn't work | Different API on tvOS | Use TVEventControl.enableTVMenuKey() for menu/back |
| Parallax not working | Missing props | Add tvParallaxProperties to TouchableHighlight |
| removeClippedSubviews breaks focus | Clipped items lose focus | Set removeClippedSubviews={false} |
import { TVFocusGuideView } from 'react-native';
// Basic usage with auto-focus memory
<TVFocusGuideView autoFocus>
<TouchableOpacity>Item 1</TouchableOpacity>
<TouchableOpacity>Item 2</TouchableOpacity>
</TVFocusGuideView>
// Trap focus within container
<TVFocusGuideView
trapFocusUp
trapFocusDown
trapFocusLeft
trapFocusRight
>
{/* Focus cannot escape this container */}
</TVFocusGuideView>
// Custom focus destinations
<TVFocusGuideView destinations={[buttonRef.current]}>
{/* Guides focus to specific elements */}
</TVFocusGuideView>
| Prop | Description |
|---|---|
autoFocus | Remembers last focused child, restores on revisit |
trapFocusUp/Down/Left/Right | Prevents focus from leaving in that direction |
destinations | Array of refs to guide focus toward |
focusable | When false, view and children not focusable |
import { TVTextScrollView } from 'react-native';
// Use instead of ScrollView for non-focusable content
<TVTextScrollView>
<Text>Long text content that should scroll with swipe...</Text>
</TVTextScrollView>
<TouchableHighlight
tvParallaxProperties={{
enabled: true,
magnification: 1.1,
pressMagnification: 1.0,
shiftDistanceX: 5,
shiftDistanceY: 5,
}}
>
<Image source={poster} />
</TouchableHighlight>
These components are disabled or suppressed on Apple TV:
StatusBarSliderSwitchWebView (limited support)<TouchableOpacity hasTVPreferredFocus={true}>
Default Focused Item
</TouchableOpacity>
<TouchableOpacity
ref={button1Ref}
nextFocusRight={button2Ref.current}
nextFocusDown={button3Ref.current}
>
Button 1
</TouchableOpacity>
// Good: Capture at parent level
function Screen() {
useTVEventHandler((evt) => {
// Handle all events here, delegate to children
});
return <View>{/* children */}</View>;
}
// Bad: Each small component handles its own events
function SmallButton() {
useTVEventHandler((evt) => { /* ... */ }); // Avoid this pattern
}
const FocusContext = createContext({ focusedId: null, setFocused: () => {} });
function FocusProvider({ children }) {
const [focusedId, setFocused] = useState(null);
return (
<FocusContext.Provider value={{ focusedId, setFocused }}>
{children}
</FocusContext.Provider>
);
}
# Must be set BEFORE prebuild
export EXPO_TV=1
# Always clean when changing this variable
npx expo prebuild --clean
| Error | Solution |
|---|---|
| "EXPO_TV not recognized" | Ensure using Expo SDK 50+ |
| Build fails after toggling EXPO_TV | Run npx expo prebuild --clean |
| Flipper errors | Disable Flipper in ios/Podfile |
| Dev menu not showing | Use SDK 54+ with RNTV 0.81 for TV dev menu support |
import { Platform } from 'react-native';
// Check if running on any TV
if (Platform.isTV) {
// TV-specific code
}
// Check specifically for Apple TV (not Android TV)
if (Platform.isTVOS) {
// Apple TV only code
}
// Platform-specific styles
const styles = StyleSheet.create({
container: {
padding: Platform.isTVOS ? 48 : 16,
},
});
onFocus/onBlur handlers to debug focus flowThis error affects all TV platforms including Apple TV when using Expo.
Symptoms:
ERROR TypeError: Cannot read property 'displayName' of undefinedCommon Causes & Fixes:
Wrong import in index.js (Most Common)
// ❌ WRONG - Named import when App uses default export
import { App } from './App';
// ✅ CORRECT - Default import
import App from './App';
Metro cache corruption
pkill -f "expo" 2>/dev/null || true
rm -rf node_modules/.cache /tmp/metro-* /tmp/haste-map-*
npx expo start --clear
react-tv-space-navigation v6 missing configuration
src/configureRemoteControl.ts:import { SpatialNavigation } from 'react-tv-space-navigation';
SpatialNavigation.configureRemoteControl({
remoteControlSubscriber: (callback) => () => {},
remoteControlUnsubscriber: () => {},
});
import './src/configureRemoteControl';# ❌ May cause SDK version issues on TV simulators
npx expo start
# ✅ Correct for TV development
npx expo run:ios # Apple TV
npx expo run:android # Android TV
# or
npx expo start --dev-client
# List available simulators
xcrun simctl list devices available | grep -i tv
# Boot Apple TV simulator
xcrun simctl boot "Apple TV"
# Run app
npx expo run:ios --device "Apple TV"
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience