Version: 5.0.0-beta.5
Summary
The DEV warnings in usePropsErrorBoundary suggest using style={{ width: '100%' }} or flex: 1 as valid ways to specify the container size, but the detection logic only accepts a numeric width/height. As a result, those exact suggestions do not silence the warnings.
Where
src/hooks/usePropsErrorBoundary.ts:
const { width: styleWidth, height: styleHeight } = StyleSheet.flatten(style) || {};
// ...
const hasHorizontalContainerSize =
typeof styleWidth === "number" || typeof width === "number";
const hasVerticalContainerSize =
typeof styleHeight === "number" || typeof height === "number";
if (!vertical && !hasHorizontalContainerSize && !warnedRefs.horizontal) {
console.warn(
"[react-native-reanimated-carousel] Horizontal mode did not specify `width` in `style`, will fall back to automatic measurement mode."
);
}
if (!vertical && typeof itemWidth === "number" && !hasHorizontalContainerSize && !warnedRefs.itemWidth) {
console.warn(
"[react-native-reanimated-carousel] `itemWidth` sets the snapping page size, not the container width. Consider setting container width via `style` (e.g. `style={{ width: '100%' }}` or `flex: 1`)."
);
}
Reproduction
<Carousel
style={{ width: '100%', height: 190 }} // string width
itemWidth={280}
data={data}
renderItem={renderItem}
/>
Both warnings fire even though width: '100%' is explicitly set in style. The same happens with flex: 1, which doesn't produce a width key at all after StyleSheet.flatten.
Version: 5.0.0-beta.5
Summary
The DEV warnings in usePropsErrorBoundary suggest using style={{ width: '100%' }} or flex: 1 as valid ways to specify the container size, but the detection logic only accepts a numeric width/height. As a result, those exact suggestions do not silence the warnings.
Where
src/hooks/usePropsErrorBoundary.ts:Reproduction
Both warnings fire even though width: '100%' is explicitly set in style. The same happens with flex: 1, which doesn't produce a width key at all after StyleSheet.flatten.