forked from
jollywhoppers.com/witchsky.app
fork
Configure Feed
Select the types of activity you want to include in your feed.
Bluesky app fork with some witchin' additions 馃挮
fork
Configure Feed
Select the types of activity you want to include in your feed.
1import {createContext, useContext, useMemo} from 'react'
2import {View} from 'react-native'
3
4import {atoms as a, type ViewStyleProp} from '#/alf'
5
6const Context = createContext({
7 gap: 0,
8})
9Context.displayName = 'GridContext'
10
11export function Row({
12 children,
13 gap = 0,
14 style,
15}: ViewStyleProp & {
16 children: React.ReactNode
17 gap?: number
18}) {
19 return (
20 <Context.Provider value={useMemo(() => ({gap}), [gap])}>
21 <View
22 style={[
23 a.flex_row,
24 a.flex_1,
25 {
26 marginLeft: -gap / 2,
27 marginRight: -gap / 2,
28 },
29 style,
30 ]}>
31 {children}
32 </View>
33 </Context.Provider>
34 )
35}
36
37export function Col({
38 children,
39 width = 1,
40 style,
41}: ViewStyleProp & {
42 children: React.ReactNode
43 width?: number
44}) {
45 const {gap} = useContext(Context)
46 return (
47 <View
48 style={[
49 a.flex_col,
50 {
51 paddingLeft: gap / 2,
52 paddingRight: gap / 2,
53 width: `${width * 100}%`,
54 },
55 style,
56 ]}>
57 {children}
58 </View>
59 )
60}