因为图像可以显示它,我的应用程序在我的页脚顶部和我的标题的底部显示一行.它在Native Base中似乎很常见.我已经检查了本机主题但我找不到一些来修复此错误.
码:
import React, { Component } from 'react';
import { Container, Content, Footer, FooterTab, Button, Icon, Text, Header, Title, Left, Right, Body, } from 'native-base';
export default class FooterTabsExample extends Component {
render() {
return (
<Container>
<Header>
<Left>
<Button transparent>
<Icon name='arrow-back' />
</Button>
</Left>
<Body>
<Title>Header</Title>
</Body>
<Right>
<Button transparent>
<Icon name='menu' />
</Button>
</Right>
</Header>
<Content style={{backgroundColor:'black'}}/>
<Footer >
<FooterTab>
<Button>
<Icon name="apps" />
<Text>Apps</Text>
</Button>
<Button>
<Icon name="camera" />
<Text>Camera</Text>
</Button>
<Button active> …Run Code Online (Sandbox Code Playgroud) 我正在使用NativeBase的Toast组件在成功提交表单后显示一条消息,但是每次运行它时,都会在控制台中收到此错误消息。
_onSubmit error TypeError: Cannot read property '_root' of null
at Function.show (ToastContainer.js:79)
at InventoryItemAdd.js:40
at tryCallOne (core.js:37)
at core.js:123
at JSTimers.js:98
at Object.callTimer (JSTimersExecution.js:95)
at Object.callImmediatesPass (JSTimersExecution.js:199)
at Object.callImmediates (JSTimersExecution.js:214)
at MessageQueue.js:222
at guard (MessageQueue.js:46)
Run Code Online (Sandbox Code Playgroud)
这是我的渲染函数中的JSX:
<Container>
<Navbar title="Add an Inventory Item" backArrow />
<Content keyboardShouldPersistTaps="handled">
<InventoryItemAddForm
onSubmit={this._onSubmit}
data={formData}
enableReinitialize={true}
initialValues={initialValues}
/>
</Content>
<FooterTabs />
</Container>
Run Code Online (Sandbox Code Playgroud)
而我的_onSubmit功能:
_onSubmit = ({name, inventoryTypeId, internalCode, description = "", measurementUnitId}) => {
const {inventoryItemCreate, showErrors} = this.props
return inventoryItemCreate({
input: { …Run Code Online (Sandbox Code Playgroud) 这是关于React Native应用程序的Native Base框架的问题:
想象一下订阅屏幕; 1个文本输入和一个订阅按钮;
在我输入我的电子邮件地址后,我想点击订阅按钮,但我的第一个点击只关闭键盘,我需要再次点击按下按钮.这怎么可以避免?我的预期行为是第一次点按是按下按钮.(据我所知,这是<Content>组件的一部分,但我不确定.)
(我已经在本机厨房水槽应用程序上检查了这个问题,同样的问题也出现在那里.只需转到:'表单和输入'部分并看到'固定标签')
我是智能手机编程的新手,并使用React Native和NativeBase加入了一个项目.
我想在拾取器中的每个项目中包含一个图像/图标,这看起来不像是一个奇特的概念,但它似乎没有被支持,我找不到任何人讨论在SO或者谷歌搜索.
我已经尝试了几种方法在里面添加东西<Picker.Item>,</Picker.Item>但放在那里的任何东西似乎都被忽略了.
是否有可能或者有不同的方法来使用这些框架来做我想做的事情?
标签工作正常.但是我不能<Tabs>像下面的图像那样改变下划线和高度
我正在使用Native-Base来处理标签.但我想不出任何改变其默认高度的方法.
<Tabs initialPage={0}
tabBarUnderlineStyle={styles.tabBarUnderlineStyle}
style={{height:40}}
>
<Tab
heading="Following"
tabStyle={styles.tabStyle}
activeTabStyle={styles.activeTabStyle}
activeTextStyle={styles.activeTextStyle}
textStyle={styles.textStyle}
>
<FeedScreen navigation={this.props.navigation}/>
</Tab>
Run Code Online (Sandbox Code Playgroud)
我应该使用其他导航吗?原生基地很难定制.. :(
更新请求,我分享我的风格
tabStyle : {
// backgroundColor: theme.colors.navbar,
backgroundColor: 'white',
justifyContent: 'center',
width: 120,
height: 40,
},
activeTabStyle: {
backgroundColor: 'white',
height: 40,
},
textStyle: {
// color: 'white',
color: "#968D8A"
},
activeTextStyle: {
// color: 'white',
color: theme.colors.navbar
},
tabBarUnderlineStyle: {
backgroundColor: theme.colors.navbar,
height: 2
}
Run Code Online (Sandbox Code Playgroud) 我正试图让这些卡片可以点击以重定向到另一个屏幕,但我无法弄明白
let cards = this.state.items.map(item => (
<Card key={item.id} onPress={() => Actions.dogScreen()}>
<CardItem bordered>
<Left>
<Thumbnail square source={item.image ? { uri: "data:image/jpeg;base64," + item.image } : logo} />
<Body>
<Text>Name: {item.name}, Age: {item.age}</Text>
<Text note>Gender: {item.gender.name} Race: {item.race.name}</Text>
</Body>
</Left>
</CardItem>
</Card>))
Run Code Online (Sandbox Code Playgroud) 我想问一下,如何删除 Form 组件中的左侧间距,我的设计使用本机基本 UI。这是我的代码如下:
<Form>
<Item style={styles.loginInputItem}>
<Input placeholder="Email address" style={styles.loginInput} placeholderTextColor="#FFFFFF" />
</Item>
<Item style={styles.loginInputItem}>
<Input placeholder="Password" secureTextEntry={true} style={styles.loginInput} placeholderTextColor="#FFFFFF" />
</Item>
<Button block style={styles.loginButton}>
<Text>Login</Text>
</Button>
<Button block style={styles.loginFacebookButton}>
<Text>Connect with Facebook</Text>
</Button>
<Button block style={styles.loginGoogleButton}>
<Text style={styles.loginGoogleButtonText}>Connect with Google</Text>
</Button>
<Button block transparent light>
<Text>Forgot Password?</Text>
</Button>
</Form>
Run Code Online (Sandbox Code Playgroud)
如何在FlatList中关闭SwipeRow?
这是ListView的简单方法,但由于下一个版本将使用FlatList,因此应该可以.
从阅读他们的源代码,它似乎还没有实现.
在使用 import Native Base 时(因为它来了),我遇到了问题,因为屏幕中显示了字体错误。如果您单击关闭它会消失,但用户无法在每次加载文本时看到它。¿是否有解决字体问题的正确方法?
这个官方文档说要这样做:
// At the top of your file
import { Font } from 'expo';
import { Ionicons } from '@expo/vector-icons';
// Later on in your component
async componentDidMount() {
await Font.loadAsync({
'Roboto': require('native-base/Fonts/Roboto.ttf'),
'Roboto_medium': require('native-base/Fonts/Roboto_medium.ttf'),
...Ionicons.font,
});
}
Run Code Online (Sandbox Code Playgroud)
但它没有用。这是我的代码:
import React, { Component } from 'react';
import { View, } from "react-native";
import { Button, Text } from 'native-base';
export default class MyComponent extends Component {
render() {
return (
<View>
<Button>
<Text>Click …Run Code Online (Sandbox Code Playgroud) 我在执行 forceRtl 时遇到了本机基本选项卡的问题。一切正常,但只有 native base 在初始加载时不显示任何内容。
所以我有一个临时解决方案
native-base ×10
react-native ×10
javascript ×2
android ×1
expo ×1
icons ×1
ios ×1
picker ×1
reactjs ×1