Skip to content

HexagramLine

A single I Ching line component that displays yang (solid) or yin (broken) lines with support for changing lines and traditional values.

import { HexagramLine, LineStack } from '@synchronicity/react-native';

The I Ching uses a traditional numbering system for lines:

ValueNameTypeChanges To
6Old YinChanging YinYang
7Young YangStable Yang-
8Young YinStable Yin-
9Old YangChanging YangYin
<HexagramLine value={7} />
<HexagramLine value={8} />
<HexagramLine value={9} />
<HexagramLine value={6} />

Display line positions (1-6 from bottom):

<HexagramLine value={9} position={1} showNumber />
<HexagramLine value={7} position={2} showNumber />
<HexagramLine value={8} position={3} showNumber />

Changing lines (6 and 9) are highlighted in gold:

<HexagramLine value={9} animated />
<HexagramLine value={6} showTransformed />
<HexagramLine value={7} size="sm" />
<HexagramLine value={7} size="md" />
<HexagramLine value={7} size="lg" />

Render multiple lines stacked vertically (like a hexagram):

<LineStack
values={[7, 8, 9, 6, 7, 8]}
showNumbers
onLinePress={(index, value) => console.log(index, value)}
/>
PropTypeDefaultDescription
value6 | 7 | 8 | 9requiredLine value
size'sm' | 'md' | 'lg''md'Size of line
showNumberbooleanfalseShow position number
positionnumber-Line position (1-6)
highlightedbooleanfalseHighlight the line
animatedbooleanfalseAnimate changing lines
showTransformedbooleanfalseShow transformed state
onPress() => void-Press handler
styleViewStyle-Custom styles
PropTypeDefaultDescription
valuesLineValue[]requiredArray of line values
size'sm' | 'md' | 'lg''md'Size of lines
gapnumber6Gap between lines
showNumbersbooleanfalseShow position numbers
onLinePress(index, value) => void-Line press handler
styleViewStyle-Custom styles