javascript – 如果没有测量功能,无法将没有YogaNode的孩子添加到父级! (尝试将’ReactRawTextShadowNode’添加到’LayoutShadow

前端之家收集整理的这篇文章主要介绍了javascript – 如果没有测量功能,无法将没有YogaNode的孩子添加到父级! (尝试将’ReactRawTextShadowNode’添加到’LayoutShadow前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
根据 this教程,这是我用作反应基础组件作为侧栏组件的组件,它的工作非常好,但是当我从< Text>更改列表项时问题就出现了.到< Button>
import { Text,Container,Header,Content,List,ListItem,TextBody,Button } from 'native-base';
import { StackNavigator,DrawerNavigator } from 'react-navigation'

export default class SideBar extends Component {

    render() {
        return (
            <Content style={{ backgroundColor: '#ffffff' }}>
                <Container>

                    <Content>
                        <List>
                            <ListItem>
                                <Text>First</Text>
                            </ListItem>
                            <ListItem>
                                <Text>Secount</Text>
                            </ListItem>
                            <ListItem>
                                <Text>Third</Text>
                            </ListItem>
                        </List>
                    </Content>
                </Container>
            </Content>
        );
    }
}

我收到此错误

cant add a child that doesn’t have a YogaNede to parent without the
measure function !(Trying to Add a ‘ReactRawTextshadow’ to a
‘LayoutShadowNode’ )

根本无法理解这个错误,并没有在网上看到任何关于它的事情!

> Cannot add a child that doesn't have a YogaNode to a parent without a
> measure function! (Trying to add a 'ReactRawTextShadowNode' to a
> 'LayoutShadowNode') addChildAt
>     ReactShadowNodeImpl.java:199 addChildAt
>     ReactShadowNodeImpl.java:54 setChildren
>     UIImplementation.java:472 setChildren
>     UIManagerModule.java:436 invoke
>     Method.java invoke
>     Method.java:372 invoke
>     JavaMethodWrapper.java:374 invoke
>     JavaModuleWrapper.java:162 run
>     NativeRunnable.java handleCallback
>     Handler.java:739 dispatchMessage
>     Handler.java:95 dispatchMessage
>     MessageQueueThreadHandler.java:31 loop
>     Looper.java:135 run
>     MessageQueueThreadImpl.java:194 run
>     Thread.java:818

解决方法

你应该使用< Text>在< Button>中显示文字像这样
<ListItem>
    <Button> <Text>First</Text> </Button>
</ListItem>
原文链接:https://www.f2er.com/js/155987.html

猜你在找的JavaScript相关文章