Skip to content

TrigramCard

TrigramCard is a flippable flashcard for learning the eight trigrams. The front shows the symbol, and the back reveals the name, element, and attributes.

Tap to reveal name

Shows the trigram symbol with a hint to tap.

Tap to reveal name

Reveals the trigram’s full information.

Heaven乾 · QiánThe Creative, Strong

Heaven
Earth
Water
Fire
Thunder
Wind
Mountain
Lake
SymbolBinaryNameChineseElementAttribute
111QianHeavenCreative, Strong
000KunEarthReceptive, Yielding
010KanWaterAbysmal, Dangerous
101LiFireClinging, Bright
001ZhenThunderArousing, Movement
110XunWindGentle, Penetrating
100GenMountainKeeping Still
011DuiLakeJoyous, Open

The card uses a 250ms flip animation with opacity crossfade:

Animated.timing(flipAnimation, {
toValue: isRevealed ? 0 : 1,
duration: 250,
useNativeDriver: true,
}).start();

The front and back faces animate their rotation and opacity:

PhaseFront OpacityBack Opacity
0% (front)10
50% (mid-flip)00
100% (back)01

PropTypeDescription
trigramKeystringBinary key (e.g., ‘111’, ‘000’)
namestringRomanized name (e.g., ‘Qian’)
chinesestringChinese character (e.g., ‘乾’)
elementstringElement name (e.g., ‘Heaven’)
attributestringKey attributes
isRevealedbooleanCurrent flip state
onFlip() => voidCalled after flip animation

import TrigramCard from '@synchronicity/react-native';
import { useState } from 'react';
function TrigramQuiz() {
const [isRevealed, setIsRevealed] = useState(false);
return (
<TrigramCard
trigramKey="111"
name="Qian"
chinese=""
element="Heaven"
attribute="The Creative, Strong"
isRevealed={isRevealed}
onFlip={() => setIsRevealed(!isRevealed)}
/>
);
}

  • Role: accessibilityRole="button"
  • Label: Describes card state and content
  • Hint: Instructions for interaction
  • State: accessibilityState={{ disabled: isFlipping }}
// Front state
accessibilityLabel="Trigram card showing ☰ symbol. Tap to reveal name."
accessibilityHint="Double tap to reveal the trigram name and details"
// Back state (revealed)
accessibilityLabel="Qian trigram, 乾, Heaven element, The Creative, Strong"
accessibilityHint="Card is revealed showing trigram details"

import TrigramCard from '@synchronicity/react-native';
import { useState, useCallback } from 'react';
const TRIGRAMS = [
{ key: '111', name: 'Qian', chinese: '', element: 'Heaven', attribute: 'The Creative, Strong' },
{ key: '000', name: 'Kun', chinese: '', element: 'Earth', attribute: 'The Receptive, Yielding' },
// ... other trigrams
];
function TrigramPractice() {
const [currentIndex, setCurrentIndex] = useState(0);
const [revealed, setRevealed] = useState(false);
const trigram = TRIGRAMS[currentIndex];
const handleFlip = useCallback(() => {
setRevealed(prev => !prev);
}, []);
const handleNext = useCallback(() => {
setRevealed(false);
setCurrentIndex(prev => (prev + 1) % TRIGRAMS.length);
}, []);
return (
<View style={styles.container}>
<Text style={styles.progress}>
{currentIndex + 1} / {TRIGRAMS.length}
</Text>
<TrigramCard
trigramKey={trigram.key}
name={trigram.name}
chinese={trigram.chinese}
element={trigram.element}
attribute={trigram.attribute}
isRevealed={revealed}
onFlip={handleFlip}
/>
{revealed && (
<Button variant="primary" onPress={handleNext}>
Next Trigram
</Button>
)}
</View>
);
}