Skip to content

refactor!: use context instead of screenRefs#2476

Merged
maciekstosio merged 27 commits intomainfrom
@maciekstosio/use-context-insteaf-of-screenRefs-for-CST
Nov 5, 2024
Merged

refactor!: use context instead of screenRefs#2476
maciekstosio merged 27 commits intomainfrom
@maciekstosio/use-context-insteaf-of-screenRefs-for-CST

Conversation

@maciekstosio
Copy link
Copy Markdown
Contributor

@maciekstosio maciekstosio commented Nov 4, 2024

Description

This PR replaces passing screenRefs into using context. This avoids unnecessary logic on react-navigation side.

Changes

Create Context that holds screen refs and add this ref in ScreenStackItem instead of doing same on react-navigation part. See the changes there: react-navigation/react-navigation#12225

Testing

See Example App > Swipe Back Animation (changes from react-navigation required: react-navigation/react-navigation#12225)
OR
react-navigation: TestScreenAnimation.tsx
native-stack v5: TestScreenAnimationV5.tsx

native-stack v5 react-navigation
CST-NativeStackV5.mov
CST-ReactNavigation.mov

Checklist

Comment thread src/components/ScreenStackItem.tsx Outdated
Base automatically changed from @maciekstosio/refactor-custom-screen-transition to main November 4, 2024 21:53
@maciekstosio maciekstosio requested a review from satya164 November 4, 2024 22:15
Copy link
Copy Markdown
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

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

Minor remarks + our conversation

Comment on lines +24 to +25
export function getShadowNodeWrapperAndTagFromRef(ref: View | null): {
shadowNodeWrapper: ShadowNodeWrapper;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ref of type View?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

React.Ref?

Comment thread src/components/ScreenStackItem.tsx Outdated
@maciekstosio maciekstosio merged commit 5a2e4eb into main Nov 5, 2024
@maciekstosio maciekstosio deleted the @maciekstosio/use-context-insteaf-of-screenRefs-for-CST branch November 5, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants