-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCSSWrappedComponents.tsx
More file actions
38 lines (35 loc) · 1.35 KB
/
CSSWrappedComponents.tsx
File metadata and controls
38 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Image as ExpoImage } from 'expo-image';
import { VideoView as ExpoVideoView } from 'expo-video';
import { cssInterop } from 'nativewind';
import { SafeAreaView as RNSafeAreaContextView } from 'react-native-safe-area-context';
import { LegendList as OriginalLegendList } from '@legendapp/list';
import { Platform, ScrollView } from 'react-native';
// Apply cssInterop to enable NativeWind for expo-image
// https://github.com/nativewind/nativewind/issues/680
export const Image = cssInterop(ExpoImage, {
className: 'style',
});
export const SafeAreaView = cssInterop(RNSafeAreaContextView, {
className: 'style',
});
export const VideoView: any = cssInterop(ExpoVideoView, {
className: 'style',
});
const WrappedLegendList = cssInterop(OriginalLegendList, {
className: 'style',
contentContainerClassName: 'contentContainerStyle',
indicatorClassName: 'indicatorStyle',
columnWrapperClassName: 'columnWrapperStyle',
});
// LegendList's default for this property uses an Animated.ScrollView from the built in Animated of react-native itself.
// This doesn't work with react-native-reanimated, so we need to provide our own.
export function LegendList(props: any) {
return (
<WrappedLegendList
renderScrollComponent={(props: any) => {
return <ScrollView {...props} showsScrollIndex={!Platform.isTV} />;
}}
{...props}
/>
);
}