@amazon-devices/react-native-gesture-handler 2.0.1758683737 → 2.0.1759135970

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.
@@ -14,26 +14,37 @@ const NATIVE_WRAPPER_PROPS_FILTER = [...nativeViewProps, 'onGestureHandlerEvent'
14
14
  export default function createNativeWrapper(Component, config = {}) {
15
15
  var _Component$render;
16
16
  const ComponentWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
17
- // filter out props that should be passed to gesture handler wrapper
18
- const gestureHandlerProps = Object.keys(props).reduce((res, key) => {
17
+ // Filter out props that should be passed to gesture handler wrapper
18
+ const {
19
+ gestureHandlerProps,
20
+ childProps
21
+ } = Object.keys(props).reduce((res, key) => {
19
22
  // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
20
23
  const allowedKeys = NATIVE_WRAPPER_PROPS_FILTER;
21
24
  if (allowedKeys.includes(key)) {
22
25
  // @ts-ignore FIXME(TS)
23
- res[key] = props[key];
26
+ res.gestureHandlerProps[key] = props[key];
27
+ } else {
28
+ // @ts-ignore FIXME(TS)
29
+ res.childProps[key] = props[key];
24
30
  }
25
31
  return res;
26
32
  }, {
27
- ...config
28
- } // watch out not to modify config
29
- );
33
+ gestureHandlerProps: {
34
+ ...config
35
+ },
36
+ // Watch out not to modify config
37
+ childProps: {
38
+ enabled: props.enabled
39
+ }
40
+ });
30
41
  const _ref = useRef();
31
42
  const _gestureHandlerRef = useRef();
32
43
  useImperativeHandle(ref,
33
44
  // @ts-ignore TODO(TS) decide how nulls work in this context
34
45
  () => {
35
46
  const node = _gestureHandlerRef.current;
36
- // add handlerTag for relations config
47
+ // Add handlerTag for relations config
37
48
  if (_ref.current && node) {
38
49
  // @ts-ignore FIXME(TS) think about createHandler return type
39
50
  _ref.current.handlerTag = node.handlerTag;
@@ -43,7 +54,7 @@ export default function createNativeWrapper(Component, config = {}) {
43
54
  }, [_ref, _gestureHandlerRef]);
44
55
  return /*#__PURE__*/React.createElement(NativeViewGestureHandler, _extends({}, gestureHandlerProps, {
45
56
  ref: _gestureHandlerRef
46
- }), /*#__PURE__*/React.createElement(Component, _extends({}, props, {
57
+ }), /*#__PURE__*/React.createElement(Component, _extends({}, childProps, {
47
58
  ref: _ref
48
59
  })));
49
60
  });
@@ -1 +1 @@
1
- {"version":3,"names":["React","useImperativeHandle","useRef","NativeViewGestureHandler","nativeViewProps","NATIVE_WRAPPER_PROPS_FILTER","createNativeWrapper","Component","config","_Component$render","ComponentWrapper","forwardRef","props","ref","gestureHandlerProps","Object","keys","reduce","res","key","allowedKeys","includes","_ref","_gestureHandlerRef","node","current","handlerTag","createElement","_extends","displayName","render","name"],"sources":["createNativeWrapper.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useImperativeHandle, useRef } from 'react';\n\nimport {\n NativeViewGestureHandler,\n NativeViewGestureHandlerProps,\n nativeViewProps,\n} from './NativeViewGestureHandler';\n\n/*\n * This array should consist of:\n * - All keys in propTypes from NativeGestureHandler\n * (and all keys in GestureHandlerPropTypes)\n * - 'onGestureHandlerEvent'\n * - 'onGestureHandlerStateChange'\n */\nconst NATIVE_WRAPPER_PROPS_FILTER = [\n ...nativeViewProps,\n 'onGestureHandlerEvent',\n 'onGestureHandlerStateChange',\n] as const;\n\nexport default function createNativeWrapper<P>(\n Component: React.ComponentType<P>,\n config: Readonly<NativeViewGestureHandlerProps> = {}\n) {\n const ComponentWrapper = React.forwardRef<\n React.ComponentType<any>,\n P & NativeViewGestureHandlerProps\n >((props, ref) => {\n // filter out props that should be passed to gesture handler wrapper\n const gestureHandlerProps = Object.keys(props).reduce(\n (res, key) => {\n // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info\n const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;\n if (allowedKeys.includes(key)) {\n // @ts-ignore FIXME(TS)\n res[key] = props[key];\n }\n return res;\n },\n { ...config } // watch out not to modify config\n );\n const _ref = useRef<React.ComponentType<P>>();\n const _gestureHandlerRef = useRef<React.ComponentType<P>>();\n useImperativeHandle(\n ref,\n // @ts-ignore TODO(TS) decide how nulls work in this context\n () => {\n const node = _gestureHandlerRef.current;\n // add handlerTag for relations config\n if (_ref.current && node) {\n // @ts-ignore FIXME(TS) think about createHandler return type\n _ref.current.handlerTag = node.handlerTag;\n return _ref.current;\n }\n return null;\n },\n [_ref, _gestureHandlerRef]\n );\n return (\n <NativeViewGestureHandler\n {...gestureHandlerProps}\n ref={_gestureHandlerRef}>\n {/* @ts-ignore yocto TS error, fixed in newer version, PROJVEGA-277530 */}\n <Component {...props} ref={_ref} />\n </NativeViewGestureHandler>\n );\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ComponentWrapper.displayName =\n Component?.displayName ||\n // @ts-ignore if render doesn't exist it will return undefined and go further\n Component?.render?.name ||\n (typeof Component === 'string' && Component) ||\n 'ComponentWrapper';\n\n return ComponentWrapper;\n}\n"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,mBAAmB,EAAEC,MAAM,QAAQ,OAAO;AAEnD,SACEC,wBAAwB,EAExBC,eAAe,QACV,4BAA4B;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG,CAClC,GAAGD,eAAe,EAClB,uBAAuB,EACvB,6BAA6B,CACrB;AAEV,eAAe,SAASE,mBAAmBA,CACzCC,SAAiC,EACjCC,MAA+C,GAAG,CAAC,CAAC,EACpD;EAAA,IAAAC,iBAAA;EACA,MAAMC,gBAAgB,gBAAGV,KAAK,CAACW,UAAU,CAGvC,CAACC,KAAK,EAAEC,GAAG,KAAK;IAChB;IACA,MAAMC,mBAAmB,GAAGC,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,MAAM,CACnD,CAACC,GAAG,EAAEC,GAAG,KAAK;MACZ;MACA,MAAMC,WAA8B,GAAGf,2BAA2B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ativeViewGestureHandler","nativeViewProps","NATIVE_WRAPPER_PROPS_FILTER","createNativeWrapper","Component","config","_Component$render","ComponentWrapper","forwardRef","props","ref","gestureHandlerProps","childProps","Object","keys","reduce","res","key","allowedKeys","includes","enabled","_ref","_gestureHandlerRef","node","current","handlerTag","createElement","_extends","displayName","render","name"],"sources":["createNativeWrapper.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useImperativeHandle, useRef } from 'react';\n\nimport {\n NativeViewGestureHandler,\n NativeViewGestureHandlerProps,\n nativeViewProps,\n} from './NativeViewGestureHandler';\n\n/*\n * This array should consist of:\n * - All keys in propTypes from NativeGestureHandler\n * (and all keys in GestureHandlerPropTypes)\n * - 'onGestureHandlerEvent'\n * - 'onGestureHandlerStateChange'\n */\nconst NATIVE_WRAPPER_PROPS_FILTER = [\n ...nativeViewProps,\n 'onGestureHandlerEvent',\n 'onGestureHandlerStateChange',\n] as const;\n\nexport default function createNativeWrapper<P>(\n Component: React.ComponentType<P>,\n config: Readonly<NativeViewGestureHandlerProps> = {}\n) {\n const ComponentWrapper = React.forwardRef<\n React.ComponentType<any>,\n P & NativeViewGestureHandlerProps\n >((props, ref) => {\n // Filter out props that should be passed to gesture handler wrapper\n const { gestureHandlerProps, childProps } = Object.keys(props).reduce(\n (res, key) => {\n // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info\n const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;\n if (allowedKeys.includes(key)) {\n // @ts-ignore FIXME(TS)\n res.gestureHandlerProps[key] = props[key];\n } else {\n // @ts-ignore FIXME(TS)\n res.childProps[key] = props[key];\n }\n return res;\n },\n {\n gestureHandlerProps: { ...config }, // Watch out not to modify config\n childProps: { enabled: props.enabled } as P,\n }\n );\n const _ref = useRef<React.ComponentType<P>>();\n const _gestureHandlerRef = useRef<React.ComponentType<P>>();\n useImperativeHandle(\n ref,\n // @ts-ignore TODO(TS) decide how nulls work in this context\n () => {\n const node = _gestureHandlerRef.current;\n // Add handlerTag for relations config\n if (_ref.current && node) {\n // @ts-ignore FIXME(TS) think about createHandler return type\n _ref.current.handlerTag = node.handlerTag;\n return _ref.current;\n }\n return null;\n },\n [_ref, _gestureHandlerRef]\n );\n return (\n <NativeViewGestureHandler\n {...gestureHandlerProps}\n ref={_gestureHandlerRef}>\n <Component {...childProps} ref={_ref} />\n </NativeViewGestureHandler>\n );\n });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ComponentWrapper.displayName =\n Component?.displayName ||\n // @ts-ignore if render doesn't exist it will return undefined and go further\n Component?.render?.name ||\n (typeof Component === 'string' && Component) ||\n 'ComponentWrapper';\n\n return ComponentWrapper;\n}\n"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,mBAAmB,EAAEC,MAAM,QAAQ,OAAO;AAEnD,SACEC,wBAAwB,EAExBC,eAAe,QACV,4BAA4B;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG,CAClC,GAAGD,eAAe,EAClB,uBAAuB,EACvB,6BAA6B,CACrB;AAEV,eAAe,SAASE,mBAAmBA,CACzCC,SAAiC,EACjCC,MAA+C,GAAG,CAAC,CAAC,EACpD;EAAA,IAAAC,iBAAA;EACA,MAAMC,gBAAgB,gBAAGV,KAAK,CAACW,UAAU,CAGvC,CAACC,KAAK,EAAEC,GAAG,KAAK;IAChB;IACA,MAAM;MAAEC,mBAAmB;MAAEC;IAAW,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACL,KAAK,CAAC,CAACM,MAAM,CACnE,CAACC,GAAG,EAAEC,GAAG,KAAK;MACZ;MACA,MAAMC,WAA8B,GAAGhB,2BAA2B;MAClE,IAAIgB,WAAW,CAACC,QAAQ,CAACF,GAAG,CAAC,EAAE;QAC7B;QACAD,GAAG,CAACL,mBAAmB,CAACM,GAAG,CAAC,GAAGR,KAAK,CAACQ,GAAG,CAAC;MAC3C,CAAC,M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ignoreList":[]}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@amazon-devices/react-native-gesture-handler", "version": "2.0.1758683737+2.13.0", "description": "Experimental implementation of a new declarative API for gesture handling in react-native", "scripts": {"test": "jest", "tsc": "tsc -p tsconfig.build.json", "build": "$npm_execpath run tsc", "precommit": "lint-staged", "release": "npm login && release-it", "ts-check": "yarn tsc --noEmit", "format:js": "prettier --write --list-different './{src,example,FabricExample}/**/*.{js,jsx,ts,tsx}'", "format:android": "node ./scripts/format-android.js", "format:ios": "find ios/ -iname *.h -o -iname *.m -o -iname *.cpp -o -iname *.mm | xargs clang-format -i", "lint:js": "eslint --ext '.js,.ts,.tsx' src/ example/src FabricExample/src && yarn prettier --check './{src,example,FabricExample}/**/*.{js,jsx,ts,tsx}'", "lint:js-root": "eslint --ext '.js,.ts,.tsx' src/ && yarn prettier --check './src/**/*.{js,jsx,ts,tsx}'", "lint:android": "./android/gradlew -p android spotlessCheck -q", "build:release": "npm run prepare"}, "kepler": {"temporary-alias-for-package": {"name": "react-native-gesture-handler", "version": "2.13.0"}}, "keplerImport": true, "react-native": "src/index.ts", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", "types": "lib/typescript/index.d.ts", "files": ["src", "lib", "!**/__tests__", "!**/__fixtures__", "!**/__mocks__", "android/build.gradle", "android/gradle.properties", "android/src/main/AndroidManifest.xml", "android/src/main/java/", "android/src/main/jni/", "android/src/fabric/java", "android/src/paper/java", "android/common/src/main/java/", "android/reanimated/src/main/java/", "android/noreanimated/src/main/java/", "ios/", "Swipeable/", "jest-utils/", "DrawerLayout/", "README.md", "jestSetup.js", "RNGestureHandler.podspec", "kepler-compatibility.json", "SystemModules", "SystemBundles", "THIRD_PARTY_NOTICES.txt", "kepler-transformed-package-info.json"], "repository": {"type": "git", "url": "git+https://github.com/software-mansion/react-native-gesture-handler.git"}, "author": {"email": "krzys.magiera@gmail.com", "name": "Krzysztof Magiera"}, "license": "See license in LICENSE", "readmeFilename": "README.md", "bugs": {"url": "https://github.com/software-mansion/react-native-gesture-handler/issues"}, "homepage": "https://github.com/software-mansion/react-native-gesture-handler#readme", "dependencies": {"@egjs/hammerjs": "^2.0.17", "hoist-non-react-statics": "^3.3.0", "invariant": "^2.2.4", "lodash": "^4.17.21", "prop-types": "^15.7.2", "react-native": "0.72.0"}, "jest": {"preset": "react-native", "modulePathIgnorePatterns": ["<rootDir>/lib/"]}, "devDependencies": {"@babel/core": "^7.12.9", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/preset-env": "^7.12.11", "@babel/preset-typescript": "^7.12.7", "@babel/runtime": "^7.12.5", "@testing-library/jest-native": "^4.0.4", "@testing-library/react-native": "^9.0.0", "@types/hammerjs": "^2.0.38", "@types/hoist-non-react-statics": "^3.3.1", "@types/jest": "^27.0.3", "@types/react": "^18.0.24", "@types/react-test-renderer": "^17.0.0", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "babel-jest": "^26.6.3", "clang-format": "^1.8.0", "eslint": "^7.32.0", "eslint-config-satya164": "^3.1.8", "eslint-import-resolver-babel-module": "^5.2.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest": "^26.0.0", "expo": "^35.0.1", "husky": "^8.0.1", "jest": "^26.6.3", "lint-staged": "^12.3.2", "metro-react-native-babel-preset": "^0.64.0", "prettier": "^2.7.1", "react": "18.2.0", "react-dom": "^16.12.0", "react-native-builder-bob": "^0.17.1", "react-native-reanimated": "^2.3.1", "react-native-web": "^0.11.7", "react-test-renderer": "17.0.2", "release-it": "^13.6.5", "typescript": "^4.5.5", "@amazon-devices/react-native-kepler": "^2.0.0+rn0.72.0"}, "peerDependencies": {"react": "*", "react-native": "*", "@amazon-devices/react-native-kepler": "^2.0.0+rn0.72.0"}, "lint-staged": {"./{src,example,FabricExample}/**/*.{ts,tsx}": "yarn format:js", "android/**/*.kt": "yarn format:android", "ios/**/*.{h,m,mm,cpp}": "yarn format:ios"}, "release-it": {"hooks": {"before:git:bump": ["# check if version corresponds to changes in native files \n if git diff --name-only ${latestVersion} HEAD | egrep \"(android/.*)|(ios/.*)\" -q; then egrep '\\.0$' -q <<< ${version}; else test $? -eq 1; fi"]}}, "react-native-builder-bob": {"source": "src", "output": "lib", "targets": ["commonjs", "module", ["typescript", {"project": "tsconfig.build.json"}]]}, "eslintIgnore": ["node_modules/", "lib/", "src/specs/*NativeComponent.js"], "codegenConfig": {"name": "rngesturehandler_codegen", "type": "components", "jsSrcsDir": "./src/specs"}}
1
+ {"name": "@amazon-devices/react-native-gesture-handler", "version": "2.0.1759135970+2.13.0", "description": "Experimental implementation of a new declarative API for gesture handling in react-native", "scripts": {"test": "jest", "tsc": "tsc -p tsconfig.build.json", "build": "$npm_execpath run tsc", "precommit": "lint-staged", "release": "npm login && release-it", "ts-check": "yarn tsc --noEmit", "format:js": "prettier --write --list-different './{src,example,FabricExample}/**/*.{js,jsx,ts,tsx}'", "format:android": "node ./scripts/format-android.js", "format:ios": "find ios/ -iname *.h -o -iname *.m -o -iname *.cpp -o -iname *.mm | xargs clang-format -i", "lint:js": "eslint --ext '.js,.ts,.tsx' src/ example/src FabricExample/src && yarn prettier --check './{src,example,FabricExample}/**/*.{js,jsx,ts,tsx}'", "lint:js-root": "eslint --ext '.js,.ts,.tsx' src/ && yarn prettier --check './src/**/*.{js,jsx,ts,tsx}'", "lint:android": "./android/gradlew -p android spotlessCheck -q", "build:release": "npm run prepare"}, "kepler": {"temporary-alias-for-package": {"name": "react-native-gesture-handler", "version": "2.13.0"}}, "keplerImport": true, "react-native": "src/index.ts", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", "types": "lib/typescript/index.d.ts", "files": ["src", "lib", "!**/__tests__", "!**/__fixtures__", "!**/__mocks__", "android/build.gradle", "android/gradle.properties", "android/src/main/AndroidManifest.xml", "android/src/main/java/", "android/src/main/jni/", "android/src/fabric/java", "android/src/paper/java", "android/common/src/main/java/", "android/reanimated/src/main/java/", "android/noreanimated/src/main/java/", "ios/", "Swipeable/", "jest-utils/", "DrawerLayout/", "README.md", "jestSetup.js", "RNGestureHandler.podspec", "kepler-compatibility.json", "SystemModules", "SystemBundles", "THIRD_PARTY_NOTICES.txt", "kepler-transformed-package-info.json"], "repository": {"type": "git", "url": "git+https://github.com/software-mansion/react-native-gesture-handler.git"}, "author": {"email": "krzys.magiera@gmail.com", "name": "Krzysztof Magiera"}, "license": "See license in LICENSE", "readmeFilename": "README.md", "bugs": {"url": "https://github.com/software-mansion/react-native-gesture-handler/issues"}, "homepage": "https://github.com/software-mansion/react-native-gesture-handler#readme", "dependencies": {"@egjs/hammerjs": "^2.0.17", "hoist-non-react-statics": "^3.3.0", "invariant": "^2.2.4", "lodash": "^4.17.21", "prop-types": "^15.7.2", "react-native": "0.72.0"}, "jest": {"preset": "react-native", "modulePathIgnorePatterns": ["<rootDir>/lib/"]}, "devDependencies": {"@babel/core": "^7.12.9", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/preset-env": "^7.12.11", "@babel/preset-typescript": "^7.12.7", "@babel/runtime": "^7.12.5", "@testing-library/jest-native": "^4.0.4", "@testing-library/react-native": "^9.0.0", "@types/hammerjs": "^2.0.38", "@types/hoist-non-react-statics": "^3.3.1", "@types/jest": "^27.0.3", "@types/react": "^18.0.24", "@types/react-test-renderer": "^17.0.0", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "babel-jest": "^26.6.3", "clang-format": "^1.8.0", "eslint": "^7.32.0", "eslint-config-satya164": "^3.1.8", "eslint-import-resolver-babel-module": "^5.2.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest": "^26.0.0", "expo": "^35.0.1", "husky": "^8.0.1", "jest": "^26.6.3", "lint-staged": "^12.3.2", "metro-react-native-babel-preset": "^0.64.0", "prettier": "^2.7.1", "react": "18.2.0", "react-dom": "^16.12.0", "react-native-builder-bob": "^0.17.1", "react-native-reanimated": "^2.3.1", "react-native-web": "^0.11.7", "react-test-renderer": "17.0.2", "release-it": "^13.6.5", "typescript": "^4.5.5", "@amazon-devices/react-native-kepler": "^2.0.0+rn0.72.0"}, "peerDependencies": {"react": "*", "react-native": "*", "@amazon-devices/react-native-kepler": "^2.0.0+rn0.72.0"}, "lint-staged": {"./{src,example,FabricExample}/**/*.{ts,tsx}": "yarn format:js", "android/**/*.kt": "yarn format:android", "ios/**/*.{h,m,mm,cpp}": "yarn format:ios"}, "release-it": {"hooks": {"before:git:bump": ["# check if version corresponds to changes in native files \n if git diff --name-only ${latestVersion} HEAD | egrep \"(android/.*)|(ios/.*)\" -q; then egrep '\\.0$' -q <<< ${version}; else test $? -eq 1; fi"]}}, "react-native-builder-bob": {"source": "src", "output": "lib", "targets": ["commonjs", "module", ["typescript", {"project": "tsconfig.build.json"}]]}, "eslintIgnore": ["node_modules/", "lib/", "src/specs/*NativeComponent.js"], "codegenConfig": {"name": "rngesturehandler_codegen", "type": "components", "jsSrcsDir": "./src/specs"}}
@@ -28,18 +28,24 @@ export default function createNativeWrapper<P>(
28
28
  React.ComponentType<any>,
29
29
  P & NativeViewGestureHandlerProps
30
30
  >((props, ref) => {
31
- // filter out props that should be passed to gesture handler wrapper
32
- const gestureHandlerProps = Object.keys(props).reduce(
31
+ // Filter out props that should be passed to gesture handler wrapper
32
+ const { gestureHandlerProps, childProps } = Object.keys(props).reduce(
33
33
  (res, key) => {
34
34
  // TS being overly protective with it's types, see https://github.com/microsoft/TypeScript/issues/26255#issuecomment-458013731 for more info
35
35
  const allowedKeys: readonly string[] = NATIVE_WRAPPER_PROPS_FILTER;
36
36
  if (allowedKeys.includes(key)) {
37
37
  // @ts-ignore FIXME(TS)
38
- res[key] = props[key];
38
+ res.gestureHandlerProps[key] = props[key];
39
+ } else {
40
+ // @ts-ignore FIXME(TS)
41
+ res.childProps[key] = props[key];
39
42
  }
40
43
  return res;
41
44
  },
42
- { ...config } // watch out not to modify config
45
+ {
46
+ gestureHandlerProps: { ...config }, // Watch out not to modify config
47
+ childProps: { enabled: props.enabled } as P,
48
+ }
43
49
  );
44
50
  const _ref = useRef<React.ComponentType<P>>();
45
51
  const _gestureHandlerRef = useRef<React.ComponentType<P>>();
@@ -48,7 +54,7 @@ export default function createNativeWrapper<P>(
48
54
  // @ts-ignore TODO(TS) decide how nulls work in this context
49
55
  () => {
50
56
  const node = _gestureHandlerRef.current;
51
- // add handlerTag for relations config
57
+ // Add handlerTag for relations config
52
58
  if (_ref.current && node) {
53
59
  // @ts-ignore FIXME(TS) think about createHandler return type
54
60
  _ref.current.handlerTag = node.handlerTag;
@@ -62,8 +68,7 @@ export default function createNativeWrapper<P>(
62
68
  <NativeViewGestureHandler
63
69
  {...gestureHandlerProps}
64
70
  ref={_gestureHandlerRef}>
65
- {/* @ts-ignore yocto TS error, fixed in newer version, PROJVEGA-277530 */}
66
- <Component {...props} ref={_ref} />
71
+ <Component {...childProps} ref={_ref} />
67
72
  </NativeViewGestureHandler>
68
73
  );
69
74
  });