Skip to content

Commit

Permalink
enhance: Give RN components distinct names for debuggability
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker committed Jun 13, 2024
1 parent 559cd8a commit ad23e04
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/lemon-pumpkins-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@data-client/react': patch
---

React Native components have distinct name from non-native to help debuggability
3 changes: 2 additions & 1 deletion packages/react/src/components/AsyncBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ function AsyncBoundary({
fallback,
...errorProps
}: Props): JSX.Element {
const susProps = fallback !== undefined ? { fallback } : {};
return (
<Suspense fallback={fallback}>
<Suspense {...susProps}>
<ErrorBoundary {...errorProps} fallbackComponent={errorComponent}>
{children}
</ErrorBoundary>
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/BackupLoading.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { useEffect } from 'react';
import { Text, Linking, View } from 'react-native';

export default function Loading() {
export default function BackupLoadingNative() {
let message = <Text>loading...</Text>;
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/BackupLoading.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';

export default function Loading() {
export default function BackupLoading() {
let message: React.ReactNode = 'loading...';
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
Expand Down
6 changes: 5 additions & 1 deletion packages/react/src/components/DevToolsButton.native.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// this is not useful in react native
export default function DevToolsButton({ pos }: { pos: DevToolsPosition }) {
export default function DevToolsButtonNative({
pos,
}: {
pos: DevToolsPosition;
}) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/ErrorFallback.native.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Text } from 'react-native';

const ErrorFallback = ({
const ErrorFallbackNative = ({
error,
}: {
error: Error;
resetErrorBoundary: () => void;
className: string;
}) => <Text role="alert">{error.message}</Text>;

export default ErrorFallback;
export default ErrorFallbackNative;

0 comments on commit ad23e04

Please sign in to comment.