Skip to content

Instantly share code, notes, and snippets.

using NativeDateTimePickerDialog dialog = new NativeDateTimePickerDialog();
var dateTimeParam = new DialoDateTimeParam(
"Date Time Picker",
DateTimePickerMode.UIDatePickerModeDateAndTime,
"OK",
"Cancel",
247868400000); //8.11.1977 8:20 PM UTC
dialog.ShowNativeDateTimeDialogAsync(dateTimeParam)
using var picker = new NativeCountryPicker.NativeCountryPicker();
var pickerParams = new NativeCountryPickerParams(
title: "What's your country?",
selectedCountry: "USA",
closeButtonLabel: "Close");
var result = await picker.ShowCountryDialogAsync(pickerParams);
if (this.label != null)
{
if (result.Item2 == NativeCountryErrorCodes.NoError)
using var picker = new NativePhonePicker();
var pickerParams = new NativePhonePickerParams(textFieldLabel: "What's your phone number?",
buttonLabel: "Confirm", selectedCountry: "US", title: "Phone Picker Sample", selectedCountryLabel: "Select Country");
var result = await picker.ShowPhoneNumberDialogAsync(pickerParams);
if (this.label !=null)
{
if (result.Item2 == NativePhoneErrorCodes.NoError)
this.label.text = $"{result.Item1.DialCode}{result.Item1.Number}";
else
@protorius42
protorius42 / NativeShare.cs
Created August 11, 2022 16:58
Native Share
using (NativeShareDialog dialog = new NativeShareDialog())
{
NativeShareParams conf = new NativeShareParams()
{
//Url = "www.example.com/facebook-messenger",
Title = "TITLE", //NO
Text = "<<Input your MESSAGE here>> \n www.example.com/facebook-messenger", //OK
PackageName = "com.facebook.orca" //OK
};
@protorius42
protorius42 / NativeDialog.cs
Last active December 30, 2021 16:22
Native Alert Dialog in C#
using (NativeAlertDialog dialog = new NativeAlertDialog())
{
DialogParams dialogParams = new DialogParams("<<Input your TITLE here>>", "<<Input your MESSAGE here>>");
dialog.ShowNativeDialogAsync(dialogParams).ContinueWith(task =>
{
if (task.Result.Item2 != ButtonErrorCode.NoError)
{
//your error handling here
}
else