react-native-modalize icon indicating copy to clipboard operation
react-native-modalize copied to clipboard

chore: add an array of middle points to intercept gesture navigation

Open mateuspontes opened this issue 2 years ago • 5 comments

This is a Work in Progress to try to address https://github.com/jeremybarbet/react-native-modalize/issues/213, https://github.com/jeremybarbet/react-native-modalize/issues/356 and https://github.com/jeremybarbet/react-native-modalize/issues/297 with an array of snapPoints instead of a single value.

This code is not tested yet, it's just an initial "try and error" solution before we move on with a better and optimized code as well.

How should you test it?

Clone the branch, yarn install and yarn build to update your dependencies, link the repo in your base code, and take a moment do comment this PR with your thoughts and improvements

Update your code removing snapPoint and adding the new prop with your middle points, something like this;snapPoints=[150, 300, ....]

mateuspontes avatar Mar 01 '22 16:03 mateuspontes

Error in test:

the package /Users/developerriderize/Documents/client-mobile/node_modules/react-native-modalize/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/developerriderize/Documents/client-mobile/node_modules/react-native-modalize/lib/index.js. Indeed, none of these files exist:

Marcuspo avatar Mar 01 '22 17:03 Marcuspo

@Marcuspo please, try to enter into the package folder and run yarn build, the original repo doesn't have any script to build tsc after installation.

mateuspontes avatar Mar 01 '22 18:03 mateuspontes

@mateuspontes This is great, well done! Let me know when it's ready for review, you can check against/create more examples with new usage based on this https://github.com/jeremybarbet/react-native-modalize/blob/master/examples/react-native-navigation/src/screens/SnappingList.js

I would suggest to just remove snapPoint and only keep snapPoints moving forward.

Regarding building phase, it happens when running npm publish (https://docs.npmjs.com/cli/v8/using-npm/scripts#npm-publish)

jeremybarbet avatar Mar 01 '22 22:03 jeremybarbet

After install and into the package folder and run npm run build show this error:

179:44 error Replace Animated.multiply(new·Animated.Value(-1),·beginScrollY)) with ⏎····Animated.multiply(new·Animated.Value(-1),·beginScrollY), prettier/prettier 180:3 error Replace ·· with ) prettier/prettier 213:12 error Unnecessary 'else' after 'return' no-else-return 214:7 error 'handleClose' was used before it was defined no-use-before-define 328:5 error Expected an assignment or function call and instead saw an expression no-unused-expressions 389:11 error 'value' is already declared in the upper scope no-shadow 416:74 error Expected to return a value at the end of arrow function consistent-return 429:7 error Arrow function expected a return value consistent-return 638:20 error Redundant double negation no-extra-boolean-cast 651:13 error 'value' is already declared in the upper scope no-shadow 877:6 warning React Hook React.useEffect has missing dependencies: 'adjustToContentHeight' and 'handleAnimateOpen'. Either include them or remove the dependency array react-hooks/exhaustive-deps 896:6 warning React Hook React.useEffect has missing dependencies: 'snapPoint' and 'snapPoints'. Either include them or remove the dependency array react-hooks/exhaustive-deps 907:6 warning React Hook React.useEffect has a missing dependency: 'adjustValue'. Either include it or remove the dependency array react-hooks/exhaustive-deps 913:62 error 'value' is already declared in the upper scope no-shadow 926:7 error Expected an assignment or function call and instead saw an expression no-unused-expressions 926:29 warning The ref value 'backButtonListenerRef.current' will likely have changed by the time this effect cleanup function runs. If this ref points to a node rendered by React, copy 'backButtonListenerRef.current' to a variable inside the effect, and use that variable in the cleanup function react-hooks/exhaustive-deps 933:9 error Expected an assignment or function call and instead saw an expression no-unused-expressions 934:9 error Expected an assignment or function call and instead saw an expression no-unused-expressions 937:6 warning React Hook React.useEffect has a missing dependency: 'beginScrollY'. Either include it or remove the dependency array react-hooks/exhaustive-deps

Marcuspo avatar Mar 02 '22 14:03 Marcuspo