Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/types/SdkTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ type hyperParams = {
topInset: option<float>,
leftInset: option<float>,
rightInset: option<float>,
superpositionConfigRaw: option<JSON.t>,
}

type nativeProp = {
Expand Down Expand Up @@ -932,6 +933,7 @@ let nativeJsonToRecord = (jsonFromNative, rootTag) => {
topInset: getOptionFloat(hyperParams, "topInset"),
leftInset: getOptionFloat(hyperParams, "leftInset"),
rightInset: getOptionFloat(hyperParams, "rightInset"),
superpositionConfigRaw: getOptionJSON(hyperParams, "superpositionConfigRaw")
},
customParams: getObj(dictfromNative, "customParams", Dict.make()),
subscribedEvents: switch dictfromNative->Dict.get("subscribedEvents") {
Expand Down
11 changes: 11 additions & 0 deletions src/utility/logics/Utils.res
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ let getInt = (dict, key, default) => {
getOptionInt(dict, key)->Option.getOr(default)
}

let getOptionJSON = (dict, key) => {
dict
->Dict.get(key)
->Option.flatMap(JSON.Decode.string)
->Option.flatMap(jsonStr =>
try {Some(jsonStr->JSON.parseExn)} catch {
| _ => None
}
)
}

let getBool = (dict, key, default) => {
dict
->Dict.get(key)
Expand Down
Loading