-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplineView.tsx
More file actions
45 lines (38 loc) · 1.17 KB
/
SplineView.tsx
File metadata and controls
45 lines (38 loc) · 1.17 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
39
40
41
42
43
44
45
import React from 'react';
import { View, StyleSheet, Platform, StyleProp, ViewStyle } from 'react-native';
import { WebView } from 'react-native-webview';
import { requireNativeComponent } from 'react-native';
interface SplnViewProps {
style?: StyleProp<ViewStyle>;
}
const SplnView = requireNativeComponent<SplnViewProps>('SplnView');
interface SplineViewProps {
variant?: 'webview' | 'native-ios';
style?: StyleProp<ViewStyle>;
}
const SplineView = ({ variant = 'webview', style }: SplineViewProps) => {
if (variant === 'native-ios' && Platform.OS === 'ios') {
return (
<View style={[styles.container, style]}>
<SplnView style={{ flex: 1 }} />
</View>
);
}
// default webview
return (
<View style={[styles.container, style]}>
<WebView
source={{ uri: 'https://my.spline.design/art-0fe762c1edfdc78c9d476e1f67551903/' }}
style={{ flex: 1 }}
javaScriptEnabled={true}
domStorageEnabled={true}
allowsInlineMediaPlayback={true}
mediaPlaybackRequiresUserAction={false}
/>
</View>
);
};
const styles = StyleSheet.create({
container: { flex: 1 }
});
export default SplineView;