Title: React Native Mobile — LearnCoachAssist

Q: What is the default flex direction in a React Native View container?
A: The default flexDirection is 'column' in React Native, which differs from the web's default of 'row'. Children stack vertically from top to bottom unless you change flexDirection to 'row', 'row-reverse', or 'column-reverse'.

Q: How do you make a Text component take up the full available width of its parent?
A: Apply style={{flex: 1}} or alignSelf: 'stretch' to the Text component. Without these, Text only wraps its content. flex: 1 grows the component to fill remaining space along the main axis.

Q: What is the purpose of the SafeAreaView component?
A: SafeAreaView renders content within device areas not covered by notches, status bars, or home indicators. It's primarily useful on iOS devices with notches and works best with the react-native-safe-area-context library for cross-platform handling.

Q: Explain the difference between useState and useRef for storing mutable values.
A: useState triggers a re-render when updated and is meant for state that affects the UI. useRef returns a mutable object (.current) that persists across renders without causing re-renders, ideal for storing references like timer IDs or previous values.

Q: How does React Navigation's Stack.Navigator differ from Tab.Navigator?
A: Stack.Navigator manages a stack of screens where users push and pop views, typically used for hierarchical navigation flows. Tab.Navigator displays a tab bar at the bottom (or top) for switching between peer-level screens, like in a settings interface.

Q: What does the useEffect cleanup function do and when does it run?
A: The cleanup function returned from useEffect runs before the component unmounts and before the effect re-runs (if dependencies change). It's used to unsubscribe from listeners, cancel timers, or abort network requests to prevent memory leaks.

Q: How do you perform an HTTP GET request in React Native?
A: Use the fetch API: fetch('https://api.example.com/data').then(res => res.json()).then(data => console.log(data)).catch(err => console.error(err)). For more advanced features, use the axios library which supports interceptors and automatic JSON parsing.

Q: What is Expo and why might developers choose it?
A: Expo is a framework and platform for React Native that provides prebuilt native modules, easier setup, OTA updates, and tools like Expo Go for quick testing. It reduces native configuration but historically limited access to custom native code (now improved with dev clients).

Q: How do you access the device camera in a React Native app?
A: Use expo-image-picker (in Expo) or react-native-image-picker. Request permissions with PermissionsAndroid on Android or via the library's built-in request method on iOS, then call launchCameraAsync or launchCamera to capture images or videos.

Q: What is the difference between controlled and uncontrolled components?
A: Controlled components have their value managed by React state via value and onChange props. Uncontrolled components store their own state internally and are accessed via refs (like defaultValue). Controlled components give more predictable behavior and validation.

Q: How do you style components conditionally based on state in React Native?
A: Create a style object that includes conditional properties: style={[styles.button, isActive && styles.activeButton]}. You can also build the style dynamically inside the component: const dynamicStyle = {backgroundColor: enabled ? 'blue' : 'gray'}.

Q: What is the useCallback hook used for?
A: useCallback returns a memoized version of a callback function that only changes if its dependencies change. It prevents unnecessary re-creation of functions on every render, which is useful when passing callbacks to memoized child components to avoid re-renders.

Q: How do you handle deep linking in React Navigation?
A: Configure linking prop in NavigationContainer with a config object mapping URL paths to screens, e.g., {prefixes: ['myapp://'], config: {screens: {Home: 'home', Profile: 'user/:id'}}}. Also configure native iOS/Android URL schemes to route to the app.

Q: What are the key props of the FlatList component?
A: Essential props include data (the array), renderItem (function returning JSX for each item), keyExtractor (returns a unique key per item), and optional ItemSeparatorComponent, ListHeaderComponent, ListFooterComponent, and onEndReached for infinite scroll.

Q: How do you store data persistently on a device in React Native?
A: Options include AsyncStorage for simple key-value pairs, Expo's SecureStore for encrypted data, react-native-mockup-sqlite-storage for relational data, or MMKV for fast key-value storage. Choose based on data size, structure, and security needs.

Q: What is the role of the Pressable component vs TouchableOpacity?
A: Pressable is a more modern, flexible component supporting advanced press handling (onPressIn, onPressOut, onLongPress, hit slop, press retention offset). TouchableOpacity is older, simpler, and primarily fades opacity on press. Pressable is now recommended for new code.

Q: How do you detect network connectivity changes in React Native?
A: Use @react-native-community/netinfo library. Import NetInfo and call NetInfo.addEventListener(state => { console.log('Is connected?', state.isConnected); }). It provides real-time updates and access to connection type (wifi, cellular, none).

Q: What is Hermes and why is it beneficial for React Native?
A: Hermes is a JavaScript engine optimized for React Native, enabling faster app startup, reduced memory usage, and smaller app size. It precompiles JavaScript to bytecode and is enabled by default in modern React Native projects.

Q: How do you handle gestures like swipes and pinches in React Native?
A: Use the react-native-gesture-handler library which provides GestureDetector and gesture composers like Pan(), Pinch(), Tap(), and LongPress(). Combine with react-native-reanimated for smooth, worklet-based animations on the UI thread.

Q: What is the difference between useMemo and useCallback?
A: useMemo memoizes a computed value, recomputing only when dependencies change: const result = useMemo(() => compute(a, b), [a, b]). useCallback memoizes a function itself: const fn = useCallback(() => doSomething(a), [a]). useCallback(fn, deps) is equivalent to useMemo(() => fn, deps).

Q: How do you debug a React Native app using Chrome DevTools?
A: Start the app, open the developer menu (shake device or Cmd+D/Ctrl+M in emulator), select 'Debug JS Remotely'. Chrome opens at localhost:8081/debugger-ui. You can inspect elements via React DevTools, set breakpoints, view console logs, and step through code.

Q: What is the purpose of the SectionList component?
A: SectionList renders a list of sectioned data, similar to FlatList but with grouped sections each having a header. You provide sections array (with data and title), renderItem for items, renderSectionHeader for headers, and keyExtractor for unique keys.

Q: How do you create a custom hook in React Native?
A: Define a function starting with 'use', e.g., useFetch. It can call other hooks and return values. Example: function useFetch(url) { const [data, setData] = useState(null); useEffect(() => { fetch(url).then(r => r.json()).then(setData); }, [url]); return data; }

Q: What are the steps to deploy a React Native app to the App Store?
A: Enroll in Apple Developer Program, configure app.json/Info.plist with bundle identifier, generate a distribution certificate and provisioning profile, run expo build:ios or react-native build-ios, archive in Xcode, validate, and submit via App Store Connect for review.

Q: How do you implement pull-to-refresh in a FlatList?
A: Set the refreshing state with useState, define an onRefresh async handler that fetches data and updates state, and pass both to FlatList: . Optionally set colors or tintColor for the spinner.

