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

๐Ÿ“„ ApplePayButtonViewImpl.web.res ยท 37 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
37open ReactNative

@react.component
let make = (~cornerRadius: float, ~style: Style.t) => {
  let styleDict =
    style
    ->JSON.stringifyAny
    ->Option.getOr("")
    ->JSON.parseExn
    ->Utils.getDictFromJson

  let height =
    styleDict
    ->Utils.getOptionFloat("height")
    ->Option.getOr(100.)
    ->Float.toString

  <View nativeID="apple-wallet-button-container" style>
    <style>
      {React.string(
        `
            apple-pay-button {
                --apple-pay-button-width: ${styleDict->Utils.getString("width", "100%")};
                --apple-pay-button-height: ${height}px;
                --apple-pay-button-border-radius: ${cornerRadius->Float.toString}px;
                display: inline-block !important;
            }
       `,
      )}
    </style>
    <CustomLoader
      style={ReactNative.Style.s({position: #absolute, zIndex: -1, borderRadius: cornerRadius})}
    />
    <apple-pay-button />
  </View>
}