diff --git a/app/components/record/W3CCredentialRecord.tsx b/app/components/record/W3CCredentialRecord.tsx index 8f9a58e8..caef85f7 100644 --- a/app/components/record/W3CCredentialRecord.tsx +++ b/app/components/record/W3CCredentialRecord.tsx @@ -28,15 +28,14 @@ export interface RecordProps { const W3CCredentialRecord: React.FC = ({ header, footer, - fields, hideFieldValues = false, tables, w3cCredential, renderCertificate, }) => { const { t } = useTranslation() - const [shown, setShown] = useState([]) - const [showAll, setShowAll] = useState(false) + const [shown, setShown] = useState([]) + const [showAll, setShowAll] = useState(true) const { ListItems, TextTheme, ColorPallet } = useTheme() const styles = StyleSheet.create({ @@ -66,19 +65,13 @@ const W3CCredentialRecord: React.FC = ({ }) const resetShown = (): void => { - setShown(fields.map(() => showAll)) + setShown(tables.map(table => table.rows.map(() => showAll))) setShowAll(!showAll) } - const toggleShownState = (newShowStates: boolean[]): void => { - if (newShowStates.filter(shownState => shownState === showAll).length > Math.floor(fields.length / 2)) { - setShowAll(!showAll) - } - } - useEffect(() => { resetShown() - }, []) + }, [tables]) return ( = ({ hideFieldValue={hideFieldValues} onToggleViewPressed={() => { const newShowState = [...shown] - newShowState[index] = !shown[index] + newShowState[index][idx] = !shown[index][idx] setShown(newShowState) - toggleShownState(newShowState) }} - shown={hideFieldValues ? !!shown[index] : true} + shown={hideFieldValues ? !!(shown?.[index]?.[idx] ?? false) : true} hideBottomBorder={idx === table.rows.length - 1} /> ))} diff --git a/app/components/record/W3CCredentialRecordField.tsx b/app/components/record/W3CCredentialRecordField.tsx index c8e5c8cc..069fc697 100644 --- a/app/components/record/W3CCredentialRecordField.tsx +++ b/app/components/record/W3CCredentialRecordField.tsx @@ -98,7 +98,7 @@ const W3CCredentialRecordField: React.FC = ({ ) : null} - {} + ) } diff --git a/app/navigators/ContactStack.tsx b/app/navigators/ContactStack.tsx index 8c63d5d9..a813bc4f 100644 --- a/app/navigators/ContactStack.tsx +++ b/app/navigators/ContactStack.tsx @@ -62,7 +62,7 @@ const ContactStack: React.FC = () => { { = ({ navigation }) = }), polygon: new PolygonModule({}), dids: new DidsModule({ - resolvers: [new PolygonDidResolver(), new IndyVdrIndyDidResolver()], + resolvers: [new PolygonDidResolver(), new IndyVdrIndyDidResolver(), new WebDidResolver()], }), cache: new CacheModule({ cache: new SingleContextStorageLruCache({ diff --git a/app/screens/Splash.tsx b/app/screens/Splash.tsx index cc9847b0..da72c5f2 100644 --- a/app/screens/Splash.tsx +++ b/app/screens/Splash.tsx @@ -9,6 +9,7 @@ import { CacheModule, SingleContextStorageLruCache, MediatorPickupStrategy, + WebDidResolver, } from '@adeya/ssi' import { PolygonDidResolver, PolygonModule } from '@ayanworks/credo-polygon-w3c-module' import AsyncStorage from '@react-native-async-storage/async-storage' @@ -298,7 +299,7 @@ const Splash: React.FC = () => { }), polygon: new PolygonModule({}), dids: new DidsModule({ - resolvers: [new PolygonDidResolver(), new IndyVdrIndyDidResolver()], + resolvers: [new PolygonDidResolver(), new IndyVdrIndyDidResolver(), new WebDidResolver()], }), cache: new CacheModule({ cache: new SingleContextStorageLruCache({