Q: What is the difference between AsyncStorage and SecureStore?
A: AsyncStorage is an unencrypted, asynchronous key-value store similar to localStorage, suitable for non-sensitive data like user preferences. SecureStore (Expo) uses the iOS Keychain and Android Keystore to encrypt sensitive data like tokens and passwords.

Q: How do you navigate programmatically between screens?
A: Use the navigation prop's methods: navigation.navigate('ScreenName'), navigation.push('ScreenName'), navigation.goBack(), navigation.replace('ScreenName'), or navigation.reset() to reset the stack state. These are accessed in components via useNavigation hook or props.

Q: What is the role of Platform.OS in React Native?
A: Platform.OS returns 'ios' or 'android', letting you write platform-specific code. Use Platform.select({ios: {...}, android: {...}}) for styles or conditionally import components. You can also use Platform.Version to check OS version numbers for compatibility.

Q: How do you add custom fonts to a React Native project?
A: Place .ttf or .otf files in an assets/fonts directory. For bare React Native, update react-native.config.js with assets array and run npx react-native-asset. For Expo, use expo-font's useFonts hook or Font.loadAsync to load fonts from local assets.

Q: What is the difference between React Native CLI and Expo CLI?
A: React Native CLI gives full native control but requires Xcode/Android Studio setup and native dependency management. Expo CLI offers managed workflow with easier setup and OTA updates, historically limiting native modules (now mitigated by Expo Dev Clients and prebuild).

Q: How do you handle form input validation in React Native?
A: Use Formik or react-hook-form libraries for state management and validation, often paired with Yup or Zod schemas. For simpler cases, validate inputs in onChange handlers or use controlled components with error state to display validation messages conditionally.

Q: What is the purpose of the StatusBar component?
A: StatusBar controls the app's status bar appearance: barStyle ('light-content' or 'dark-content'), backgroundColor (Android), hidden, and translucent. It's a component you can place anywhere; React Native maps props to the native status bar settings on each platform.

Q: How do you implement infinite scrolling in a FlatList?
A: Combine onEndReached, onEndReachedThreshold (fraction of list length, e.g., 0.5), and a loading state. When the user nears the end, call onEndReached to fetch more data and append it to the existing data array, showing a spinner via ListFooterComponent.

Q: What are worklets in react-native-reanimated?
A: Worklets are JavaScript functions that run on the UI thread instead of the JS thread, enabling smooth 60fps animations. They're marked with 'worklet' directive at the top and can be passed to animated styles, gestures, or shared values for direct native execution.

Q: How do you configure environment variables in a React Native app?
A: Use react-native-config with a .env file and library setup. Access via Config.API_URL. For Expo, use expo-constants with extra config in app.json, or process.env variables injected at build time via EAS Build secrets for production deployments.

Q: What is the useFocusEffect hook used for in React Navigation?
A: useFocusEffect runs an effect when a screen comes into focus and cleans up when it loses focus, similar to useEffect but tied to navigation focus. It's useful for refetching data, starting subscriptions, or resetting state when navigating to and from screens.

Q: How do you take screenshots or record the device screen in React Native?
A: Use react-native-view-shot for capturing views as images. For screen recording, use react-native-screen-recorder or expo-screen-capture. Both require appropriate permissions and can save output to the device's media library or a specified path.

Q: What is the role of the KeyboardAvoidingView component?
A: KeyboardAvoidingView automatically adjusts its height or position when the keyboard appears, preventing it from covering inputs. Wrap your form content with it and set behavior to 'padding' (iOS), 'height', or 'position' based on platform and layout needs.

Q: How do you handle push notifications in React Native?
A: Use Expo Notifications (managed workflow) or Notifee + react-native-push-notification (bare workflow). Register for push tokens via getExpoPushTokenAsync or FCM/APNs, listen for incoming notifications with listeners, and handle taps to navigate to specific screens.

Q: What is the purpose of the Animated API in React Native?
A: The Animated API creates smooth, declarative animations for opacity, position, scale, and other style values. Use Animated.timing for duration-based, Animated.spring for physics-based, and Animated.Value or Animated.ValueXY as drivers. It's being supplemented by Reanimated for better UI thread performance.

Q: What is the core component used to render text in React Native?
A: The core component is . All text strings must be wrapped inside a component because React Native does not render raw text nodes outside of it. You can nest components for styling spans.

Q: What is the difference between and ?
A: is a non-scrollable container that lays out its children. is a scrollable container that allows content larger than the screen to be scrolled vertically or horizontally. Use FlatList for long lists instead of ScrollView for performance.

Q: How do you pass data from a parent to a child component?
A: You pass data via props, which are read-only attributes set on the child component in JSX, e.g. . The child receives them as a function parameter or destructured object.

Q: What is the initial value behavior of useState when the component re-renders?
A: useState ignores the initial value argument on subsequent renders; only the value returned from the setter function or the original first-render argument is used. This means expensive initial computations should be wrapped in a lazy initializer function.

Q: How does React Navigation's Drawer Navigator differ from Tab Navigator?
A: Drawer Navigator presents screens via a side menu that slides in, typically triggered by a hamburger icon or edge swipe. Tab Navigator shows screens as a persistent bottom (or top) bar of icons. Drawer suits many destinations; tabs suit 3-5 top-level destinations.

Q: What is the purpose of the dependency array in useEffect?
A: The dependency array tells React which values the effect depends on. The effect runs after mount and again whenever any value in the array changes (by Object.is comparison). An empty array means it runs only on mount and cleanup only on unmount.

Q: What is the recommended way to make HTTP requests in modern React Native?
A: Use the fetch API with async/await inside an effect or event handler. For advanced features like interceptors, automatic retries, or request cancellation, use the axios library or a data-fetching hook like useSWR or React Query.

Q: How do you install Expo CLI globally on a machine?
A: Run 'npm install -g expo-cli' for the classic CLI or 'npm install -g eas-cli' for the modern Expo Application Services CLI used for builds and submissions. Node 18+ is recommended.

Q: Which Expo module provides access to the device's GPS location?
A: The expo-location module provides APIs to read the current GPS position, watch position changes, request foreground/background permissions, and geocode addresses. Always request permissions before accessing coordinates.

Q: What is prop drilling and how can you avoid it in React Native?
A: Prop drilling is passing props through many intermediate components that don't use them. Avoid it with React Context for global data, Redux/Zustand for complex state, or component composition (children prop) to skip intermediate layers.

Q: How do you apply multiple style objects to a single component?
A: Pass an array to the style prop: style={[styles.base, isActive && styles.active]}. Later styles override earlier ones when keys collide; falsy values are skipped. You can also use the StyleSheet.create API for performance.

