diff --git a/src/generators/ReactNativeGeneratorV2.js b/src/generators/ReactNativeGeneratorV2.js index 06a34acd..3d934619 100644 --- a/src/generators/ReactNativeGeneratorV2.js +++ b/src/generators/ReactNativeGeneratorV2.js @@ -105,8 +105,6 @@ export default class extends BaseGenerator { // static files [ "lib/types/ApiResource.ts", - "lib/types/HydraView.ts", - "lib/types/HydraResponse.ts", "lib/hooks/data.ts", "lib/hooks/mercure.ts", "lib/hooks/modal.ts", @@ -133,6 +131,8 @@ export default class extends BaseGenerator { "components/%s/CreateEditModal.tsx", "components/%s/Form.tsx", "components/%s/LogsRenderer.tsx", + "lib/types/HydraView.ts", + "lib/types/HydraResponse.ts", ].forEach((pattern) => this.createFileFromPattern(pattern, dir, [lc], context) ); diff --git a/templates/react-native-v2/app/(tabs)/foos.tsx b/templates/react-native-v2/app/(tabs)/foos.tsx index 7d9cbcf2..9b6effe5 100644 --- a/templates/react-native-v2/app/(tabs)/foos.tsx +++ b/templates/react-native-v2/app/(tabs)/foos.tsx @@ -33,8 +33,8 @@ export default function Books() { useEffect(() => { if (isSuccess) { - setMember(data["hydra:member"]); - setView(data['hydra:view']); + setMember(data["{{{hydraPrefix}}}member"]); + setView(data['{{{hydraPrefix}}}view']); } }, [isSuccess, data]); diff --git a/templates/react-native-v2/components/Navigation.tsx b/templates/react-native-v2/components/Navigation.tsx index 0332f5cb..ff65f510 100644 --- a/templates/react-native-v2/components/Navigation.tsx +++ b/templates/react-native-v2/components/Navigation.tsx @@ -20,10 +20,10 @@ export default function Navigation(props: { view: HydraView }) { const router = useRouter(); const { - "hydra:first": first, - "hydra:previous": previous, - "hydra:next": next, - "hydra:last": last, + "{{{hydraPrefix}}}first": first, + "{{{hydraPrefix}}}previous": previous, + "{{{hydraPrefix}}}next": next, + "{{{hydraPrefix}}}last": last, } = view; return ( diff --git a/templates/react-native-v2/lib/types/HydraResponse.ts b/templates/react-native-v2/lib/types/HydraResponse.ts index dd7757dd..5a4f1119 100644 --- a/templates/react-native-v2/lib/types/HydraResponse.ts +++ b/templates/react-native-v2/lib/types/HydraResponse.ts @@ -2,6 +2,6 @@ import ApiResource from "./ApiResource"; import { HydraView } from "./HydraView"; export interface HydraResponse { - 'hydra:member'?: Array; - 'hydra:view'?: HydraView; + '{{{hydraPrefix}}}member'?: Array; + '{{{hydraPrefix}}}view'?: HydraView; } \ No newline at end of file diff --git a/templates/react-native-v2/lib/types/HydraView.ts b/templates/react-native-v2/lib/types/HydraView.ts index c4b9e82d..5c874e2c 100644 --- a/templates/react-native-v2/lib/types/HydraView.ts +++ b/templates/react-native-v2/lib/types/HydraView.ts @@ -1,6 +1,6 @@ export interface HydraView { - 'hydra:first'?: string; - 'hydra:last'?: string; - 'hydra:previous'?: string; - 'hydra:next'?: string; + '{{{hydraPrefix}}}first'?: string; + '{{{hydraPrefix}}}last'?: string; + '{{{hydraPrefix}}}previous'?: string; + '{{{hydraPrefix}}}next'?: string; } \ No newline at end of file