tooot/.yarn/patches/@mattermost-react-native-pa...

51 lines
2.0 KiB
Diff
Raw Normal View History

2023-07-11 23:21:41 +02:00
diff --git a/src/android.js b/src/android.js
index fbf09855771f985c5edfc53c22cf6cfe828f45f9..7751d456e08e2dc4c78601fc9430fdbf1373e0d4 100644
--- a/src/android.js
+++ b/src/android.js
@@ -16,7 +16,7 @@ import TextAncestor from 'react-native/Libraries/Text/TextAncestor';
import TextInputState from 'react-native/Libraries/Components/TextInput/TextInputState';
import invariant from 'invariant';
import nullthrows from 'nullthrows';
-import setAndForwardRef from 'react-native/Libraries/Utilities/setAndForwardRef';
+import setAndForwardRef from './setAndForwardRef';
import usePressability from 'react-native/Libraries/Pressability/usePressability';
diff --git a/src/ios.tsx b/src/ios.tsx
index b9ed28bbf9fca6fb44c27096e771d8d2b65b858f..588a75c82b2ee1123d3e48acb984bcbc8b293cc8 100644
--- a/src/ios.tsx
+++ b/src/ios.tsx
@@ -11,7 +11,7 @@ import {
} from 'react-native';
import TextInputState from 'react-native/Libraries/Components/TextInput/TextInputState';
import TextAncestor from 'react-native/Libraries/Text/TextAncestor';
-import setAndForwardRef from 'react-native/Libraries/Utilities/setAndForwardRef';
+import setAndForwardRef from './setAndForwardRef';
import { getTextInputExtraProps } from './extra_props';
import type {
diff --git a/src/setAndForwardRef.js b/src/setAndForwardRef.js
new file mode 100644
index 0000000000000000000000000000000000000000..ad7777e271b945c7123953f7578a8d1208ca9e48
--- /dev/null
+++ b/src/setAndForwardRef.js
@@ -0,0 +1,17 @@
+function setAndForwardRef({ getForwardedRef, setLocalRef }) {
+ return function forwardRef(ref) {
+ const forwardedRef = getForwardedRef();
+
+ setLocalRef(ref);
+
+ // Forward to user ref prop (if one has been specified)
+ if (typeof forwardedRef === 'function') {
+ // Handle function-based refs. String-based refs are handled as functions.
+ forwardedRef(ref);
+ } else if (typeof forwardedRef === 'object' && forwardedRef != null) {
+ // Handle createRef-based refs
+ forwardedRef.current = ref;
+ }
+ };
+}
+export default setAndForwardRef;
\ No newline at end of file