marcocesarato / react-native-input-spinner

An extensible input number spinner component for react-native highly customizable. This component enhance a text input for entering numeric values, with increase and decrease buttons.
https://marcocesarato.github.io/react-native-input-spinner/
GNU General Public License v3.0
414 stars 34 forks source link

Export functional HOC via React.forwardRef #85

Closed arstropica closed 1 year ago

arstropica commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-input-spinner@1.7.12 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-input-spinner/src/index.js b/node_modules/react-native-input-spinner/src/index.js
index 290cd35..7e2b6b9 100644
--- a/node_modules/react-native-input-spinner/src/index.js
+++ b/node_modules/react-native-input-spinner/src/index.js
@@ -3,8 +3,8 @@ import InputSpinner from "./InputSpinner";
 import {getSkin} from "./Skins";

 // Export
-export default (props) => {
+export default React.forwardRef((props, ref) => {
    const skinProps = getSkin(props.skin, props);
    const finalProps = {...props, ...skinProps};
-   return <InputSpinner {...finalProps} />;
-};
+   return <InputSpinner {...finalProps} ref={ref} />;
+});

This issue body was partially generated by patch-package.

marcocesarato commented 1 year ago

Thank you so mach for your pull request. Merged πŸ‘