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

Fix: IOU Request scan camera not displaying when permission first given #39854

Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions patches/react-native-tab-view+3.5.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/node_modules/react-native-tab-view/src/PagerViewAdapter.tsx b/node_modules/react-native-tab-view/src/PagerViewAdapter.tsx
index cb7073e..7d2448b 100644
--- a/node_modules/react-native-tab-view/src/PagerViewAdapter.tsx
+++ b/node_modules/react-native-tab-view/src/PagerViewAdapter.tsx
@@ -130,9 +130,10 @@ export function PagerViewAdapter<T extends Route>({
};
}, []);

+ const [forceRender, setForceRender] = React.useState(0)
const memoizedPosition = React.useMemo(
() => Animated.add(position, offset),
- [offset, position]
+ [offset, position, forceRender]
);

return children({
@@ -162,6 +163,8 @@ export function PagerViewAdapter<T extends Route>({
onPageSelected={(e) => {
const index = e.nativeEvent.position;
indexRef.current = index;
+ position.setValue(index);
+ setForceRender((fr) => fr+1)
onIndexChange(index);
}}
onPageScrollStateChanged={onPageScrollStateChanged}
6 changes: 2 additions & 4 deletions src/hooks/useTabNavigatorFocus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ function useTabNavigatorFocus({tabIndex}: UseTabNavigatorFocusParams): boolean {
if (!tabPositionAnimation) {
return;
}
const index = Number(tabIndex);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just cleanup changes, since we don't need to do this cast here. Not related to the issue

const listenerId = tabPositionAnimation.addListener(({value}: PositionAnimationListenerCallback) => {
// Activate camera as soon the index is animating towards the `tabIndex`
DomUtils.requestAnimationFrame(() => {
setIsTabFocused(value > index - 1 && value < index + 1);
setIsTabFocused(value > tabIndex - 1 && value < tabIndex + 1);
});
});

Expand All @@ -72,7 +70,7 @@ function useTabNavigatorFocus({tabIndex}: UseTabNavigatorFocusParams): boolean {

if (typeof initialTabPositionValue === 'number') {
DomUtils.requestAnimationFrame(() => {
setIsTabFocused(initialTabPositionValue > index - 1 && initialTabPositionValue < index + 1);
setIsTabFocused(initialTabPositionValue > tabIndex - 1 && initialTabPositionValue < tabIndex + 1);
});
}

Expand Down
Loading