Skip to content

[iOS] AutoSkeletonView crashes on mount with "index 0 beyond bounds for empty array" (RCTUIManager flushUIBlocksWithCompletion) #20

Description

@shahadansargallery

Describe the bug
AutoSkeletonView crashes the app on iOS immediately on mount when isLoading is true, with a native exception thrown from RCTUIManager flushUIBlocksWithCompletion:. The crash is not related to the shape or styling of the children — it reproduces both with a bare <Text> and with a <Text> wrapped in a styled <View>.

Exception:
Exception thrown while executing UI block: *** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty array

Stack trace:
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke (RCTUIManager.mm:1170)
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.195
__RCTExecuteOnMainQueue_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_drain.cold.7
_dispatch_main_queue_drain
_dispatch_main_queue_callback_4CF
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
__CFRunLoopRun
_CFRunLoopRunSpecificWithOptions
GSEventRunModal
-[UIApplication _run]
UIApplicationMain

To Reproduce
Steps to reproduce the behavior:

  1. Install react-native-auto-skeleton (v0.1.32) in a React Native / Expo iOS project.
  2. Create a screen with the following minimal code:
import { View, Text } from 'react-native'
import React from 'react'
import { AutoSkeletonView } from 'react-native-auto-skeleton';

const NewProductDetailsScreen = () => {
  const isLoading = true;
  return (
    <AutoSkeletonView isLoading={isLoading}>
      <View style={{ padding: 16 }}>
        <Text>NewProductDetailsScreen</Text>
      </View>
    </AutoSkeletonView>
  )
}

export default NewProductDetailsScreen
  1. Also reproduces with an even simpler version (no wrapping View, no styles):
<SafeAreaView>
  <AutoSkeletonView isLoading={isLoading}>
    <Text>NewProductDetailsScreen</Text>
  </AutoSkeletonView>
</SafeAreaView>
  1. Render this screen with isLoading set to true on initial mount.
  2. App crashes immediately with the NSRangeException above.

Expected behavior
AutoSkeletonView should render a skeleton placeholder for the wrapped content without crashing, even for a minimal single-child tree.

Screenshots
Attached below — two RedBox crash screens showing the identical exception for both variants of the repro code.

Desktop (please complete the following information):

  • OS: Mac
  • RN Version: 0.77

Smartphone (please complete the following information):

  • Device: iOS Simulator
  • OS: iOS (RedBox captured on device running the app)
  • Browser: N/A (native RN app)
  • Version: react-native-auto-skeleton 0.1.32

Additional context

  • Crash is 100% reproducible on first render whenever isLoading starts as true.
  • Not fixed by wrapping the child in a styled View with explicit padding — same trace with or without a wrapper, and with or without SafeAreaView.
  • Appears related to open issue basic example does not work - expo sdk 53 #15 ("basic example does not work - expo sdk 53"), which reports the same kind of failure on a minimal example.
  • Crash originates inside the library's native UI block registered via RCTExecuteOnMainQueue, suggesting it accesses an empty subviews/children array before the wrapped view's layout has been committed.
Image

Activity

  1. pioner92 commented on Oct 8, 2026

    @pioner92
    Owner

    Fixed in v0.1.33 (#22). On the Old Architecture the gradient colors reached native as unprocessed strings, were dropped during conversion, and the empty array was then indexed — that is the index 0 beyond bounds for empty array crash. Colors are now processed by the view config, and the gradient falls back to the defaults if fewer than two colors arrive. Please reopen if you still see it on 0.1.33.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions