我有一个 Expo 应用程序,我正在其中使用 NativeBase 库(https://nativebase.io/)
由于某种原因,应用程序没有针对状态栏进行调整。显示的小部件围绕状态栏区域绘制,而不是通常情况下在状态栏下方开始绘制。
我可以使用 NativeBase 库来调整此 Expo 应用程序中的状态栏高度吗?
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { NativeBaseProvider, Box, Text, VStack, HStack, Checkbox, Divider, Heading, Center, ScrollView, FlatList } from 'native-base';
export default function App() {
var data = [
{
id: "bd7acbea-c1b1-46c2-aed5-3ad53abb28ba",
title: "First Item",
},
{
id: "3ac68afc-c605-48d3-a4f8-fbd91aa97f63",
title: "Second Item",
},
{
id: "58694a0f-3da1-471f-bd96-145571e29d72",
title: "Third Item",
},
]
return (
<NativeBaseProvider> …Run Code Online (Sandbox Code Playgroud) 在Expo React Native应用程序中,执行react-native link后执行时发生以下错误yarn add react-navigation native-base.
添加React Navigation和Native-Base时显示警告
warning “expo > react-native-maps@0.21.0” has incorrect peer dependency “react-native@^0.51 || ^0.52 || ^0.53 || ^0.54”.
warning “expo > react-native-reanimated@1.0.0-alpha.3” has incorrect peer dependency “react@16.0.0-alpha.6”.
warning “expo > react-native-reanimated@1.0.0-alpha.3” has incorrect peer dependency “react-native@^0.44.1”.
warning " > react-native@0.55.4" has incorrect peer dependency “react@16.3.1”.
warning “react-native > eslint-plugin-react-native@3.2.1” has unmet peer dependency “eslint@^3.17.0 || ^4.0.0”.
warning “react-navigation > create-react-context@0.2.2” has unmet peer dependency “prop-types@^15.0.0”.
Run Code Online (Sandbox Code Playgroud)
执行react-native链接时遇到错误
PS C:\Projects\proj> react-native link …Run Code Online (Sandbox Code Playgroud) 也发布在https://github.com/GeekyAnts/NativeBase/issues/1394
尝试使用Native Base将按钮水平居中。
知道以下原因为何不起作用吗?
<Container style={{ backgroundColor: '#fff', paddingTop: 100, alignItems: 'center' }}>
<Content>
<Button style={{ margin: 10 }}>
<Text> Short Text </Text>
</Button>
<Button style={{ margin: 10 }}>
<Text> Very Long Text</Text>
</Button>
<View style={{ marginTop: 50 }}>
</View>
</Content>
</Container>
Run Code Online (Sandbox Code Playgroud)
也尝试过这个,也没有用:
<Container style={{ flex: 1, alignItems: 'center' }}>
<Content padder>
<Card style={{ alignItems: 'center' }}>
<Button style={{ margin: 10 }} danger>
<Text> Go to Welcome Tab </Text>
</Button>
<Button style={{ margin: 10 }} warning>
<Text> Go to …Run Code Online (Sandbox Code Playgroud) 我正在使用 React Native NativeBase,我想将一个数字传递给我的输入值,但我收到一个错误,提示我无法将数字传递给字符串。
<Input
keyboardType="numeric"
onChangeText={(text) => setTarget(text)}
value={target}
/>
Run Code Online (Sandbox Code Playgroud)
现在如果我这样做。
<Input
keyboardType="numeric"
// onChangeText={(text) => setTarget(text)}
value={"target"}
Run Code Online (Sandbox Code Playgroud)
错误消失。这是值的定义
const [target, setTarget] = useState<number>(0);
Run Code Online (Sandbox Code Playgroud)
我从 NB 3.0 复制/粘贴 React Hook Forms 的第一个示例并收到此错误。TypeError: 错误不是 Object。(评估错误中的“firstName”)。知道为什么吗?