Skip to content

Commit

Permalink
fix: custom forms not loading in form gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
hopetambala committed Mar 30, 2022
1 parent 020a960 commit 68f1991
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import {
Card, Text,
} from 'react-native-paper';
import uuid from 'react-native-uuid';

import I18n from '../../../../modules/i18n';
import { layout } from '../../../../modules/theme';
Expand All @@ -14,7 +15,7 @@ import styles from '../index.styles';
const FormsHorizontalView = ({
forms, header, navigateToCustomForm, pinForm
}) => (
<View key={header} style={layout.screenRow}>
<View key={() => uuid.v4()} style={layout.screenRow}>
{header && (
<View style={{ flexDirection: 'row' }}>
<Text style={styles.mediumHeader}>{header}</Text>
Expand All @@ -23,7 +24,7 @@ const FormsHorizontalView = ({
<ScrollView horizontal>
{forms.map((form) => (
<Card
key={form.objectId}
key={() => uuid.v4() || form.objectId}
style={layout.cardSmallStyle}
onPress={() => {
navigateToCustomForm(form);
Expand All @@ -41,7 +42,7 @@ const FormsHorizontalView = ({
))}
{forms?.length < 1 && (
<View style={layout.screenRow}>
<Card>
<Card key={() => uuid.v4()}>
<Card.Title title={I18n.t('formsGallery.noCustomForms')} />
{/* To be used when marketplace is available */}
{/* <Card.Content>
Expand Down
6 changes: 2 additions & 4 deletions domains/DataCollection/FormGallery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ const FormGallery = ({

useEffect(() => {
getData('customForms').then((forms) => {
if (forms) {
setCustomForms(forms);
filterWorkflows(forms);
}
setCustomForms(forms || []);
filterWorkflows(forms || []);
});
}, [customForms]);

Expand Down

0 comments on commit 68f1991

Please sign in to comment.