GithubHelp home page GithubHelp logo

hparton / react-native-merlin Goto Github PK

View Code? Open in Web Editor NEW
84.0 84.0 4.0 1.6 MB

๐Ÿง™ Simple web-like forms in react native.

License: MIT License

JavaScript 57.31% Starlark 1.56% Java 16.06% Ruby 13.72% Objective-C 11.35%
form forms hacktoberfest react react-native validation

react-native-merlin's People

Contributors

dependabot[bot] avatar gfpacheco avatar hparton avatar mrrio avatar sambeevors avatar travisobregon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-merlin's Issues

Write up example usage docs for common use cases

Initial examples I can think of:

  • Simple form.
  • Custom form inputs.
  • Third party form inputs.
  • Custom validator.
  • Custom validator referencing other field values.
  • Custom async validator (need to add support for this but will need docs eventually).
  • External errors via ref.
  • External values/errors via external state and watchers.
  • Error type/messages.
  • handleValue explanation.
  • eventKey explanation.
  • instantValidation explanation.
  • Async submission handling.
  • Handling external api errors after submission.
  • Auto focusing with a multiline field.
  • Some documentation around useForm if people want to expand with their own components.

Add support for custom async validators

Currently working on this on a branch but ran into the usual issues with swapping from synchronous to async. Needs a bit more work then will push it up and write some docs for it.

  • Get initial version working and pushed up on a branch
  • Write some documentation around how this works

When you use validation on a component with multiple child inputs pressing enter on the previous input will throw an error

  • Set up two components, one standard input and one custom component with multiple inputs as children

Screenshot 2021-11-08 at 10 41 50

  • Press enter while in the first component, it will try to find the next input field from the ref but as the ref is actually a custom component and not an input the 'current' value is null. This will throw an error. Merlin.js (line 141)

Screenshot 2021-11-08 at 10 37 44

const nextFocusableInput = nextInputs.find( (element) => inputRefs[element.props.name]?.current?.focus )

This would ignore the next input and just submit the form, not ideal but would stop the error from happening. The other solution would be to look for input children in a custom component with a ref.

Add disabled to Input

It would be nice to have support for disabled on Form.Input to be more in line with HTML forms.

Add support for dot notation names

Currently in the example pet.name would set the form values to:

{
  'pet.name': 'Example'
}

It should be resolving to:

{
  pet: {
    name: 'Example'
  }
}

Not sure if it's worth adding support for array format to the names at the same time since we will essentially be parsing the dot notation into that.

Add support for custom error messages

Not sure if this should live on the input itself and change the text that gets saved to the errors or if it should be a prop on the Form.Error to modify the output. Putting it on the error feels cleaner as the inputs already have a lot of props but then I'm not sure how we would then support passing custom errors to custom input components.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.