Closed atabel closed 11 months ago
withDismiss => dismissible ?
It says false
by default. To me the default should be to allow closing it. I believe most snackbars are just feedback messages.
/**
* by default, if there is buttonText, it's 10 seconds, if there isn't buttonText, it's 5 seconds
* "PERSISTENT" won't dismiss the snackbar until there is an user interaction
* "FIVE_SECONDS" | "TEN_SECONDS" can be specified explicitly too
* `number` is always ignored by native app, as it is in current implementation. Won't remove it for
* backwards compatibility
*/
duration?: "PERSISTENT" | "FIVE_SECONDS" | "TEN_SECONDS" | number,
Perhaps the postmessage API should just accept a number of milliseconds and consider the 0
/null
/undefined
as Infinity
. The product defined defaults can be specified in mistica.
Note that JSON.stringify({t: Infinity})
returns '{"t": null}'
/** * by default, if there is buttonText, it's 10 seconds, if there isn't buttonText, it's 5 seconds * "PERSISTENT" won't dismiss the snackbar until there is an user interaction * "FIVE_SECONDS" | "TEN_SECONDS" can be specified explicitly too * `number` is always ignored by native app, as it is in current implementation. Won't remove it for * backwards compatibility */ duration?: "PERSISTENT" | "FIVE_SECONDS" | "TEN_SECONDS" | number,
Perhaps the postmessage API should just accept a number of milliseconds and consider the
0
/null
/undefined
asInfinity
. The product defined defaults can be specified in mistica.Note that
JSON.stringify({t: Infinity})
returns'{"t": null}'
For native, there is no distinction between null
/undefined
, and a null/undefined usually means to use the default value, in this case 10s/5s. Also we don't want to support an arbitrary number of ms. Using 0 as PERSISTENT sounds weird to me
withDismiss => dismissible ?
It says
false
by default. To me the default should be to allow closing it. I believe most snackbars are just feedback messages.
Dismissable means that can be dismissed, withDismiss
means it has the dismiss button. A snackbar can be dismissed with the action button too. That's my reasoning to call it withDismiss
.
Update, removed "FIVE_SECONDS"
and "TEN_SECONDS"
from duration
enum, as they are redundant or ignored by native side, as explained in https://github.com/Telefonica/webview-bridge/pull/118#discussion_r1371229074
Current status
Currently, this is a fire and forget message, the web ask native app to show a snackbar with a
message
and an optionalbuttonText
. The native app doesn't respond with any message to the web.:warning: Note: apparently, iOS and Android are currently ignoring the
duration
param and iOS is also ignoring thebuttonText
param :man_facepalming:New requirements
Figma specs: https://www.figma.com/file/yCHLIfy4WMfRdlADwyL4kZ/%F0%9F%94%B8-Snackbar-Specs?type=design&node-id=0-1&mode=design&t=0A9H1Zwcmrc3Pika-0
Proposed solution
Message type:
The native app will respond with a message with this shape: