I know I know, I was also into a similar situation, scratching my head and don't feel bad if you are in a similar situation. There would be tons of questions popping off your mind just like it did for me and let us walk through a few of them shall we?
CLI apps or so called command line apps are a fantastic way to learn language features and also to do some cool stuffs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"plugins": [ | |
["@babel/plugin-transform-react-jsx", { | |
"pragma": "QndReact.createElement", // default pragma is React.createElement | |
"throwIfNamespace": false // defaults to true | |
}] | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const content = ( | |
<h1 className="primary"> | |
QndReact is Quick and dirty react{" "} | |
<p>It is about building your own React in 90 lines of JavsScript</p> | |
</h1> | |
); | |
// The above jsx gets converted into | |
/** | |
* React.createElement(type, attributes, children) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace XamarinFormValidation.Validators.Contracts | |
{ | |
public interface IValidator | |
{ | |
string Message { get; set; } | |
bool Check(string value); | |
} | |
public interface IAsyncValidator | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:Validators="clr-namespace:XamarinFormValidation.Validators.Implementations" | |
xmlns:Behaviors="clr-namespace:XamarinFormValidation.Behaviors" | |
xmlns:local="clr-namespace:XamarinFormValidation" x:Class="XamarinFormValidation.MainPage"> | |
<StackLayout Padding="15"> | |
<StackLayout.Behaviors> | |
<Behaviors:ValidationGroupBehavior x:Name="form"/> | |
</StackLayout.Behaviors> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
namespace XamarinFormValidation.Behaviors | |
{ | |
public class ValidationBehavior : Behavior<View> | |
{ | |
... | |
public ValidationGroupBehavior Group { get; set; } | |
public bool Validate() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
namespace XamarinFormValidation.Behaviors | |
{ | |
public class ValidationGroupBehavior: Behavior<View> | |
{ | |
... | |
public void Update() | |
{ | |
bool isValid = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
namespace XamarinFormValidation.Behaviors | |
{ | |
public class ValidationGroupBehavior: Behavior<View> | |
{ | |
... | |
public void Add(ValidationBehavior validationBehavior) | |
{ | |
_validationBehaviors.Add(validationBehavior); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xamarin.Forms; | |
using System.Collections.Generic; | |
namespace XamarinFormValidation.Behaviors | |
{ | |
public class ValidationGroupBehavior: Behavior<View> | |
{ | |
IList<ValidationBehavior> _validationBehaviors; | |
public static readonly BindableProperty IsValidProperty = | |
BindableProperty.Create("IsValid", |
NewerOlder