Description
When using @storybook/addon-ondevice-controls v10.1.1 with @storybook/react-native v10.1.1 on iOS, boolean controls in the controls panel do not respond to taps. The Switch UI does not toggle and the value is not updated.
This issue only occurs on iOS - the same controls work correctly on Android.
Behavior
Tapping on the boolean Switch control in the controls panel does nothing
The Switch UI does not visually toggle
The component's prop is not updated
Other control types (select, text, number) work correctly on iOS
Environment
@storybook/react-native: 10.1.1
@storybook/addon-ondevice-controls: 10.1.1
@storybook/addon-ondevice-actions: 10.1.1
@storybook/react: 10.1.9
storybook: 10.1.9
react-native: 0.81.4
react: 19.1.0
@gorhom/bottom-sheet: 5.2.6
react-native-gesture-handler: 2.28.0
Node.js: 22.14.0
iOS: Simulator/Device (both affected)
Steps to Reproduce
Set up Storybook for React Native with the Controls addon
Create a story with a boolean control:
Story file example:
import { Meta, StoryFn } from '@storybook/react-native';
import { MyComponent, MyComponentProps } from './MyComponent';
export default {
title: 'MyComponent',
component: MyComponent,
argTypes: {
showStatus: { control: { type: 'boolean' } },
disabled: { control: { type: 'boolean' } },
},
} as Meta;
export const Default: StoryFn<MyComponentProps> = (props) => (
<MyComponent {...props} />
);
Default.args = {
showStatus: true,
disabled: false,
};
.rnstorybook/main.ts:
const main = {
stories: ['../src/**/*.stories.tsx'],
addons: ['@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-actions'],
};
export default main;
Run the app on iOS
Navigate to the story in Storybook
Open the controls panel (tap the edit icon)
Try to tap on any boolean Switch control
Expected: Switch toggles and component updates
Actual: Nothing happens - Switch does not respond to tap
Investigation
Looking at the boolean control implementation in
@storybook/addon-ondevice-controls/dist/types/Boolean.js
:
const BooleanType = ({ arg, onChange }) => (
(0, jsx_runtime_1.jsx)(Container, {
children: (0, jsx_runtime_1.jsx)(react_native_1.Switch, {
testID: arg.name,
onValueChange: () => onChange(!arg.value),
value: arg.value
})
})
);
The Switch component uses React Native's native Switch. The issue appears to be a gesture handler conflict with @gorhom/bottom-sheet that Storybook uses for the controls panel. The bottom sheet's pan/tap gesture handlers intercept touch events intended for the Switch on iOS.
This is a known pattern of gesture conflicts documented in react-native-gesture-handler and @gorhom/bottom-sheet issues.
Possible Solutions
Wrap the Switch in a TouchableOpacity or Pressable that handles the tap and calls onChange, with the Switch having pointerEvents="none"
Use gesture handler configuration to prevent the bottom sheet from intercepting Switch touches
Replace the native Switch with a custom toggle component that doesn't rely on native gesture handling
Workarounds
Use boolean controls on Android (they work correctly)
Use select control type with ['true', 'false'] options as a temporary workaround
Description
When using @storybook/addon-ondevice-controls v10.1.1 with @storybook/react-native v10.1.1 on iOS, boolean controls in the controls panel do not respond to taps. The Switch UI does not toggle and the value is not updated.
This issue only occurs on iOS - the same controls work correctly on Android.
Behavior
Tapping on the boolean Switch control in the controls panel does nothing
The Switch UI does not visually toggle
The component's prop is not updated
Other control types (select, text, number) work correctly on iOS
Environment
@storybook/react-native: 10.1.1
@storybook/addon-ondevice-controls: 10.1.1
@storybook/addon-ondevice-actions: 10.1.1
@storybook/react: 10.1.9
storybook: 10.1.9
react-native: 0.81.4
react: 19.1.0
@gorhom/bottom-sheet: 5.2.6
react-native-gesture-handler: 2.28.0
Node.js: 22.14.0
iOS: Simulator/Device (both affected)
Steps to Reproduce
Set up Storybook for React Native with the Controls addon
Create a story with a boolean control:
Story file example:
.rnstorybook/main.ts:
Run the app on iOS
Navigate to the story in Storybook
Open the controls panel (tap the edit icon)
Try to tap on any boolean Switch control
Expected: Switch toggles and component updates
Actual: Nothing happens - Switch does not respond to tap
Investigation
Looking at the boolean control implementation in
@storybook/addon-ondevice-controls/dist/types/Boolean.js
:
The Switch component uses React Native's native Switch. The issue appears to be a gesture handler conflict with @gorhom/bottom-sheet that Storybook uses for the controls panel. The bottom sheet's pan/tap gesture handlers intercept touch events intended for the Switch on iOS.
This is a known pattern of gesture conflicts documented in react-native-gesture-handler and @gorhom/bottom-sheet issues.
Possible Solutions
Wrap the Switch in a TouchableOpacity or Pressable that handles the tap and calls onChange, with the Switch having pointerEvents="none"
Use gesture handler configuration to prevent the bottom sheet from intercepting Switch touches
Replace the native Switch with a custom toggle component that doesn't rely on native gesture handling
Workarounds
Use boolean controls on Android (they work correctly)
Use select control type with ['true', 'false'] options as a temporary workaround