Files
Folo/patches/react-native-sheet-transitions.patch
T
Innei f21b9e7bf0 refactor: replace @react-navigation and expo-router (#3151)
* init

* init

* refactor(mobile): enhance tab navigation and structure

- Added `TabScreenModule` and `TabScreenView` to support dynamic tab management.
- Replaced `FOTabBarController` with a more streamlined `UITabBarController` implementation.
- Updated `TabBarModule` to utilize new tab switching logic and event handling.
- Modified `TabBarRootView` to manage tab views more effectively and handle tab index changes.
- Adjusted main application file to integrate new tab components and improve navigation flow.

These changes aim to improve the tab navigation experience and maintainability of the codebase.

* tabbar

* refactor(mobile): streamline navigation and tab management

- Refactored main application structure to enhance tab navigation, integrating `BottomTabs` and `TabRoot` components for improved tab management.
- Updated `NavigationHeader` and `SafeNavigationScrollView` to better handle header visibility and scrolling behavior.
- Introduced `ScreenItemContext` for managing screen state and scroll position across navigation.
- Cleaned up unused imports and optimized component structure for better maintainability.

These changes aim to improve the overall navigation experience and code organization within the mobile application.

* update

* feat(mobile): implement BottomTabProvider for enhanced tab management

- Introduced `BottomTabProvider` component to manage tab visibility and scroll view context.
- Refactored `BottomTabs` to utilize context for background opacity and tab visibility, simplifying the component structure.
- Removed the deprecated `TabClient` component to streamline the tab implementation.
- Added a null check in `Tabbar` to prevent rendering when there are no tab screens.

These changes aim to improve the organization and functionality of the tab navigation system within the mobile application.

Signed-off-by: Innei <tukon479@gmail.com>

* update

* update

* update

* update

* update

* feat(mobile): integrate ErrorBoundary and enhance navigation context

- Added `ErrorBoundary` component to handle errors gracefully within the application.
- Integrated `BottomTabProvider` to manage tab visibility and scroll view context more effectively.
- Refactored navigation components to utilize new context for improved state management.
- Updated `SafeNavigationScrollView` and `Settings` components to streamline scrolling behavior and context usage.
- Removed deprecated code and optimized component structure for better maintainability.

These changes enhance the user experience by providing error handling and improving navigation management.

* feat(mobile): enhance navigation and layout components

- Registered new screens (`TermsScreen`, `LoginScreen`, `SignUpScreen`, `ForgetPasswordScreen`, `TwoFactorAuthScreen`) with the `NavigationSitemapRegistry` for improved navigation management.
- Adjusted layout properties in `HeaderElements` and `NavigationHeader` for better alignment and responsiveness.
- Refactored `Tabbar` to remove unnecessary animated reactions, optimizing performance.
- Exported `ActionGroup` component for better reusability in `TimelineSelectorProvider`.
- Updated `DebugScreen` to utilize the new navigation methods for component presentation.

These changes improve the overall navigation experience and component structure within the mobile application.

Signed-off-by: Innei <tukon479@gmail.com>

* feat(mobile): implement new architecture support and refactor TabBar components

- Added support for the new architecture in the iOS podspec by conditionally defining `OTHER_SWIFT_FLAGS`.
- Refactored `TabBarPortalModule`, `TabBarRootView`, and `TabScreenView` to improve structure and maintainability.
- Replaced native view components with standard React Native views in `TabBarPortal`, `TabRoot`, and `TabScreen` for better compatibility and performance.
- Updated import paths for `TabScreenProps` to ensure correct type usage.

These changes enhance the navigation experience and prepare the codebase for future architecture improvements.

Signed-off-by: Innei <tukon479@gmail.com>

* feat(mobile): refactor navigation and onboarding components

- Removed outdated navigation dependencies from `package.json` to streamline the project.
- Enhanced `TabBarRootView` to improve tab switching animations and manage view transitions more effectively.
- Updated `App` component structure for better readability and integration of onboarding logic.
- Introduced `OnboardingScreen` with improved layout and navigation handling.
- Refactored navigation context types to include additional screen options for better flexibility.

These changes enhance the navigation experience and prepare the application for future onboarding features.

Signed-off-by: Innei <tukon479@gmail.com>

* feat(mobile): enhance intent handling with navigation integration

- Added navigation support in `useIntentHandler` to handle incoming URLs more effectively.
- Integrated `FollowScreen` for presenting user-specific content based on URL parameters.
- Updated effect dependencies to include navigation for improved functionality.

These changes improve the handling of deep links and enhance the user experience when navigating to the follow screen.

Signed-off-by: Innei <tukon479@gmail.com>

* chore: clean up pnpm-lock.yaml by removing unused navigation dependencies

- Removed outdated navigation packages including `@react-navigation/bottom-tabs`, `@react-navigation/drawer`, and `@react-navigation/native` to streamline the lock file.
- Cleaned up unnecessary entries and peer dependencies to improve maintainability and reduce clutter.

These changes help in optimizing the dependency management for the project.

Signed-off-by: Innei <tukon479@gmail.com>

* lint

Signed-off-by: Innei <tukon479@gmail.com>

* chore: auto-fix linting and formatting issues

* fix

Signed-off-by: Innei <tukon479@gmail.com>

* update

Signed-off-by: Innei <tukon479@gmail.com>

* refactor: update PickerIos component and remove FeedDrawer

- Added import for Portal in PickerIos component.
- Removed the FeedDrawer component entirely, cleaning up unused code.
- Replaced router.dismiss() with navigation.dismiss() in list screen options for better navigation handling.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2025-03-19 22:35:49 +08:00

155 lines
4.1 KiB
Diff

diff --git a/src/SheetProvider.tsx b/src/SheetProvider.tsx
index 2e3964c86ad78a9eddcb074ab26ae8ee2ae12179..20e2f9c25cdb0e7daca3c2211967f21452a04ed9 100644
--- a/src/SheetProvider.tsx
+++ b/src/SheetProvider.tsx
@@ -1,23 +1,23 @@
-import React, { createContext, useContext, useCallback, useEffect } from 'react'
-import { Platform, View } from 'react-native'
-import Animated, {
+import React, { createContext, useCallback, useContext, useEffect, useMemo } from "react"
+import { Platform } from "react-native"
+import {
+ cancelAnimation,
useSharedValue,
withSpring,
- useAnimatedStyle,
- cancelAnimation,
- runOnJS
-} from 'react-native-reanimated'
+ type SharedValue,
+} from "react-native-reanimated"
interface SheetContextType {
- scale: Animated.SharedValue<number>
+ scale: SharedValue<number>
setScale: (scale: number) => void
- resizeType: 'incremental' | 'decremental'
+ isScaling: boolean
+ resizeType: "incremental" | "decremental"
enableForWeb: boolean
}
interface SheetProviderProps {
children: React.ReactNode
- resizeType?: 'incremental' | 'decremental'
+ resizeType?: "incremental" | "decremental"
enableForWeb?: boolean
}
@@ -25,11 +25,12 @@ const SheetContext = createContext<SheetContextType | null>(null)
export function SheetProvider({
children,
- resizeType = 'decremental',
- enableForWeb = false
+ resizeType = "decremental",
+ enableForWeb = false,
}: SheetProviderProps) {
const scale = useSharedValue(1)
const isMounted = useSharedValue(false)
+ const [isScaling, setIsScaling] = React.useState(false)
useEffect(() => {
// Delay setting isMounted to ensure view is ready
@@ -46,11 +47,13 @@ export function SheetProvider({
const setScale = useCallback((newScale: number) => {
if (!isMounted.value) return
- if (Platform.OS === 'android') {
+ if (Platform.OS === "android") {
scale.value = newScale
return
}
+ setIsScaling(newScale !== 1)
+
scale.value = withSpring(newScale, {
damping: 20,
stiffness: 300,
@@ -60,47 +63,22 @@ export function SheetProvider({
})
}, [])
- const animatedStyle = useAnimatedStyle(() => {
- if (!isMounted.value) return {}
-
- return {
- transform: [{ scale: scale.value }],
- }
- }, [])
-
- const isEnabled = Platform.OS === 'web' ? enableForWeb : true
+ const isEnabled = Platform.OS === "web" ? enableForWeb : true
return (
- <SheetContext.Provider value={{
- scale,
- setScale,
- resizeType,
- enableForWeb: isEnabled
- }}>
- {/* <View style={{ flex: 1, backgroundColor: 'red',
- position: 'absolute',
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- zIndex: -1
- }}/> */}
-
- <Animated.View
- style={[
- {
- flex: 1,
- backfaceVisibility: 'hidden',
- },
- Platform.OS === 'ios' ? animatedStyle : null
- ]}
- collapsable={false}
- >
-
- {children}
-
- </Animated.View>
-
+ <SheetContext.Provider
+ value={useMemo(
+ () => ({
+ scale,
+ setScale,
+ isScaling,
+ resizeType,
+ enableForWeb: isEnabled,
+ }),
+ [scale, setScale, isScaling, resizeType, isEnabled],
+ )}
+ >
+ {children}
</SheetContext.Provider>
)
}
@@ -108,7 +86,7 @@ export function SheetProvider({
export function useSheet() {
const context = useContext(SheetContext)
if (!context) {
- throw new Error('useSheet must be used within a SheetProvider')
+ throw new Error("useSheet must be used within a SheetProvider")
}
return context
-}
\ No newline at end of file
+}
diff --git a/src/SheetScreen.tsx b/src/SheetScreen.tsx
index 3eebf713a5dcf42dd43b2c34cef136b682828d23..ca1394fe4319151cd1a31f303c2e70de5f48850a 100644
--- a/src/SheetScreen.tsx
+++ b/src/SheetScreen.tsx
@@ -278,7 +278,7 @@ export function SheetScreen({
{ scale }
],
opacity: opacity.value,
- borderRadius: borderRadius.value,
+ borderRadius: translateY.value === 0 ? 0 : borderRadius.value,
}
}, [disableSheetContentResizeOnDragDown])