Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning when using custom rule (order attribute) #30

Open
theohdv opened this issue Apr 26, 2018 · 3 comments
Open

Warning when using custom rule (order attribute) #30

theohdv opened this issue Apr 26, 2018 · 3 comments

Comments

@theohdv
Copy link

theohdv commented Apr 26, 2018

When adding customs rules to the component, always get this warning:

Warning: Failed prop type: Invalid prop `rules.MENTION_RULE.order` of type `number` supplied to `MarkdownView`, expected `function`.

My code:

  const TAG_RULE = {
    order: 1,
    match: (source, state, lookbehind) => /^\{tag\}(.*?)\{\/tag\}/.exec(source),
    parse: (capture, recurseParse, state) => ({ content: capture[1] }),
    render: (node, output, state, styles) => (
      <Text
        key={node.content}>
        {node.content}
      </Text>
    ),
  }

I don't know what order attribute is for, but if I just remove it, it shows me a new warning and If I try to supply a function it does not work anymore. I don't know if this warning has an impact or not but if not, it should be ignored and removed.

@alexisab
Copy link
Contributor

I have the same problem. I try to add a custom rule that is quite similar to the link rule. I want my custom rule executed before the link rule so I have added this order property to my rule object :

{
    order:  SimpleMarkdown.defaultRules.link.order - 0.5,
    ...
}

But it doesn't work and if I tranform it into a function it doesn't work either.

@sslash
Copy link

sslash commented Oct 17, 2018

Same here!

@mixa9269
Copy link

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants