@storybook/react-native 6.5.0-rc.4 → 6.5.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,28 @@
1
1
  import React from 'react';
2
- import { Text, TouchableWithoutFeedback, Keyboard } from 'react-native';
2
+ import { Text, Keyboard } from 'react-native';
3
3
  import { useStoryContext } from '../../../hooks';
4
4
  import { Box } from '../Shared/layout';
5
+ /**
6
+ * This is a handler for `onStartShouldSetResponder`, which dismisses the
7
+ * keyboard as a side effect but then responds with `false` to the responder
8
+ * system, so as not to start actually handling the touch.
9
+ *
10
+ * The objective here is to dismiss the keyboard when the story view is tapped,
11
+ * but in a way that won't interfere with presses or swipes. Using a
12
+ * `Touchable...` component as a wrapper will start to handle the touch, which
13
+ * will swallow swipe gestures that should have gone on to a child view, such
14
+ * as `ScrollView`.
15
+ */
16
+ function dismissOnStartResponder() {
17
+ Keyboard.dismiss();
18
+ return false;
19
+ }
5
20
  const StoryView = () => {
6
21
  const context = useStoryContext();
7
22
  const id = context === null || context === void 0 ? void 0 : context.id;
8
23
  if (context && context.unboundStoryFn) {
9
24
  const { unboundStoryFn: StoryComponent } = context;
10
- // Wrapped in `TouchableWithoutFeedback` so that a tap in the story view,
11
- // outside of something that handles the press, will dismiss the keyboard.
12
- return (React.createElement(TouchableWithoutFeedback, { onPress: Keyboard.dismiss },
13
- React.createElement(Box, { flex: true, key: id, testID: id }, StoryComponent && React.createElement(StoryComponent, Object.assign({}, context)))));
25
+ return (React.createElement(Box, { flex: true, key: id, testID: id, onStartShouldSetResponder: dismissOnStartResponder }, StoryComponent && React.createElement(StoryComponent, Object.assign({}, context))));
14
26
  }
15
27
  return (React.createElement(Box, { flex: true, padding: 16, alignItems: "center", justifyContent: "center" },
16
28
  React.createElement(Text, null, "Please open navigator and select a story to preview.")));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "6.5.0-rc.4",
3
+ "version": "6.5.0-rc.5",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "f71d95ceb06416a15cb6fff789c65b26611640ab"
90
+ "gitHead": "5bc5a1f17cbca33fba28f8cce57d7d49ee80c689"
91
91
  }