Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: react-native-gesture-handler @ 1.2.1 .. 1.2.2

GestureHandler.js

@@ -1,15 +1,10 @@
import React from 'react';
import {
Animated,
- ScrollView,
- Switch,
- TextInput,
- ToolbarAndroid,
- DrawerLayoutAndroid,
StyleSheet,
- FlatList,
Platform,
processColor,
+ default as ReactNative,
} from 'react-native';
import PropTypes from 'prop-types';
@@ -354,7 +349,7 @@
...Component.propTypes,
};
- static displayName = Component.displayName || "ComponentWrapper";
+ static displayName = Component.displayName || 'ComponentWrapper';
_refHandler = node => {
// bind native component's methods
@@ -401,22 +396,6 @@
return ComponentWrapper;
}
-const WrappedScrollView = createNativeWrapper(ScrollView, {
- disallowInterruption: true,
-});
-const WrappedSwitch = createNativeWrapper(Switch, {
- shouldCancelWhenOutside: false,
- shouldActivateOnStart: true,
- disallowInterruption: true,
-});
-const WrappedTextInput = createNativeWrapper(TextInput);
-
-const WrappedToolbarAndroid = createNativeWrapper(ToolbarAndroid);
-const WrappedDrawerLayoutAndroid = createNativeWrapper(DrawerLayoutAndroid, {
- disallowInterruption: true,
-});
-WrappedDrawerLayoutAndroid.positions = DrawerLayoutAndroid.positions;
-
State.print = state => {
const keys = Object.keys(State);
for (let i = 0; i < keys.length; i++) {
@@ -583,22 +562,59 @@
}
}
-/* Other */
+const MEMOIZED = {};
-const FlatListWithGHScroll = React.forwardRef((props, ref) => (
- <FlatList
+function memoizeWrap(Component, config) {
+ const memoized = MEMOIZED[Component.displayName];
+ if (memoized) {
+ return memoized;
+ }
+ return (MEMOIZED[Component.displayName] = createNativeWrapper(
+ Component,
+ config
+ ));
+}
+
+module.exports = {
+ /* RN's components */
+ get ScrollView() {
+ return memoizeWrap(ReactNative.ScrollView, {
+ disallowInterruption: true,
+ });
+ },
+ get Switch() {
+ return memoizeWrap(ReactNative.Switch, {
+ shouldCancelWhenOutside: false,
+ shouldActivateOnStart: true,
+ disallowInterruption: true,
+ });
+ },
+ get TextInput() {
+ return memoizeWrap(ReactNative.TextInput);
+ },
+ get ToolbarAndroid() {
+ return memoizeWrap(ReactNative.ToolbarAndroid);
+ },
+ get DrawerLayoutAndroid() {
+ const DrawerLayoutAndroid = memoizeWrap(ReactNative.DrawerLayoutAndroid, {
+ disallowInterruption: true,
+ });
+ DrawerLayoutAndroid.positions = ReactNative.DrawerLayoutAndroid.positions;
+ return DrawerLayoutAndroid;
+ },
+ get FlatList() {
+ if (!MEMOIZED.FlatList) {
+ const ScrollView = this.ScrollView;
+ MEMOIZED.FlatList = React.forwardRef((props, ref) => (
+ <ReactNative.FlatList
ref={ref}
{...props}
- renderScrollComponent={scrollProps => <WrappedScrollView {...scrollProps} />}
+ renderScrollComponent={scrollProps => <ScrollView {...scrollProps} />}
/>
-));
-
-export {
- WrappedScrollView as ScrollView,
- WrappedSwitch as Switch,
- WrappedTextInput as TextInput,
- WrappedToolbarAndroid as ToolbarAndroid,
- WrappedDrawerLayoutAndroid as DrawerLayoutAndroid,
+ ));
+ }
+ return MEMOIZED.FlatList;
+ },
NativeViewGestureHandler,
TapGestureHandler,
FlingGestureHandler,
@@ -614,9 +630,8 @@
RectButton,
BorderlessButton,
/* Other */
- FlatListWithGHScroll as FlatList,
gestureHandlerRootHOC,
- GestureHandlerButton as PureNativeButton,
+ PureNativeButton: GestureHandlerButton,
Directions,
createNativeWrapper,
};

ios/RNGestureHandler.xcodeproj/xcuserdata/mdk.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,7 +7,7 @@
<key>RNGestureHandler-tvOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
- <integer>3</integer>
+ <integer>2</integer>
</dict>
<key>RNGestureHandler.xcscheme</key>
<dict>

package.json

@@ -1,6 +1,6 @@
{
"name": "react-native-gesture-handler",
- "version": "1.2.1",
+ "version": "1.2.2",
"description": "Experimental implementation of a new declarative API for gesture handling in react-native",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",