-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: user can record and view observation fields (#352)
* chore: observation fields screens * chore: translations * chore: update navigation * feat: view observation details in an observation * chore: remove console.log * chore: pr review
- Loading branch information
Showing
14 changed files
with
548 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
|
||
import {SelectOne} from './SelectOne'; | ||
import {SelectMultiple} from './SelectMultiple'; | ||
import {TextArea} from './TextArea'; | ||
import {Field} from '@mapeo/schema'; | ||
import { | ||
SelectMultipleField, | ||
SelectOneField, | ||
} from '../../sharedTypes/PresetTypes'; | ||
|
||
export type QuestionProps = { | ||
field: Field; | ||
}; | ||
|
||
export const Question = ({field}: QuestionProps) => { | ||
if (field.type === 'selectOne' && Array.isArray(field.options)) { | ||
return <SelectOne field={field as SelectOneField} />; | ||
} | ||
|
||
if (field.type === 'selectMultiple' && Array.isArray(field.options)) { | ||
return <SelectMultiple field={field as SelectMultipleField} />; | ||
} | ||
|
||
return <TextArea field={field} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as React from 'react'; | ||
import {View, StyleSheet} from 'react-native'; | ||
import {FormattedFieldProp} from '../../sharedComponents/FormattedData'; | ||
import {Text} from '../../sharedComponents/Text'; | ||
import {Field} from '@mapeo/schema'; | ||
|
||
interface Props { | ||
field: Field; | ||
} | ||
|
||
export const QuestionLabel = ({field}: Props) => { | ||
const hint = <FormattedFieldProp field={field} propName="placeholder" />; | ||
return ( | ||
<View style={styles.labelContainer}> | ||
<Text style={styles.label}> | ||
<FormattedFieldProp field={field} propName="label" /> | ||
</Text> | ||
{hint ? <Text style={styles.hint}>{hint}</Text> : null} | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
labelContainer: { | ||
flex: 0, | ||
padding: 20, | ||
borderBottomWidth: 2, | ||
borderColor: '#F3F3F3', | ||
}, | ||
label: { | ||
fontSize: 20, | ||
color: 'black', | ||
fontWeight: '700', | ||
}, | ||
hint: { | ||
fontSize: 16, | ||
color: '#666666', | ||
fontWeight: '500', | ||
}, | ||
}); |
Oops, something went wrong.