Q: What is the useReducer hook used for?
A: useReducer manages complex local state with multiple sub-values or when the next state depends on the previous one. It accepts (state, action) => newState and returns the current state plus a dispatch function, similar to Redux's pattern.

Q: How do you type a React Navigation route in TypeScript with params?
A: Create a type combining RootStackParamList, then use createNativeStackNavigator(). Declare each screen as a key with its params, e.g. { Profile: { id: string } }, and use RouteProp to read them safely in components.

Q: What does the flex: 1 style do in React Native?
A: flex: 1 tells the component to fill all available space along the main axis of its parent. Combined with flexDirection (default 'column'), it makes the component expand vertically to fill remaining height in the available space.

Q: What is the difference between padding and margin in React Native styles?
A: Padding is the space inside the component's border between the border and content. Margin is the space outside the component, separating it from siblings. Both accept numbers (density-independent pixels) or strings with units.

Q: How do you cancel an in-flight fetch request when a component unmounts?
A: Use AbortController. Pass the controller's signal to fetch(). In the effect cleanup, call controller.abort() to reject the request and prevent setState on an unmounted component, avoiding memory leaks and warnings.

Q: What permission is required to access the camera roll on iOS?
A: On iOS you must add NSPhotoLibraryUsageDescription to Info.plist. On Android, request READ_EXTERNAL_STORAGE (or READ_MEDIA_IMAGES on Android 13+) at runtime using PermissionsAndroid before accessing images via an image picker.

Q: What is an Expo config plugin and when would you write one?
A: A config plugin is a module that modifies app.json/app.config.js before a native build to add permissions, Info.plist entries, AndroidManifest tags, or run arbitrary native code generation. You write one when an Expo module needs extra native setup.

Q: How do you enable Hermes in a React Native CLI project?
A: Edit android/app/gradle.properties and set hermesEnabled=true. In ios/Podfile, set :hermes_enabled => true. Then run pod install for iOS and rebuild. Hermes is enabled by default in newer React Native versions.

Q: What is the LogBox in React Native and how do you disable specific warnings?
A: LogBox is the in-app warning/error console that surfaces during development. Disable warnings globally with LogBox.ignoreAllLogs() (not recommended), or specifically with LogBox.ignoreLogs(['Warning: ...']) to suppress noisy third-party warnings.

Q: What is the difference between StyleSheet.create and inline style objects?
A: StyleSheet.create validates and assigns numeric IDs to styles, sending them to native once for performance. Inline objects are recreated on every render and serialized each time. Use StyleSheet for any non-trivial style reused in the app.

Q: What is a FlashList and why is it faster than FlatList?
A: FlashList (from @shopify/flash-list) recycles native views like RecyclerView/UICollectionView instead of unmounting off-screen items. It dramatically improves performance for large lists, with simpler props than FlatList and built-in recycling.

Q: How does React Navigation handle screen lifecycle by default?
A: By default screens stay mounted in the navigation stack, so state persists when navigating away and back. Use the useFocusEffect hook or unmountOnBlur/freezesOnBlur options to control when effects run and when components unmount.

Q: What is the purpose of the RefreshControl component?
A: RefreshControl wraps a ScrollView/FlatList/ListView to provide pull-to-refresh functionality. Set refreshing to a boolean state and onRefresh to an async function that fetches new data and toggles the state when complete.

Q: How do you handle taps outside a TextInput to dismiss the keyboard?
A: Wrap the screen in a Pressable/TouchableWithoutFeedback with onPress={() => Keyboard.dismiss()}. Alternatively use the Keyboard.dismiss() imperative call in a button's onPress, or set returnKeyType and onSubmitEditing to dismiss on return.

Q: What is the difference between Expo Go and a development build?
A: Expo Go is a sandbox app that runs any Expo project with JS-only code via OTA. A development build is a custom native app you compile that includes your exact native dependencies and Expo modules, needed for libraries Expo Go doesn't support.

Q: What is the purpose of the useLayoutEffect hook?
A: useLayoutEffect fires synchronously after DOM mutations but before the browser paints, allowing you to read layout and re-render immediately. In React Native it's similar to useEffect but blocks paint; use it sparingly for measuring views.

Q: How do you store sensitive data like auth tokens on a device?
A: Use expo-secure-store (or react-native-keychain on bare RN). It stores values in iOS Keychain and Android Keystore with hardware-backed encryption. Avoid AsyncStorage for sensitive data because it is unencrypted and world-readable on rooted devices.

Q: What is the role of the ActivityIndicator component?
A: ActivityIndicator displays a platform-appropriate spinning loader (UIActivityIndicatorView on iOS, ProgressBar on Android). Pass size 'small' or 'large' and color. Use it while loading data, submitting forms, or processing background tasks.

Q: What is the difference between Dimensions.get('window') and Dimensions.get('screen')?
A: 'window' returns the size of the visible app area excluding status bar and other chrome; 'screen' returns the full device screen size. Listen to Dimensions.addEventListener('change', handler) to react to orientation or window-size changes.

Q: How do you configure deep links in a bare React Native iOS project?
A: Add CFBundleURLTypes to Info.plist with the URL scheme, then in AppDelegate handle openURL: to call RCTLinkingManager's openURL and emit a Linking 'url' event. For universal links, add an apple-app-site-association file to your domain.

Q: What is the GestureHandlerRootView and why must it wrap your app?
A: GestureHandlerRootView is a wrapper component from react-native-gesture-handler that initializes the native gesture system. Without it, gestures like pan, pinch, and swipe won't work reliably, especially when composed with the native scroll system.

Q: How do you run a React Native app on a physical Android device?
A: Enable USB debugging in Developer Options, connect via USB, then run 'npx react-native run-android'. For wireless debugging, use 'adb tcpip 5555' and 'adb connect :5555'. Expo users can scan a QR code from Expo Go.

Q: What is EAS Build and how does it differ from local builds?
A: EAS Build is Expo's cloud build service that compiles your app on Expo servers for iOS and Android, handling signing credentials automatically. Local builds require Xcode/Android Studio and manual signing setup but don't need network uploads.

Q: How do you share code between iOS and Android in React Native?
A: All JS/TS code in the root project is shared automatically. Use Platform.select, Platform.OS, or .ios/.android file extensions (Button.ios.js, Button.android.js) to conditionally include platform-specific code. Native modules may need separate implementations.

Q: What is the recommended way to handle orientation changes?
A: Use the Dimensions API with addEventListener('change') to react to size changes, or use onLayout on the root view. Lock orientation with expo-screen-orientation or Info.plist/android:screenOrientation for full control of supported orientations.

Q: What is Fast Refresh in React Native?
A: Fast Refresh is a developer experience feature that hot-reloads edited components while preserving component state. Enabled by default in modern React Native; it falls back to a full reload when a file outside the component tree changes or edits break state.

