Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patch with useTabAnimation #26294

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions patches/@react-navigation+material-top-tabs+6.6.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
diff --git a/node_modules/@react-navigation/material-top-tabs/lib/module/index.js b/node_modules/@react-navigation/material-top-tabs/lib/module/index.js
index b83d44f..9d158a0 100644
--- a/node_modules/@react-navigation/material-top-tabs/lib/module/index.js
+++ b/node_modules/@react-navigation/material-top-tabs/lib/module/index.js
@@ -9,6 +9,11 @@ export { default as createMaterialTopTabNavigator } from './navigators/createMat
export { default as MaterialTopTabBar } from './views/MaterialTopTabBar';
export { default as MaterialTopTabView } from './views/MaterialTopTabView';

+/**
+ * Utilities
+ */
+export { useTabAnimation } from './utils/useTabAnimation';
+
/**
* Types
*/
diff --git a/node_modules/@react-navigation/material-top-tabs/lib/module/utils/TabAnimationContext.js b/node_modules/@react-navigation/material-top-tabs/lib/module/utils/TabAnimationContext.js
new file mode 100644
index 0000000..4ef4e76
--- /dev/null
+++ b/node_modules/@react-navigation/material-top-tabs/lib/module/utils/TabAnimationContext.js
@@ -0,0 +1,3 @@
+import * as React from 'react';
+export const TabAnimationContext = /*#__PURE__*/React.createContext(undefined);
+//# sourceMappingURL=TabAnimationContext.js.map
\ No newline at end of file
diff --git a/node_modules/@react-navigation/material-top-tabs/lib/module/utils/useTabAnimation.js b/node_modules/@react-navigation/material-top-tabs/lib/module/utils/useTabAnimation.js
new file mode 100644
index 0000000..764ca9b
--- /dev/null
+++ b/node_modules/@react-navigation/material-top-tabs/lib/module/utils/useTabAnimation.js
@@ -0,0 +1,10 @@
+import * as React from 'react';
+import { TabAnimationContext } from './TabAnimationContext';
+export function useTabAnimation() {
+ const animation = React.useContext(TabAnimationContext);
+ if (animation === undefined) {
+ throw new Error("Couldn't find values for card animation. Are you inside a screen in Tab?");
+ }
+ return animation;
+}
+//# sourceMappingURL=useTabAnimation.js.map
\ No newline at end of file
diff --git a/node_modules/@react-navigation/material-top-tabs/lib/module/views/MaterialTopTabView.js b/node_modules/@react-navigation/material-top-tabs/lib/module/views/MaterialTopTabView.js
index 7eda7c4..f736fd9 100644
--- a/node_modules/@react-navigation/material-top-tabs/lib/module/views/MaterialTopTabView.js
+++ b/node_modules/@react-navigation/material-top-tabs/lib/module/views/MaterialTopTabView.js
@@ -2,6 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
import { CommonActions, useTheme } from '@react-navigation/native';
import * as React from 'react';
import { TabView } from 'react-native-tab-view';
+import { TabAnimationContext } from '../utils/TabAnimationContext';
import MaterialTopTabBar from './MaterialTopTabBar';
export default function MaterialTopTabView(_ref) {
let {
@@ -34,9 +35,12 @@ export default function MaterialTopTabView(_ref) {
}),
renderScene: _ref2 => {
let {
- route
+ route,
+ position
} = _ref2;
- return descriptors[route.key].render();
+ return /*#__PURE__*/React.createElement(TabAnimationContext.Provider, {
+ value: position
+ }, descriptors[route.key].render());
},
navigationState: state,
renderTabBar: renderTabBar,