我是反应原生的新手。我正在学习它,但我遇到了一个问题expo document picker。我使用文档选择器,但它不显示任何内容,或者有时会给出承诺拒绝错误。今天我被困在这个问题上很久了。
上传.js
import React, { useState } from "react";
import {
StyleSheet,
Text,
View,
TextInput,
Button,
TouchableOpacity,
} from "react-native";
import * as DocumentPicker from "expo";
const UploadFile = () => {
pickDocument = async () => {
let result = await DocumentPicker.getDocumentAsync({});
console.log(result.uri);
console.log(result);
};
return (
<View style={styles.background}>
<Text style={styles.file}>Upload CSV File</Text>
<View style={styles.button}>
<TouchableOpacity>
<Button
title="upload your file"
color="black"
onPress={pickDocument}
/>
</TouchableOpacity>
</View>
</View>
);
};
const styles = StyleSheet.create({
background: {
backgroundColor: …Run Code Online (Sandbox Code Playgroud) 嘿,我是反应原生的新手。我陷入了平面列表和滚动视图中。这是我的代码的结构:
<View>
<ScollView>
<View>
<SafeAreaView>
<FlatList/> -- Horizontal Scroll --
</SafeAreaView>
</View>
<View>
</View>
<View>
<FlatList/> -- Horizontal Scroll --
</View>
<View>
<FlatList/> -- Horizontal Scroll -- //Issue
</View>
</ScollView>
</View>
Run Code Online (Sandbox Code Playgroud)
所以上面提到的问题平面列表就像//Issue。问题是,当我添加需要以垂直格式滚动的平面列表时,它不会滚动,并且该平面列表还显示在屏幕中间,因此要开始工作,我添加了高度并开始工作,但功能我想要的是当我滚动时屏幕应该向下移动。因此,我按照上面的结构添加了scrollView,但是当我添加scrollView时,我删除了它的高度,它开始完美工作,但显示该错误:
VirtualizedList 永远不应该嵌套在具有相同方向的普通 ScrollView 中,因为它可能会破坏窗口和其他功能 - 请改用另一个 VirtualizedList 支持的容器。
所以为了解决这个问题我尝试:
但我无法解决。如果有人有一些想法,请分享。我会很感激你的青睐
嘿!我是 React Native 开发和使用 expo-cli 的新手。我在我的应用程序中添加了一个react-native-paper数据表,它工作正常,但我有很多字段,我想在水平方向滚动屏幕,但我不明白该由谁来做。请向我建议我可以为这个问题做些什么。
import React from 'react';
import { StyleSheet, Text, View, ScrollView, TextInput, Button, } from 'react-native';
import { Card } from "react-native-shadow-cards";
import {DataTable} from "react-native-paper"
const AllUsers = () =>{
return(
<View>
<View style={styles.headSection}>
<Text style={styles.titleHeading}>All Users</Text>
</View>
<ScrollView horizontal>
<DataTable style={styles.table} >
<DataTable.Header>
<DataTable.Title style={styles.header} > <Text style={styles.tableHeading}>Id</Text></DataTable.Title>
<DataTable.Title style={styles.header} > <Text style={styles.tableHeading} >Username</Text></DataTable.Title>
<DataTable.Title style={styles.header} > <Text style={styles.tableHeading} >First Name</Text></DataTable.Title>
<DataTable.Title style={styles.header} > <Text style={styles.tableHeading} >Last Name</Text></DataTable.Title>
<DataTable.Title style={styles.header} > <Text style={styles.tableHeading} …Run Code Online (Sandbox Code Playgroud) 嘿,当我回到其他选项卡时,第一次遇到重新渲染屏幕的问题时,我正在使用反应本机底部选项卡导航。我尝试在 useEffect() 中使用isFocused但它对我不起作用。
const LandScreen = ({navigation}) => {
return (
<Tab.Navigator
tabBarOptions={{
showLabel: false,
activeTintColor: colors.primary,
inactiveTintColor: colors.textHead,
}}
>
<Tab.Screen
name="Home"
component={HomeScreen}
options={{
tabBarIcon: ({focused, color, size}) => {
const icon = focused ? 'home' : 'home';
return <Icon name={icon} color={color} size={size} />;
},
}}
/>
<Tab.Screen
name="Message"
component={ChatStackScreen}
options={{
tabBarIcon: ({focused, color, size}) => {
const icon = focused ? 'chatbox-ellipses' : 'chatbox-ellipses';
return <Icon name={icon} color={color} size={size} />;
},
}}
/>
<Tab.Screen
name="Requests"
component={RequestStackScreen} …Run Code Online (Sandbox Code Playgroud)