* update Signed-off-by: Innei <tukon479@gmail.com> * chore: update Babel and Metro configurations - Added `unstable_transformImportMeta` option to Babel preset for improved JSX handling. - Disabled `unstable_enablePackageExports` in Metro configuration for better package resolution. Signed-off-by: Innei <tukon479@gmail.com> * chore: add react-native-ios-utilities patch and update dependencies - Introduced a patch for `react-native-ios-utilities` to enhance functionality. - Updated `expo`, `react-native`, and `react-native-reanimated` versions in the example app for improved compatibility. - Added `react-native-ios-utilities` to the project dependencies in `package.json`. Signed-off-by: Innei <tukon479@gmail.com> * update Signed-off-by: Innei <tukon479@gmail.com> * chore: auto-fix linting and formatting issues * refactor: improve route parameter handling and entry fetching logic - Updated `useRouteParams` to utilize `useReadonlyRoute` for better state management. - Enhanced `useEntriesByView` to separate remote and local entry fetching, improving data handling and error management. - Introduced debouncing for pagination in local entries and added toast notifications for error handling. - Cleaned up entry ID retrieval to ensure uniqueness and prevent duplicates. Signed-off-by: Innei <tukon479@gmail.com> * refactor: simplify Masonry component return statement - Updated the return statement in the Masonry component to use JSX syntax for better readability and consistency. Signed-off-by: Innei <tukon479@gmail.com> * refactor: update import from RootPortalProvider to RootPortalContext - Changed the import statement in Sheet.tsx to reflect the updated context provider name for better clarity and consistency in the codebase. Signed-off-by: Innei <tukon479@gmail.com> * update Signed-off-by: Innei <tukon479@gmail.com> * refactor: update ref types in component props - Changed ref prop types from React.RefObject to React.Ref for better type compatibility across various components, enhancing overall code consistency and maintainability. Signed-off-by: Innei <tukon479@gmail.com> * feat: add Xcode build server configuration and enhance desktop app routing - Introduced a new configuration file for the Xcode build server to streamline iOS builds. - Updated Vite configuration to include a new proxy route for sharing functionality. - Added a new Jotai atom for managing preview state in the application. - Removed deprecated error fallback component to clean up the codebase. - Implemented a new render style hook for consistent styling across components. - Enhanced entry column components with improved error handling and layout adjustments. - Updated various components to utilize the new render style and improved accessibility. Signed-off-by: Innei <tukon479@gmail.com> * update Signed-off-by: Innei <tukon479@gmail.com> * fix: ensure plugins array is initialized and update TypeScript configuration - Initialized the plugins array in the mobile app configuration to prevent potential runtime errors. - Updated TypeScript configuration to enhance module resolution and improve code organization with clearer path definitions. Signed-off-by: Innei <tukon479@gmail.com> * update lint Signed-off-by: Innei <tukon479@gmail.com> * refactor: update TypeScript types and improve component props - Added `skipLibCheck` to TypeScript configuration for faster builds. - Updated prop types in various components to allow for null values in refs, enhancing type safety. - Refactored several components to ensure better type compatibility and maintainability. Signed-off-by: Innei <tukon479@gmail.com> * refactor(mobile): improve layout handling in NavigationHeader component - Added console logs for debugging right and left widths. - Adjusted layout structure to ensure proper width handling for header elements. - Updated loading indicator positioning and visibility logic. Signed-off-by: Innei <tukon479@gmail.com> * refactor(mobile): update Pager and QRCode components to use forwardRef - Refactored Pager and QRCode components to directly export as functional components with forwardRef. - Updated type definitions to improve ref handling and ensure better type safety. - Simplified component structure for improved readability and maintainability. Signed-off-by: Innei <tukon479@gmail.com> * refactor(ui): enhance FAB components with functional component structure and improved type definitions - Converted FABBase and FABPortable to functional components using FC type for better type safety. - Updated props to include optional ref handling, enhancing flexibility in usage. - Simplified component structure for improved readability and maintainability. Signed-off-by: Innei <tukon479@gmail.com> * chore(deps): update react-native-ios-utilities patch and refine TypeScript configuration - Updated the patch for react-native-ios-utilities in pnpm-lock.yaml to reflect a new hash. - Enhanced TypeScript configuration in tsconfig.json by adding exclusion for node_modules and formatting paths for better readability. - Cleaned up the react-native-ios-utilities.patch by removing unused exports from the index file. Signed-off-by: Innei <tukon479@gmail.com> * update Signed-off-by: Innei <tukon479@gmail.com> --------- Signed-off-by: Innei <tukon479@gmail.com>
165 lines
6.3 KiB
Diff
165 lines
6.3 KiB
Diff
diff --git a/package.json b/package.json
|
|
index 10b546f7484967ba6ef0856d0c7ad2a855845b69..8bcb3b45d413c5ad75d0910ef941d7f97b2f723f 100644
|
|
--- a/package.json
|
|
+++ b/package.json
|
|
@@ -2,9 +2,9 @@
|
|
"name": "react-native-ios-utilities",
|
|
"version": "5.1.5",
|
|
"description": "Utilities for react-native + iOS and wrappers for using swift together with fabric/paper + JSI",
|
|
- "main": "lib/commonjs/index",
|
|
- "module": "lib/module/index",
|
|
- "types": "lib/typescript/src/index.d.ts",
|
|
+ "main": "src/index",
|
|
+ "module": "src/index",
|
|
+ "types": "src/index",
|
|
"react-native": "src/index",
|
|
"source": "src/index",
|
|
"files": [
|
|
diff --git a/src/index.ts b/src/index.ts
|
|
index 4e3dc7f25438fdab57ee654e88f21ec621ad2ba0..4acd61d7471bc70e7b0990de3ef901424cb3c892 100644
|
|
--- a/src/index.ts
|
|
+++ b/src/index.ts
|
|
@@ -1,4 +1,3 @@
|
|
-
|
|
export * from './native_components/RNIDetachedView';
|
|
export * from './native_components/RNIWrapperView';
|
|
|
|
@@ -23,19 +22,5 @@ export type * from './types/UtilityTypes';
|
|
export type * from './types/ReactNativeUtilityTypes';
|
|
export type * from './types/SharedAnimationEvents';
|
|
|
|
-export * from './example_components/CardBody';
|
|
-export * from './example_components/CardTitle';
|
|
-export * from './example_components/CardButton';
|
|
-export * from './example_components/CardRowLabelDisplay';
|
|
-export * from './example_components/CardRowSwitch';
|
|
-export * from './example_components/CardRowStepper';
|
|
-export * from './example_components/CardRowTextInput';
|
|
-export * from './example_components/CardRowColorPicker';
|
|
-
|
|
-export * from './example_components/ExampleItemCard';
|
|
-export * from './example_components/ObjectPropertyDisplay';
|
|
-export * from './example_components/Spacer';
|
|
-export * from './example_components/ViewShapes';
|
|
-
|
|
export * from './misc/Colors';
|
|
export * from './misc/Helpers';
|
|
diff --git a/src/native_components/RNIDetachedView/RNIDetachedView.tsx b/src/native_components/RNIDetachedView/RNIDetachedView.tsx
|
|
index 5f7eb500892fbcef4a799a26a2c02c01e7abcf49..527b49e5fa3fd4c4d72362322b0ee3b5e2032336 100644
|
|
--- a/src/native_components/RNIDetachedView/RNIDetachedView.tsx
|
|
+++ b/src/native_components/RNIDetachedView/RNIDetachedView.tsx
|
|
@@ -2,17 +2,22 @@ import * as React from 'react';
|
|
import { StyleSheet } from 'react-native';
|
|
|
|
import { RNIDetachedNativeView } from './RNIDetachedNativeView';
|
|
-import { DEFAULT_DETACHED_SUBVIEW_ENTRY, type DetachedSubviewsMap } from './DetachedSubviewsMap';
|
|
-
|
|
-import type { RNIDetachedViewProps, RNIDetachedViewRef, } from './RNIDetachedViewTypes';
|
|
+import {
|
|
+ DEFAULT_DETACHED_SUBVIEW_ENTRY,
|
|
+ type DetachedSubviewsMap,
|
|
+} from './DetachedSubviewsMap';
|
|
+
|
|
+import type {
|
|
+ RNIDetachedViewProps,
|
|
+ RNIDetachedViewRef,
|
|
+} from './RNIDetachedViewTypes';
|
|
import type { RNIDetachedViewContentProps } from './RNIDetachedViewContentTypes';
|
|
|
|
import type { StateViewID, StateReactTag } from '../../types/SharedStateTypes';
|
|
import { Helpers } from '../../misc/Helpers';
|
|
|
|
-
|
|
export const RNIDetachedView = React.forwardRef<
|
|
- RNIDetachedViewRef,
|
|
+ RNIDetachedViewRef,
|
|
RNIDetachedViewProps
|
|
>((props, ref) => {
|
|
const [viewID, setViewID] = React.useState<StateViewID>();
|
|
@@ -20,10 +25,8 @@ export const RNIDetachedView = React.forwardRef<
|
|
|
|
const [isDetachedInNative, setIsDetachedInNative] = React.useState(false);
|
|
|
|
- const [
|
|
- detachedSubviewsMap,
|
|
- setDetachedSubviewsMap
|
|
- ] = React.useState<DetachedSubviewsMap>({});
|
|
+ const [detachedSubviewsMap, setDetachedSubviewsMap] =
|
|
+ React.useState<DetachedSubviewsMap>({});
|
|
|
|
React.useImperativeHandle(ref, () => ({
|
|
getReactTag: () => {
|
|
@@ -36,18 +39,18 @@ export const RNIDetachedView = React.forwardRef<
|
|
return detachedSubviewsMap;
|
|
},
|
|
attachToWindow: async (commandArgs) => {
|
|
- if(viewID == null) return;
|
|
+ if (viewID == null) return;
|
|
const module = Helpers.getRNIUtilitiesModule();
|
|
|
|
setIsDetachedInNative(true);
|
|
await module.viewCommandRequest(
|
|
/* viewID : */ viewID,
|
|
/* commandName: */ 'attachToWindow',
|
|
- /* commandArgs: */ commandArgs,
|
|
+ /* commandArgs: */ commandArgs
|
|
);
|
|
},
|
|
presentInModal: async (commandArgs) => {
|
|
- if(viewID == null) return;
|
|
+ if (viewID == null) return;
|
|
const module = Helpers.getRNIUtilitiesModule();
|
|
|
|
setIsDetachedInNative(true);
|
|
@@ -59,7 +62,7 @@ export const RNIDetachedView = React.forwardRef<
|
|
},
|
|
}));
|
|
|
|
- const shouldEnableDebugBackgroundColors =
|
|
+ const shouldEnableDebugBackgroundColors =
|
|
props.shouldEnableDebugBackgroundColors ?? false;
|
|
|
|
const shouldImmediatelyDetach = props.shouldImmediatelyDetach ?? false;
|
|
@@ -68,8 +71,12 @@ export const RNIDetachedView = React.forwardRef<
|
|
const reactChildrenCount = React.Children.count(props.children);
|
|
|
|
const children = React.Children.map(props.children, (child) => {
|
|
+ // child is React.Fragment
|
|
+ if (React.isValidElement(child) && child.type === React.Fragment) {
|
|
+ return child;
|
|
+ }
|
|
return React.cloneElement(
|
|
- child as React.ReactElement<RNIDetachedViewContentProps>,
|
|
+ child as React.ReactElement<RNIDetachedViewContentProps>,
|
|
{
|
|
isParentDetached: isDetached,
|
|
shouldEnableDebugBackgroundColors,
|
|
diff --git a/src/native_components/RNIDetachedView/RNIDetachedViewContent.tsx b/src/native_components/RNIDetachedView/RNIDetachedViewContent.tsx
|
|
index 37db0454c3430fc1eed0c9fc1d82660613b47353..ed1e72e556a1b066b15cbdf198b735ff914c92e6 100644
|
|
--- a/src/native_components/RNIDetachedView/RNIDetachedViewContent.tsx
|
|
+++ b/src/native_components/RNIDetachedView/RNIDetachedViewContent.tsx
|
|
@@ -14,7 +14,7 @@ export function RNIDetachedViewContent(
|
|
props: React.PropsWithChildren<RNIDetachedViewContentProps>
|
|
) {
|
|
const [viewID, setViewID] = React.useState<StateViewID>();
|
|
-
|
|
+ const { isParentDetached, ...rest } = props
|
|
const wrapperStyle: StyleProp<ViewStyle> = [
|
|
props.shouldEnableDebugBackgroundColors && styles.wrapperViewDebug,
|
|
props.contentContainerStyle,
|
|
@@ -25,12 +25,12 @@ export function RNIDetachedViewContent(
|
|
?? DEFAULT_DETACHED_SUBVIEW_ENTRY;
|
|
|
|
const didDetach =
|
|
- (props.isParentDetached ?? false)
|
|
+ (isParentDetached ?? false)
|
|
|| detachedSubviewEntry.didDetachFromOriginalParent;
|
|
|
|
return (
|
|
<RNIWrapperView
|
|
- {...props}
|
|
+ {...rest}
|
|
style={[
|
|
...(IS_USING_NEW_ARCH
|
|
? wrapperStyle
|