Fab 按钮在滚动视图上不起作用。我正在使用 React-native-paper 中的 FAB,并且显示了图标,但是当我按下 fab 按钮时,它不起作用。作为替代方案,我尝试制作一个粘性按钮,当我使用滚动视图时,该按钮会粘在底部,但该按钮显示在滚动视图内容之后,并且没有固定在屏幕底部。它也失败了。
我的代码是这样的:
<View>
<FAB style={{position:'absolute',right:0,bottom:0}}/>
<ScrollView></ScrollView>
</View>
Run Code Online (Sandbox Code Playgroud) floating-action-button react-native-scrollview react-native-paper
如何更改以下按钮的字体大小?将 style 属性与 fontSize 一起使用不起作用。
<Button
style={{fontSize: 32}}
uppercase={false}
mode="contained">
Some text
</Button>
Run Code Online (Sandbox Code Playgroud) 我从 react native 开始,当使用名为 react native paper 的库时,我遇到了一个语句,其中将状态分配给了一个常量,如下所示。
import * as React from 'react';
import { Searchbar } from 'react-native-paper';
export default class MyComponent extends React.Component {
state = {
firstQuery: '',
};
render() {
const { firstQuery } = this.state;
return (
<Searchbar
placeholder="Search"
onChangeText={query => { this.setState({ firstQuery: query }); }}
value={firstQuery}
/>
);
}
}
Run Code Online (Sandbox Code Playgroud)
'Render' 方法的开头,你可以看到 const { firstQuery } = this.state; 有人可以解释为什么将状态分配给名为“firstQuery”的常量,即使它有原因,分配如何将状态对象内的属性“firstQuery”正确映射到 const ?
提前致谢。代码示例来自https://callstack.github.io/react-native-paper/searchbar.html#value
我正在尝试访问主题的原色。我在执行此操作时遇到问题,因为错误显示“无法读取未定义的属性颜色”
请检查我下面的代码。
import React, { memo } from "react";
import { StyleSheet, Text, withTheme } from "react-native";
const Header = ({ children }) => <Text style={styles.header}>{children}</Text>;
const styles = StyleSheet.create({
header: {
fontSize: 26,
color: withTheme.colors.primary,
},
});
export default memo(Header);
Run Code Online (Sandbox Code Playgroud) 我想将这些滑块切换按钮之一添加到我的反应本机应用程序中。有没有什么简单的方法可以做到这一点而无需从头开始?
我正在使用react-native-paper TextInput 在文本输入的左侧显示电子邮件图标,该图标应该是绿色的(#22C55E),但它仍然显示默认颜色。
<TextInput
placeholder={t('Email')}
style={styles.textInput}
mode="outlined"
outlineColor={Colors.transparent}
activeOutlineColor={Colors.hostessGreen}
theme={{ roundness: 16 }}
left={
<TextInput.Icon
icon={'email-outline'}
color="#22C55E"
style={styles.leftIcon as StyleProp<ViewStyle>}
size={responsiveFontSize(3)}
/>
}
/>
Run Code Online (Sandbox Code Playgroud)