question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native: Failed prop type for 'container'

See original GitHub issue

First off, thanks for providing this great module! I’m working on integrating this into a React Native app, using a custom built preset that creates appropriate React Native components for my project. So far, so good. I’ve wrapped the react component in @bbob/react in a functional component as below, but I’m just running into one warning with PropTypes. In React Native, all text must be inside a Text component, so I need to override the default container with (my custom) Text component.

<BBCodeCore
            container={Text}
            componentProps={rest}
            plugins={[myPreset()]}
            options={{
                onlyAllowTags: [
                    'b',
                    'code',
                    'i',
                    'img',
                    'list',
                    '*',
                    'quote',
                    'url',
                ],
            }}
        >
            {children}
        </BBCodeCore>

This all works fine functionally, but in development I’m getting the below warning from prop-types:

Warning: Failed prop type: Invalid prop 'container' supplied to 'Component', expected a ReactNode.

I believe I’m setting this property as intended, but if there’s a different way to do it to avoid the warning, let me know. Otherwise, is it possible to augment the prop-type for this property to also support this scenario?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JiLiZARTcommented, Nov 4, 2021

@dpolivy Sorry for long release publish 😃 Now you can use 2.7.1 version with your fixes.

0reactions
JiLiZARTcommented, Nov 4, 2021

Sure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed prop type: Invalid prop inputContainerStyle supplied to ...
For anyone else running into this, the issue for me was the type of the value supplied to containerStyle . ... Apparently the...
Read more >
Warning: Failed prop type: Invalid prop `textStyle` of type ...
This is an odd one because the documentation itself for react-native-table-component uses the text-style prop in the same way you do.
Read more >
Typechecking With PropTypes - React
To run typechecking on the props for a component, you can assign the special propTypes property: import PropTypes from 'prop-types'; class Greeting extends ......
Read more >
Why aren't images showing in React Native? Failed prop type ...
Coding example for the question Why aren't images showing in React Native? Failed prop type: Invalid prop `source` supplied to `Image`-React Native.
Read more >
Image - React Native
A React component for displaying different types of images, ... return ( <View style={styles.container}> <Image style={styles.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found