Q: What is the difference between createStackNavigator and createNativeStackNavigator?
A: createStackNavigator (from @react-navigation/stack) uses a JS-based animated stack with custom transitions. createNativeStackNavigator (from @react-navigation/native-stack) uses UINavigationController on iOS and Fragment on Android, giving native look and better performance.

Q: How do you detect if the app is running in development vs production?
A: Check __DEV__ (a global boolean React Native sets automatically), or use Constants.expoConfig.developmentClient / appOwnership from expo-constants. Many analytics, error reporting, and dev tool features branch on this flag to avoid production overhead.

Q: What is the purpose of AppState in React Native?
A: AppState tells you whether the app is in 'active', 'background', or 'inactive' (iOS only) state. Subscribe with AppState.addEventListener('change', handler) to pause/resume animations, save data when backgrounded, or refresh content when foregrounded.

Q: What is the purpose of the `StyleSheet.create` method in React Native?
A: It creates and validates style objects at render time, returning a numeric ID for each style. It improves performance by passing styles directly to the native bridge instead of serializing JavaScript objects on every render, and provides better error checking for typos in style property names.

Q: What does the `KeyboardAvoidingView` component do and on which platform is it most needed?
A: It adjusts its height, position, or bottom padding to keep the focused input visible when the on-screen keyboard appears. It is most needed on iOS, because iOS pushes the layout up while Android typically handles window resize automatically.

Q: What is the default value of the `behavior` prop on `KeyboardAvoidingView`?
A: The default behavior is `undefined`, which means the component does nothing on Android and uses the legacy `padding` adjustment on iOS. Developers usually explicitly set it to `'height'`, `'padding'`, or `'position'` for predictable behavior.

Q: What is the main difference between `View` and `ScrollView` in React Native?
A: `View` is a non-scrolling container that lays out children using flexbox. `ScrollView` is a scrolling container that allows content larger than the screen to be viewed by swiping, at the cost of rendering all children up front instead of virtualizing them like `FlatList`.

Q: What is the `keyExtractor` prop in `FlatList` used for?
A: It is a function that accepts an item and its index and returns a unique string or number key for that item. It is used by React's reconciliation to identify list items across re-renders, improving performance and preserving component state when the list changes.

Q: What is the purpose of the `removeClippedSubviews` prop on `FlatList`?
A: On Android, it unmounts off-screen `ListItemComponent` instances from the native view hierarchy to save memory. On iOS the implementation is a no-op. It can cause rendering glitches with some custom layouts, so use it with caution.

Q: What is the difference between `onPress` and `onLongPress` event handlers in `Pressable`?
A: `onPress` fires when the user releases the press within the `pressRetentionOffset` and `pressDuration` thresholds. `onLongPress` fires after the user holds the press for at least `delayLongPress` milliseconds (default 500ms) without releasing.

Q: What is the role of the `hitSlop` prop on touchable components like `Pressable`?
A: `hitSlop` extends the touchable area outside the visual bounds of a component. It accepts an object with `top`, `bottom`, `left`, and `right` numbers, making small UI elements easier to tap without enlarging their visible footprint.

