我正在为抽屉项目和 headerLeft 设置图标。但是图标没有出现在我的 Android 应用程序中。我正在使用react-native-elements库在我的代码中使用图标。图标类型字体很棒。我已经具体提到了图标的类型。
我已经尝试了所有命令,例如react-native link,并成功链接了所有库,但没有任何效果。
主要组件.js
import React, { Component } from 'react';
import Menu from './MenuComponent';
import { View,Platform } from 'react-native';
import Dishdetail from './DishdetailComponent';
import Home from './HomeComponent';
import { createStackNavigator,createAppContainer} from 'react-navigation';
import {createDrawerNavigator} from 'react-navigation';
import { Icon } from 'react-native-elements'
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
import Contact from './ContactusComponent';
import About from './AboutusComponent';
const MenuNavigator = createStackNavigator({
Menu: {
screen: Menu,
navigationOptions: ({ navigation }) …Run Code Online (Sandbox Code Playgroud) icons react-native react-android react-native-vector-icons react-native-elements
我正在尝试将图标和文本内联,然后将文本左对齐,图标右对齐...
但是,我想使文本向左对齐,图标向右对齐,并且两者都在同一高度...
到目前为止,我的代码:
<Text
style={{
fontSize: 16,
paddingTop: 15,
paddingBottom: 15,
paddingLeft: 10,
paddingRight: 10,
color: "black"
}}
>
Kategorien:
<Icon
style={{
alignItems: "center",
justifyContent: "center",
textAlign: "right"
}}
name="keyboard-arrow-down"
type="MaterialIcons"
/>
</Text>
Run Code Online (Sandbox Code Playgroud)
我也尝试使用react本机元素并利用right和left元素,但是,在这种情况下,图标和文本不是内联的...
<View>
<Left>
Text...
</Left>
<Right>
Icon...
</Right>
</View>
Run Code Online (Sandbox Code Playgroud)
你们有什么主意吗?
javascript styles reactjs react-native react-native-elements
我是React Native的新手。在我的简单测试应用程序中,我想尝试使用react-native-elements 按钮
但是,我无法显示按钮的背景色。
我按照文档进行操作,并尝试添加如下所示的按钮:
import React, { Component } from 'react';
import { Text, View } from 'react-native';
import { Button } from 'react-native-elements';
export default class loginForm extends Component {
render() {
return (
<View>
<Button
backgroundColor={'red'}
title='Login'
/>
</View>
)
}
}
Run Code Online (Sandbox Code Playgroud)
在App.js中,我将其导入为:
import React from 'react';
import { StyleSheet, Text, View, TouchableHighlight, TextInput } from 'react-native';
import { createStackNavigator, createBottomTabNavigator, createAppContainer } from 'react-navigation';
import loginForm from './app/src/components/loginForm.js'
const TestStack = createStackNavigator(
{
Login: {screen: loginForm} …Run Code Online (Sandbox Code Playgroud) 使用以下小吃:https : //snack.expo.io/ry_5rCk84
我正在尝试在我的本机应用程序中使用 Material Icons 显示图标“wifi_off”(只是在博览会上将此作为零食共享以方便共享),但这不是道具“名称”的公认值。并最终显示一个“?” 对于未知图标。我可以使用 ' material-community ' 图标集来使用wifi-off图标
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { Constants } from 'expo';
import {Icon} from 'react-native-elements';
// You can import from local files
import AssetExample from './components/AssetExample';
// or any pure javascript modules available in npm
import { Card } from 'react-native-paper';
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.paragraph}> …Run Code Online (Sandbox Code Playgroud) react-native react-native-vector-icons react-native-elements
我正在使用基于云的存储来存储头像图像。如果用户的图像不存在,我想回退到用户标题。下面的代码适用于 android,但在 IOS 上,图像只是空白,没有标题。
<Avatar rounded source={{ uri: avatarUrl }} title={userName.slice(0, 2)} />
在常规图像上,您可以使用 onError 来处理此问题,但我不知道如何在 Avatar 上使用它。
任何人有任何建议如何解决这个问题?或其他处理得更好的包?
谢谢!
你能帮我解决反应原生元素库上按钮边框半径的问题吗?
我向按钮添加了边框半径,但其不透明度仍然是矩形,我不明白为什么。
https://github.com/react-native-elements/react-native-elements/issues/2324
我正在使用react-native-paper,我想获得一个图标组件,但没有与按钮组件的任何链接。我浏览了文档,但没有找到图标组件。我想要类似于react-native-elements的东西
import { Icon } from 'react-native-elements'
<Icon
name='g-translate'
color='#00aced' />
Run Code Online (Sandbox Code Playgroud)
所以请帮助我实现这一目标。
我正在使用react-native-elements在我的应用程序中添加按钮,但是我无法将按钮内的文本向右对齐。
我尝试了alignText:'right'的titleStyle属性,但没有成功
<Button title={'Hello World'} titleStyle={{ textAlign:'right' }} />
Run Code Online (Sandbox Code Playgroud)
我希望按钮标题向右对齐,但它只停留在中间。
实际上,我正在使用 react-native-element 设计语言。当我过去实现复选框时,它的行为就像我不想要的可触摸不透明度。
<CheckBox
containerStyle={{ backgroundColor: "transparent", borderWidth: 0 }}
center
size={14}
title="vegetarian"
textStyle={{
fontSize: theme.FONT_SIZE_X_SMALL,
fontWeight: theme.FONT_WEIGHT_LIGHT
}}
checkedColor="red"
checked={this.state.checked}
onPress={() => this.setState({ checked: !this.state.checked })}
/>;
Run Code Online (Sandbox Code Playgroud) 如何将react-native-elements按钮的标题分成多行?
import { Button } from 'react-native-elements';
....
// The \n in the following statement does NOT work!
<Button
title="Creating a Shift \n(and inviting employees)"
onPress={ () => {
console.log("Button Pressed");
}}
/>
Run Code Online (Sandbox Code Playgroud) react-native ×10
icons ×2
javascript ×2
avatar ×1
button ×1
ios ×1
mobile ×1
reactjs ×1
styles ×1