使用来自 React Native 和 Native Base 的按钮
Using Button from React Native and Native Base
我在 React Native 中使用 Native 基础库。
在本机基础中,有一个名为 Button 的组件,还有来自 'react-native'.
的 Component Button
如果我想同时使用两个 Button 组件,我应该怎么做?
您可以使用alias
import { Button } from 'react-native'
import { Button as ButtonBase } from 'native-base';
和
<Button /> {# React Native Button #}
<ButtonBase /> {# Native Base Button #}
您可以通过在默认名称和您想要的新名称之间添加单词 as
来简单地使用 ALIAS 例如:
import {View as V} form react-native;
并且在您的 render()
函数中,您可以像
那样调用它
<V>...</V>
所以对于你的问题你可以这样做你可以这样做
import {Button as ButtonMain} from react-native;
import {Button as ButtonRB} from react-native;
您可以在 render()
函数中这样调用它们:
<ButtonMain />
<ButtonRB />
我在 React Native 中使用 Native 基础库。 在本机基础中,有一个名为 Button 的组件,还有来自 'react-native'.
的 Component Button如果我想同时使用两个 Button 组件,我应该怎么做?
您可以使用alias
import { Button } from 'react-native'
import { Button as ButtonBase } from 'native-base';
和
<Button /> {# React Native Button #}
<ButtonBase /> {# Native Base Button #}
您可以通过在默认名称和您想要的新名称之间添加单词 as
来简单地使用 ALIAS 例如:
import {View as V} form react-native;
并且在您的 render()
函数中,您可以像
<V>...</V>
所以对于你的问题你可以这样做你可以这样做
import {Button as ButtonMain} from react-native;
import {Button as ButtonRB} from react-native;
您可以在 render()
函数中这样调用它们:
<ButtonMain />
<ButtonRB />