Q: What does the `pointerEvents` prop on `View` control?
A: It determines whether a view can be the target of touch events. Possible values are `'auto'` (default), `'none'` (view and children are invisible to touches), `'box-none'` (view itself is invisible but children are), and `'box-only'` (view captures touches but children don't).

Q: What is the purpose of React Native's `AppRegistry` module?
A: `AppRegistry.registerComponent` tells the native runtime which JavaScript component is the root of the application. The native side calls `AppRegistry.runApplication` with that key to mount the React tree and start rendering.

Q: What is the default port for the Metro bundler in React Native?
A: Metro, the default JavaScript bundler for React Native, runs on port 8081 by default. The native app connects to this port in development mode to download the JavaScript bundle from your local machine.

Q: What is the purpose of the `transform` style property in React Native?
A: It applies 2D or 3D transformations to a component, such as `translateX`, `translateY`, `scale`, `rotate`, and `perspective`. Transformations are applied after layout, so they do not affect the surrounding layout of sibling components.

Q: What is the difference between `justifyContent` and `alignItems` in flexbox?
A: `justifyContent` aligns children along the main axis (defined by `flexDirection`, default column). `alignItems` aligns children along the cross axis (perpendicular to the main axis). On a column layout, that means vertical vs horizontal alignment respectively.

Q: What is the default value of `flexDirection` in React Native's flexbox implementation?
A: Unlike the web where it defaults to `'row'`, React Native defaults `flexDirection` to `'column'`. This means children stack vertically by default and you must explicitly set `flexDirection: 'row'` to lay them out horizontally.

Q: What does the `flexShrink` property default to in React Native?
A: React Native follows the CSS spec where `flexShrink` defaults to `1`, but unlike the web it does not default to `0` like some older versions did. However, the RN team has historically used `0` in some releases, so behavior can vary by RN version.

Q: What is the purpose of the `useFocusEffect` hook from React Navigation?
A: It runs an effect when a screen comes into focus and runs its cleanup when the screen loses focus or unmounts. It mirrors `useEffect` but is tied to the screen's focus lifecycle rather than the component's mount lifecycle, which is essential for side effects tied to screen visibility.

Q: What does the `useNavigation` hook return in React Navigation?
A: It returns the navigation prop object for the current screen, allowing you to call methods like `navigate('ScreenName', params)`, `goBack()`, `setOptions()`, `addListener`, and `dispatch` without explicitly passing navigation down through props.

Q: What is the purpose of `react-native-gesture-handler`?
A: It provides a native-driven gesture system that recognizes taps, pans, swipes, pinches, and rotation directly on the UI thread, bypassing the JavaScript bridge. It is required by React Navigation for native stack transitions and enables smooth, responsive gesture interactions.

Q: What is a reanimated worklet and where does it execute?
A: A worklet is a JavaScript function annotated with the `'worklet'` directive that gets serialized and executed on the UI thread instead of the JavaScript thread. This enables 60fps animations and gesture handling without bridge round-trips, which is essential for smooth performance.

Q: What does the `useSharedValue` hook from Reanimated return?
A: It returns a special reactive object that holds a mutable value and can be read or written from both the JavaScript thread and UI thread worklets. Changes to its `.value` property trigger reactive updates in any dependent `useAnimatedStyle` or animation.

Q: What is the purpose of `withTiming` in Reanimated?
A: `withTiming(sharedValue, { duration: 500, easing: Easing.inOut(Easing.ease) })` smoothly animates a shared value from its current value to a target value over a specified duration using an easing curve. It returns the animation object which can be cancelled or chained.

Q: What is the role of `React.Suspense` in React Native?
A: `Suspense` lets components wait for asynchronous resources (like lazy-loaded components or data) before rendering. It displays a fallback UI, typically a loading indicator, while children are suspended, and unmounts it once the children are ready to render.

Q: What does `React.lazy` allow you to do in a React Native app?
A: It enables code-splitting by deferring the import of a component until it is first rendered. Combined with `Suspense`, it reduces the initial bundle size and improves startup time, especially useful for rarely visited screens in a React Navigation stack.

Q: What is `expo-router` and how does it differ from React Navigation?
A: `expo-router` is a file-based routing library built on top of React Navigation. Instead of configuring navigators in code, you create files in an `app/` directory and the file structure becomes your navigation tree, similar to Next.js but for native apps.

Q: What does `Linking.openURL` do in React Native?
A: It opens a URL in the appropriate native application, such as launching a web browser, opening the phone dialer with a `tel:` link, composing an email with a `mailto:` link, or navigating to another app via a custom URL scheme.

Q: What is the purpose of `expo-constants`?
A: It exposes app constants such as `expoConfig`, `appOwnership` (expo/standalone/bare), `platform`, `deviceName`, and environment-specific values. This is useful for conditionally running code based on whether the app is in Expo Go, a dev build, or a production build.

Q: How do you run an Expo app on a physical iPhone using Expo Go?
A: Install the Expo Go app from the App Store, run `npx expo start` in your project, and scan the QR code shown in the terminal with the iPhone's camera. The app will load the JavaScript bundle from your development machine over the local network.

Q: What is `eas build` and what does it produce?
A: `eas build` is Expo's cloud build service that compiles your app into a native `.ipa` for iOS and `.aab` or `.apk` for Android without needing a local Xcode or Android Studio setup. It handles code signing and produces installable artifacts for testing or store submission.

Q: What is `eas submit` used for?
A: `eas submit` uploads a built artifact (`.ipa` or `.aab`) to the Apple App Store Connect or Google Play Console for review and release. It handles authentication credentials and tracks the submission status, integrating with `eas build` outputs.

Q: What is `expo-dev-client` and why would you add it?
A: It is a library that lets you build a custom development binary that includes your project's native code. Unlike Expo Go, which is a sandbox limited to Expo SDK modules, a dev client can include third-party native libraries and your own native modules.

Q: What is `expo-image` and why is it preferred over the built-in `Image`?
A: `expo-image` is a high-performance image component with built-in memory and disk caching, placeholder/blurhash support, and progressive loading. It uses SDWebImage on iOS and Coil on Android, outperforming the default `Image` for lists and large assets.

Q: What is the purpose of the `Modal` component in React Native?
A: `Modal` renders its children as a native overlay above the current screen, useful for dialogs, alerts, sheets, and full-screen forms. The `transparent` prop makes the background see-through, and `animationType` controls fade/slide/slide transitions.

Q: What does the `onRequestClose` prop on `Modal` do?
A: It is a callback fired when the user attempts to dismiss the modal, typically by tapping the hardware back button on Android or doing the iOS edge-swipe gesture when `onOrientationChange` or hardware back triggers it. It must be set or the app may crash on back press.

Q: What is the `BackHandler` API used for in React Native?
A: `BackHandler.addEventListener('hardwareBackPress', callback)` lets you intercept the Android hardware back button. Return `true` from the callback to handle the press yourself and prevent default behavior, or `false` to let the OS navigate back normally.

Q: What is the purpose of `AppState` in React Native?
A: `AppState.addEventListener('change', callback)` notifies your code when the app moves between `'active'`, `'background'`, and `'inactive'` states. This is useful for pausing/resuming tasks, syncing data, or refreshing content when the user returns to the app.

Q: What does `PixelRatio.get()` return and why is it useful?
A: It returns the device pixel density multiplier (e.g., 2 on standard retina, 3 on iPhone Plus). Use it to scale dimensions: `const size = 16 * PixelRatio.getFontScale()` keeps text consistent across devices, and to pick appropriate image resolutions.

Q: What is the `Vibration` API and how do you trigger a short vibration?
A: `Vibration.vibrate(100)` triggers a vibration for 100 milliseconds on supported devices. On iOS, the duration is ignored and it always produces a fixed ~400ms vibration; on Android it respects the passed duration. Pass an array for pattern-based vibrations.

Q: What does the `Share` API do in React Native?
A: `Share.share({ message, title, url })` opens the native share sheet, allowing the user to send content to other apps like Messages, Mail, or social platforms. It returns a promise resolving with the action and activity type the user selected.

Q: What is the difference between `Alert.alert` and a custom `Modal` component?
A: `Alert.alert` uses the native platform alert dialog, requires minimal code, and blocks UI flow until dismissed. A custom `Modal` is rendered with React components, is fully styleable, can contain complex layouts, and supports animations and custom buttons.

Q: What is the purpose of `ToastAndroid` and why is it iOS-incompatible?
A: `ToastAndroid.show(message, duration)` displays a short notification on Android using the OS-native toast widget. It is Android-only because iOS lacks a public toast API; Expo's `expo-haptics` or a custom `Modal` are common cross-platform alternatives for iOS feedback.

Q: How do you create a stack navigator in React Navigation v6?
A: Import createNativeStackNavigator from @react-navigation/native-stack, create a Stack variable with createNativeStackNavigator(), then render with children inside your NavigationContainer wrapper.

Q: What is the default behavior of the keyboardShouldPersistTaps prop on a ScrollView?
A: The prop controls whether the keyboard stays visible after a tap. Default 'never' dismisses the keyboard on any tap; 'handled' keeps it visible if the tap is on a non-handler; 'always' never dismisses it, useful for forms with multiple inputs.

Q: How do you run a React Native app on an iOS simulator using the CLI?
A: With a Mac and Xcode installed, run 'npx react-native run-ios' from the project root. Optionally pass --simulator='iPhone 15' to target a specific device. Metro bundler must be running, started via 'npx react-native start'.

Q: What is the difference between the View and ScrollView components in React Native?
A: View is a non-scrolling layout container. ScrollView wraps content in a scrollable region, automatically handling vertical or horizontal scrolling when children exceed the container size. ScrollView renders all children at once, unlike FlatList.

Q: How do you pass typed params between screens using React Navigation and TypeScript?
A: Declare a RootStackParamList type mapping route names to their param shapes, then use createNativeStackNavigator(). Access params via route.params with proper typing, ensuring type safety across navigation calls.

Q: What is the purpose of Expo's EAS Build service?
A: EAS Build is a hosted cloud service that compiles your managed or bare React Native project into signed iOS IPA and Android AAB/APK files in the cloud, eliminating the need for local Xcode or Android Studio build setups.

Q: How do you detect when the device's orientation changes in React Native?
A: Use the Dimensions API combined with the orientationchange event listener, or use the expo-screen-orientation module's addOrientationChangeListener. The Dimensions.get('window') value updates automatically on rotation.

Q: What is the purpose of the useFocusEffect hook in React Navigation?
A: useFocusEffect runs a useEffect-like callback whenever a screen comes into focus or leaves focus. It accepts a callback that can return a cleanup function, useful for refreshing data or pausing subscriptions on screen transitions.

Q: How do you implement a dark mode theme in a React Native app?
A: Use React Context to provide a theme object, or use libraries like react-native-paper. Apply useColorScheme() from React to detect system preference, then conditionally select light or dark style objects for components.

Q: What is the role of the Modal component in React Native?
A: Modal is a core component that presents content above the enclosing view, blocking interaction with the rest of the app. Use the visible prop to control display, animationType for slide/fade transitions, and transparent for overlays.

Q: How do you bundle JavaScript and assets for a production React Native CLI release?
A: Run 'npx react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle --assets-dest ios' to generate the JS bundle. iOS also requires updating AppDelegate to load from bundle in release mode.

Q: What is the difference between onPress and onLongPress on TouchableOpacity?
A: onPress fires when the user taps and releases within a short duration (default ~130ms). onLongPress fires after the user holds the touch for delayLongPress milliseconds (default 500ms). Both can coexist on the same component.

Q: How do you display an alert dialog in a React Native app?
A: Import { Alert } from 'react-native' and call Alert.alert(title, message, [{text:'OK', onPress: ...}]). On iOS it uses the native UIAlertController; on Android it uses the native AlertDialog via a single button on Android.

Q: What is the purpose of the VirtualizedList underlying FlatList?
A: VirtualizedList implements the windowing/virtualization logic, only rendering items currently in the viewport plus a buffer. FlatList and SectionList extend it, adding item rendering, key extraction, and header/footer support.

Q: How do you add a splash screen to an Expo project?
A: Install expo-splash-screen, call SplashScreen.preventAutoHideAsync() in App.js, then SplashScreen.hideAsync() once resources load. Customize background color, image, and resizeMode via app.json's splash plugin configuration.

Q: What is the role of the PixelRatio.get() function in React Native?
A: PixelRatio.get() returns the device pixel density (e.g., 2 on Retina, 3 on @3x). Use it to convert dp/dip sizes to physical pixels: const size = 16 * PixelRatio.getFontScale() * PixelRatio.get() for accurate cross-device styling.

Q: How do you handle back button presses on Android in React Native?
A: Use BackHandler.addEventListener('hardwareBackPress', handler) in useEffect with cleanup to remove. The handler receives no args and should return true to prevent default back behavior, enabling custom navigation logic.

Q: What is the difference between Expo SDK and Expo Go?
A: Expo SDK is the set of native modules and APIs (Camera, Location, Notifications, etc.) you import into your project. Expo Go is the sandbox app that bundles all SDK modules, letting you run managed projects without a native build.

Q: How do you use the Pressable component's hit slop property?
A: hitSlop extends the touchable area beyond the visual bounds. Pass an object like {top:10, bottom:10, left:10, right:10} or a single number for uniform expansion, improving tap targets without altering layout or visual size.

Q: What is the purpose of react-native-gesture-handler?
A: It provides a native-driven gesture system using the platform's gesture recognizers (UIGestureRecognizer on iOS, GestureDetector on Android). It's required by React Navigation and enables performant swipe, pinch, pan, and tap handlers.

Q: How do you implement offline-first data sync in React Native?
A: Use WatermelonDB or SQLite with an outbox pattern: write mutations locally first, queue sync operations, then push to server when connectivity returns via NetInfo. Resolve conflicts using timestamps or version vectors server-side.

Q: What is the role of the Linking module in React Native?
A: Linking provides interaction with both incoming and outgoing app links. Use Linking.openURL to launch external URLs and Linking.canOpenURL to verify scheme support. Handle deep links via Linking.addEventListener('url', handler) at app root.

Q: How do you optimize FlatList performance for large datasets?
A: Set getItemLayout if items have fixed height, use keyExtractor with stable IDs, set initialNumToRender and maxToRenderPerBatch, enable removeClippedSubviews on Android, and wrap item in React.memo with arePropsEqual to skip re-renders.

Q: What is the purpose of Reanimated's runOnJS worklet helper?
A: runOnJS schedules a regular JavaScript function to run on the main JS thread from within a worklet running on the UI thread. Use it for updating React state or calling non-worklet APIs after completing a native-driven animation or gesture.

Q: How do you configure a custom App Icon in a React Native CLI iOS project?
A: Replace images in ios/YourApp/Images.xcassets/AppIcon.appiconset with @1x, @2x, @3x sized PNGs (1024, 120, 180px). Run the project; Xcode automatically applies them. Android requires ic_launcher.png replacements in mipmap-* directories.

Q: What is the difference between StyleSheet.hairlineWidth and a 1-pixel border?
A: StyleSheet.hairlineWidth returns the thinnest width the device can display (typically 0.5 on Retina, 1 on standard). It prevents borders from looking too thick on high-density screens, ensuring a consistent visual line weight across devices.

Q: How do you implement biometric authentication (Face ID/Touch ID) in React Native?
A: Use expo-local-authentication's authenticateAsync() with BiometricSecurityLevel options, or react-native-biometrics' simplePrompt(). Wrap the call in a try/catch handling userCancel and authenticationError codes gracefully.

Q: What is the purpose of the AppState module in React Native?
A: AppState reports the application state: 'active', 'background', 'inactive' (iOS only, during transitions), or 'unknown'. Use addEventListener('change', handler) to pause timers, save state, or refresh data when the app returns to foreground.

Q: How do you configure deep linking for a custom URL scheme in React Navigation?
A: Pass a linking prop to NavigationContainer with prefixes: ['myapp://'], then config mapping screens to paths: { screens: { Home: '', Profile: 'user/:id' } }. React Navigation parses incoming URLs and dispatches matching routes.

Q: What is the role of the LayoutAnimation API in React Native?
A: LayoutAnimation automatically animates the next layout change on all views in the next render cycle. Configure with LayoutAnimation.configureNext({duration: 250, update: {type: 'easeInEaseOut'}}) before calling setState to animate transitions.

Q: How do you share content from a React Native app to other apps?
A: Use the built-in Share API: Share.share({title, message, url}) returns a promise with action and activityType. For more control, use expo-sharing on iOS/Android or react-native-share to invoke specific social share sheets.

Q: What is the difference between Expo's managed and bare workflow?
A: Managed workflow uses Expo Go and config plugins, with no native code access. Bare workflow generates ios/android directories for custom native modules. Prebuild command can convert between them, with EAS Build supporting both.

Q: How do you handle iOS Safe Area insets in non-Expo React Native projects?
A: Use react-native-safe-area-context library: wrap app in SafeAreaProvider, then use useSafeAreaInsets() hook or component. This handles notches, home indicators, and dynamic insets on orientation change.

Q: What is the purpose of the Pressable state callback for pressed styling?
A: Pass a function to style prop instead of an object: style={({pressed}) => [styles.base, pressed && styles.pressed]}. The function receives pressed, hovered (web), and focused states, enabling per-state visual feedback declaratively.

Q: How do you test React Native components using Jest and React Native Testing Library?
A: Install @testing-library/react-native, render components with render(), query with getByText/getByTestId, fire user events with fireEvent.press(), and assert behavior. Mock native modules via jest.mock('module-name').

Q: What is the role of the new architecture (Fabric/TurboModules) in React Native?
A: Fabric is the new rendering system using synchronous JSI calls for layout and shadow tree updates. TurboModules enable lazy-loaded native modules with type-safe JSI specs. Together they improve startup time, memory use, and concurrent rendering.

Q: How do you configure OTA (Over-The-Air) updates with Expo?
A: Use expo-updates: run 'eas update:configure', then 'eas update --branch production --message "fix"' to publish. Configure updates URL and runtime version in app.json. Updates download on next app launch and apply automatically.

Q: What is the difference between useEffect and useLayoutEffect timing?
A: useEffect runs asynchronously after paint, allowing browser/native to potentially flicker. useLayoutEffect runs synchronously after DOM/view mutations but before paint, ideal for measuring layout, setting scroll position, or preventing visual flicker.

Q: How do you implement accessibility labels and hints in React Native?
A: Add accessibilityLabel='Descriptive name' for screen readers, accessibilityHint='What activating does' for action context, and accessibilityRole='button' to communicate element type. Group related elements with accessibilityElementsHidden for cleaner navigation.

Q: What is the purpose of react-native-vector-icons integration steps?
A: Install the package, link fonts: iOS adds UIAppFonts entries in Info.plist with font file names; Android copies .ttf files to android/app/src/main/assets/fonts. Then import Icon from 'react-native-vector-icons/MaterialIcons' to render .

Q: What is the purpose of the StyleSheet.create method in React Native?
A: It creates a frozen style object from a JavaScript object. This validates styles, prevents accidental mutation, and improves performance by allowing the styles to be sent across the native bridge only once and referenced by ID, rather than passing the entire style object on every render.

Q: How do you render a list of items where each item can vary in height in React Native?
A: FlatList works best for fixed or similar heights, but for variable heights use SectionList for grouped data or FlatList with getItemLayout only if heights are known. For unknown variable heights, FlatList still works—it dynamically measures items, though at a performance cost compared to FlashList.

Q: What is the difference between the ScrollView and FlatList components?
A: ScrollView renders all child components at once, making it suitable for small lists or scrolling content. FlatList virtualizes its children, only rendering items currently visible on screen, which makes it far more performant for long lists of data.

Q: How do you trigger an imperative action when a screen first mounts in React Navigation v6?
A: Use the useFocusEffect hook with a useCallback that calls React.useEffect internally. This runs the effect every time the screen comes into focus, ensuring imperative actions like fetching data or starting animations run when needed.

Q: What does the accessibilityLabel prop do in React Native?
A: It provides a textual label for screen readers, used by assistive technologies like VoiceOver on iOS and TalkBack on Android. When the element receives accessibility focus, the label is read aloud, improving usability for visually impaired users.

Q: How do you run a React Native app on a physical iOS device using the CLI?
A: Connect the iPhone via USB, open the .xcworkspace file in Xcode, set your Apple Developer signing team in the project settings, select the device as the build target, and click Run. The device must be trusted and provisioning profiles configured.

Q: What is the ImageBackground component used for?
A: ImageBackground is a component that displays an image as the background of its children, similar to CSS background-image. Any nested components render on top of the image, allowing layered UI designs with photos or textures as backgrounds.

Q: How do you share code between iOS and Android in a React Native project?
A: Place platform-agnostic JavaScript or TypeScript files in shared folders like /src or /components. React Native automatically picks the correct implementation based on the platform extension: file.ios.js for iOS, file.android.js for Android, and file.js for fallback.

Q: What is the TouchableHighlight component and how does it differ from TouchableOpacity?
A: TouchableHighlight darkens the background of the view when pressed, providing visual feedback. TouchableOpacity reduces the opacity of the entire view on press. TouchableHighlight requires an underlayColor prop and cannot have a backgroundColor on the wrapped element.

Q: How do you detect orientation changes in a React Native app?
A: Use the Dimensions API's addEventListener('change', handler) method. The handler receives an object containing window and screen dimensions. You can also use the react-native-orientation-locker or expo-screen-orientation libraries for more granular control.

Q: What is the purpose of the Modal component in React Native?
A: Modal renders content above the current view, blocking interaction with the underlying UI until dismissed. It's used for dialogs, alerts, full-screen takeovers, and bottom sheets, with configurable animationType, transparent, and onRequestClose props for back-button handling on Android.

Q: How do you create a controlled text input in React Native?
A: Use the TextInput component with its value prop bound to component state and onChangeText handler updating that state: const [text, setText] = useState(''); . The component fully controls the input value.

Q: What is the Pressable component's hitRect prop used for?
A: hitRect extends or reduces the touchable area of a Pressable beyond its visual bounds. It takes an object with top, bottom, left, right numeric values, allowing you to make small UI elements easier to tap without enlarging their visual footprint.

Q: How do you handle errors globally in a React Native application?
A: Use ErrorUtils.setGlobalHandler in the entry file to catch uncaught JavaScript errors. For native crashes, integrate services like Sentry, Bugsnag, or Firebase Crashlytics. Combine with React's componentDidCatch in error boundary components for render-time errors.

Q: What is the key difference between the New Architecture (Fabric) and the legacy architecture?
A: The New Architecture uses Fabric renderer and TurboModules with synchronous JSI calls, eliminating the asynchronous bridge. It enables concurrent rendering, better type safety, automatic layout, and improved performance with features like useNativeDriver animations on the UI thread.

Q: How do you navigate to a screen with parameters in React Navigation?
A: Call navigation.navigate('RouteName', { itemId: 86, otherParam: 'anything' }). The receiving screen accesses parameters via the route prop: const { itemId } = route.params; In TypeScript, declare the param list in the navigator's generic type.

Q: What is the AppState API used for in React Native?
A: AppState tells you whether the app is in the foreground, background, or inactive. Use AppState.addEventListener('change', handler) to detect transitions. This is useful for pausing video playback, stopping location tracking, or managing push notification badges when the app backgrounds.

Q: How do you add a gradient background to a React Native view?
A: Use the expo-linear-gradient or react-native-linear-gradient library. Import LinearGradient, then use it as a wrapper: Inside. CSS-style linear-gradient is not supported natively.

Q: What is the purpose of the KeyboardAvoidingView component?
A: It automatically adjusts the layout of its children when the keyboard appears, preventing the keyboard from covering input fields. It works with behavior='padding', 'height', or 'position' props and pairs with softwareKeyboardLayoutMode on Android for full effect.

Q: How do you write a simple unit test for a React Native component using Jest?
A: Import the component and use react-test-renderer or @testing-library/react-native. Example: test('renders correctly', () => { const tree = render().toJSON(); expect(tree).toMatchSnapshot(); }). Mock native modules in jest.setup.js.

Q: What is Expo Application Services (EAS) used for?
A: EAS is a suite of hosted services from Expo for building and submitting React Native apps. EAS Build compiles apps in the cloud for iOS and Android, EAS Submit uploads them to stores, and EAS Update delivers over-the-air JavaScript updates without store review.

Q: How do you make a React Native app responsive to different screen sizes?
A: Use Dimensions.get('window') or the useWindowDimensions hook to read screen size, then conditionally render layouts or apply percentage-based styles. Combine flexbox with flex: 1 properties, and consider using a library like react-native-responsive-screen for scaling utilities.

Q: What is the difference between useState and useReducer?
A: useState manages simple, independent state values with direct updates. useReducer is preferable for complex state with multiple sub-values or when next state depends on previous state. useReducer uses a reducer function pattern similar to Redux, centralizing update logic.

Q: How do you handle the Android hardware back button in React Native?
A: Use the BackHandler API with BackHandler.addEventListener('hardwareBackPress', callback). The callback returns true to prevent default behavior. In React Navigation, screen options like headerBackTitle, gestureEnabled, and the useFocusEffect hook manage back behavior.

Q: What is the PixelRatio API used for?
A: PixelRatio provides access to the device's pixel density, useful for sizing images and detecting high-resolution screens. Use PixelRatio.get() to read density, and PixelRatio.getFontScale() to respect the user's preferred text size setting for accessibility.

Q: How do you implement dark mode support in a React Native app?
A: Use the useColorScheme hook (added in RN 0.65) which returns 'light', 'dark', or null. Define theme objects with color palettes and apply them conditionally: const theme = useColorScheme() === 'dark' ? darkTheme : lightTheme. Persist user override via AsyncStorage.

Q: What is the purpose of the Pressable's onPressIn and onPressOut events?
A: onPressIn fires when a touch begins, before onPress. onPressOut fires when the touch is released, whether or not it leaves the element. These are useful for immediate visual feedback, press-and-hold interactions, and tracking touch timing for custom animations.

Q: How do you authenticate a user with biometrics in React Native?
A: Use the expo-local-authentication or react-native-biometrics library. Call authenticateAsync() with options like promptMessage and fallbackLabel. iOS uses Face ID/Touch ID, Android uses BiometricPrompt. Always provide a fallback to device passcode for unsupported devices.

Q: What is the role of Metro bundler in React Native?
A: Metro is the JavaScript bundler for React Native. It transforms JSX, TypeScript, and modern JavaScript into a bundle that the native runtime can execute. It supports hot module replacement for fast refresh during development and tree-shaking in production builds.

Q: How do you create a release build APK for Android in a React Native CLI project?
A: Run cd android && ./gradlew assembleRelease. The unsigned APK appears in android/app/build/outputs/apk/release/. For a signed AAB, configure signingConfigs in android/app/build.gradle and run ./gradlew bundleRelease, outputting to build/outputs/bundle/release.

Q: What is the difference between the Animated.Value and Animated.ValueXY?
A: Animated.Value holds a single numeric value for animations like opacity or translation along one axis. Animated.ValueXY holds two values (x and y), commonly used for pan gestures or 2D transforms like scaling. Both can be animated with timing, spring, or decay.

Q: How do you handle file uploads with progress tracking in React Native?
A: Use XMLHttpRequest or the fetch API with a Blob. For progress, use the onUploadProgress callback in axios. Alternatively, libraries like react-native-background-upload or Expo's FileSystem.uploadAsync handle uploads with progress events, supporting background continuation.

Q: What is the Linking API in React Native used for?
A: Linking allows the app to interact with other apps and the system. Use Linking.openURL('https://...') to launch URLs in the browser, Linking.canOpenURL to check capabilities, and Linking.openSettings() to deep-link to the OS settings page for permission management.

Q: How do you configure deep links for iOS in a React Native project?
A: Open Info.plist, add a CFBundleURLTypes array with CFBundleURLSchemes containing your custom scheme. React Navigation handles linking via the linking prop in NavigationContainer, mapping screens to URLs. Universal Links require associated-domains entitlement and apple-app-site-association file.

Q: What is the purpose of the Animated.spring function?
A: Animated.spring creates physics-based animations that simulate spring motion with damping and stiffness parameters. Unlike timing, it doesn't take a duration—the spring settles naturally based on physical properties. It's ideal for natural-feeling gestures and interactive animations.

Q: How do you detect memory leaks in a React Native application?
A: Use the Performance Monitor in development to watch memory usage. Profile with Android Studio's Memory Profiler or Xcode Instruments for native leaks. The react-native-flipper or react-query-devtools help track component subscriptions. Watch for unmounted subscriptions and uncleared timers.

Q: What is the useContext hook and how does it help in React Native?
A: useContext accesses values from a React context without nesting Consumer components. Wrap the app in and read with const value = useContext(MyContext). It eliminates prop drilling for themes, auth state, or locale settings across the component tree.

Q: How do you secure API keys in a React Native app?
A: Store keys in environment variables via process.env.API_KEY, set in .env files at build time. For runtime, use a secure backend proxy that holds secrets server-side. Never hardcode keys in JavaScript bundles—APK/IPA extraction is trivial. Use react-native-config or expo-constants for build-time injection.

Q: What is the difference between Hot Reloading and Fast Refresh in React Native?
A: Hot Reloading was the legacy mechanism that injected updated modules while preserving state but had bugs with hooks. Fast Refresh is the modern replacement that reliably preserves component state across edits, supports function components and hooks, and falls back to full reload when state preservation is impossible.

Q: How do you add a vector icon to a React Native project?
A: Install react-native-vector-icons, link fonts in Info.plist (iOS) and android/app/build.gradle (Android), then import: import Icon from 'react-native-vector-icons/MaterialIcons'; . Expo projects use @expo/vector-icons built in with the Expo SDK.