๐Ÿ“ฆ manideepk90 / react-native-hyperswitch-sdk

๐Ÿ“„ HostedCheckout.res ยท 49 lines
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
46
47
48
49open ReactNative
open Style

@react.component
let make = () => {
  let mediaView = WindowDimension.useMediaView()
  let shadowStyle = ShadowHook.useGetShadowStyle(~shadowIntensity=16., ~shadowColor="#0000000f", ())

  let isDesktop = mediaView === Desktop

  <ScrollView
    keyboardShouldPersistTaps={#handled}
    showsVerticalScrollIndicator=false
    contentContainerStyle={array([s({flexGrow: 1., alignItems: #center})])}
  >
    {isDesktop
      ? <View
          style={array([
            s({
              position: #absolute,
              width: 50.->pct,
              height: 100.->pct,
              top: 0.->dp,
              right: 0.->dp,
            }),
            shadowStyle,
          ])}
        />
      : React.null}
    <View
      style={array([
        s({
          flex: 1.,
          flexDirection: isDesktop ? #row : #column,
          width: isDesktop ? auto : 100.->pct,
          gap: {isDesktop ? 100. : 10.}->dp,
        }),
      ])}
    >
      <View style={s({zIndex: 999})}>
        <CheckoutView isDesktop />
      </View>
      <View style={s({maxWidth: 380.->dp})}>
        <ParentPaymentSheet />
      </View>
    </View>
  </ScrollView>
}