React native 当我按下“接受”或“拒绝”时,我想从平面列表中获得个人访问权限
需要帮助,如果我按下“接受”按钮,然后同时所有请求都被接受,但我应该被单独接受。。。。 我已经给出了我的输出的两个屏幕截图。 ................................................................................ …>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>React native 当我按下“接受”或“拒绝”时,我想从平面列表中获得个人访问权限,react-native,react-native-android,React Native,React Native Android,需要帮助,如果我按下“接受”按钮,然后同时所有请求都被接受,但我应该被单独接受。。。。 我已经给出了我的输出的两个屏幕截图。 ................................................................................ …>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 导入“反应本机手势处理程序”; 从“React”导入React,{useState}; //从“react
导入“反应本机手势处理程序”;
从“React”导入React,{useState};
//从“react native”导入{样式表、链接、文本、视图、图像、文本输入、警报、TouchableOpacity、ScrollView、ImageBackground、FlatList、SafeAreaView、状态栏};
从“react native”导入{状态栏、平面列表、图像、动画、文本、视图、尺寸、样式表、TouchableOpacity、Easing、SafeAreaViewBase、SafeAreaView、按钮};
进口{
阿凡达
}来自“react native paper”;
从“冒牌货”进口冒牌货;
从“react National material cards”导入{Card,CardTitle,CardContent,CardAction,CardButton,CardImage}
导入“./global”;
导出函数通知屏幕({navigation}){
伪造种子(10);
常量数据=[…数组(30).keys()].map((\ux,i)=>{
返回{
关键字:faker.random.uuid(),
图片:`https://randomuser.me/api/portraits/${faker.helpers.randomize(['women','men'])}/${faker.random.number(60)}.jpg`,
名称:faker.name.findName(),
fname:faker.name.firstName(),
陷阱:faker.name.lastName(),
//jobTitle:faker.name.jobTitle(),
//电子邮件:faker.internet.email(),
};
});
常数间距=20;
const AVATAR_SIZE=55;
const[acpt,accept]=useState(false)
常量[rjct,拒绝]=useState(false)
const stat=({acpt,rjct,item})=>{
让内容
如果(acpt){
内容=错误
}否则如果(rjct){
内容=加载。。。
}否则{
内容=(
{title}
)
}
返回{content}
}
返回(
item.key}
内容容器样式={{
填充:8,
}}
renderItem={({item,index})=>{
返回
{[rjct?您已经拒绝了{item.fname}的{“\n”}连接请求。如果您改变了{\n}您的想法,请通过他们的配置文件向他们发送一个连接{\n}请求。
:[acpt?{item.fname}现在是您的连接。{“\n”}立即单击以与他们聊天!:{item.name}已向您发送了一个{“\n”}连接请求。]
]}
{[acpt?查找更多类似{item.fname}:[rjct?null:Accept]}的连接
{[rjct | | acpt?”:“拒绝”}
}}
/>
)
}
const styles=StyleSheet.create({
平面列表:{
填充:25,
marginBottom:7,
背景色:“rgba(0,0,0,0.1)”,
边界半径:10,
阴影颜色:“0px 4px 10px 0px rgba(0,0,0,0.25)”,
阴影偏移:{
宽度:0,
身高:10
},
阴影不透明度:.3,
阴影半径:20,
},
按钮:{
边界半径:20,
//背景色:“ffad2f”,
宽度:105,
身高:32,
阴影颜色:“0px 4px 10px 0px rgba(0,0,0,0.2)”,
阴影偏移:{
宽度:0,
身高:3,
},
阴影不透明度:0.32,
阴影半径:5.46,
立面图:9,
//边缘左侧:55
玛金托普:15
},
无:{
},
按钮文字:{
重量:“900”,
尺码:18,
颜色:“FFFFFF”,
宽度:“自动”,/*50px*/
高度:“自动”,/*19px*/
溢出:“可见”,
fontFamily:“约瑟芬森的常规”,
为内容辩护:“中心”,
对齐项目:“居中”,
textAlign:'中心',
玛金托普:1
},
按钮颜色接受:{
背景色:“ffad2f”,
marginLeft:70,
边界半径:20,
//背景色:“ffad2f”,
宽度:105,
身高:32,
阴影颜色:“0px 4px 10px 0px rgba(0,0,0,0.2)”,
阴影偏移:{
宽度:0,
身高:3,
},
阴影不透明度:0.32,
阴影半径:5.46,
立面图:9,
//边缘左侧:55
玛金托普:15
},
按钮图标线:
{
背景色:“e71d36”,
marginLeft:15,
边界半径:20,
//背景色:“ffad2f”,
宽度:105,
身高:32,
阴影颜色:“0px 4px 10px 0px rgba(0,0,0,0.2)”,
阴影偏移:{
宽度:0,
身高:3,
},
阴影不透明度:0.32,
阴影半径:5.46,
立面图:9,
//边缘左侧:55
玛金托普:15
},
大按钮:{
宽度:300,
身高:30,
背景色:“ffad2f”,
边界半径:25,
marginLeft:50,
阴影颜色:“0px 4px 10px 0px rgba(0,0,0,0.2)”,
阴影偏移:{
宽度:0,
身高:3,
},
阴影不透明度:0.32,
阴影半径:5.46,
marginLeft:19,
立面图:9,
玛金托普:15,
textAlign:'中心',
//为内容辩护:“中心”
},
信息:
{
fontWeight:'900',
fontFamily:'JosefinSans-Regular',
尺寸:16,
边缘左:-5,
宽度:300,
import 'react-native-gesture-handler';
import React, { useState } from 'react';
// import { StyleSheet, Linking, Text, View, Image, TextInput, Alert, TouchableOpacity, ScrollView, ImageBackground, FlatList, SafeAreaView, StatusBar} from 'react-native';
import { StatusBar, FlatList, Image, Animated, Text, View, Dimensions, StyleSheet, TouchableOpacity, Easing, SafeAreaViewBase, SafeAreaView ,Button} from 'react-native';
import {
Avatar
} from 'react-native-paper';
import faker from 'faker';
import { Card, CardTitle, CardContent, CardAction, CardButton, CardImage } from 'react-native-material-cards'
import './global';
export function notificationscreen({ navigation }) {
faker.seed(10);
const DATA = [...Array(30).keys()].map((_, i) => {
return {
key: faker.random.uuid(),
image: `https://randomuser.me/api/portraits/${faker.helpers.randomize(['women', 'men'])}/${faker.random.number(60)}.jpg`,
name:faker.name.findName(),
fname: faker.name.firstName(),
sname: faker.name.lastName(),
// jobTitle: faker.name.jobTitle(),
// email: faker.internet.email(),
};
});
const SPACING = 20;
const AVATAR_SIZE = 55;
const [acpt, accept] = useState(false)
const [rjct, reject] = useState(false)
const stat = ({ acpt, rjct,item }) => {
let content
if (acpt) {
content = <Text style={{ fontSize: 24, color: 'red' }}>Error</Text>
} else if (rjct) {
content = <Text style={{ fontSize: 24, color: 'gray' }}>Loading...</Text>
} else {
content = (
<View>
<Text style={{ fontSize: 60 }}>{title}</Text>
</View>
)
}
return <View style={{ padding: 24 }}>{content}</View>
}
return (
<View style={{flex: 1, backgroundColor: '#fff'}}>
<FlatList
data={DATA}
keyExtractor= {item=> item.key}
contentContainerStyle={{
padding: 8,
}}
renderItem = {({item, index}) =>{
return <View style={[styles.FlatList,acpt||rjct ? styles.whiteFlatlist:''
]}>
<View style={{flexDirection: 'row'}}>
<Image
source={{uri: item.image}}
style={{width: AVATAR_SIZE, height: AVATAR_SIZE, borderRadius: AVATAR_SIZE, marginRight:SPACING/2}}
/>
<View>
{[rjct ? <Text style={styles.declinemessage}> You have declined {item.fname}'s {"\n"} connection request. If you changed {"\n"} your mind, send them a connection {"\n"}request through their profile.
</Text>:[acpt? <Text style={styles.message}>{item.fname} is now your connection.{"\n"}Click to chat with them right now!</Text>: <Text style={styles.message}>{item.name} has sent you a {"\n"}connection request.</Text>]
]}</View>
</View>
<View style={{flexDirection:'row'}}>
<TouchableOpacity
style={[rjct ? styles.none :[acpt ? styles.bigButton : styles.buttonColorAccept]]}
onPress={accept}>
<View>
{[acpt ? <Text style={styles.buttonText}> Find more connections like {item.fname}</Text>: [rjct? null:<Text style={styles.buttonText}>Accept</Text>]]}
</View>
</TouchableOpacity>
<TouchableOpacity
style={[rjct||acpt ? styles.none :styles.buttonColorDecline ]}
onPress={reject}
>
<Text style={styles.buttonText}>{[rjct||acpt ? "" :"Decline" ] }</Text>
</TouchableOpacity>
</View>
</View>
}}
/>
</View>
)
}
const styles = StyleSheet.create({
FlatList:{
padding: 25,
marginBottom: 7,
backgroundColor:"rgba(0, 0, 0, 0.1)",
borderRadius: 10,
shadowColor:"0px 4px 10px 0px rgba(0, 0, 0, 0.25)",
shadowOffset:{
width: 0,
height: 10
},
shadowOpacity: .3,
shadowRadius: 20,
},
button:{
borderRadius: 20,
// backgroundColor: "#ffad2f",
width: 105,
height: 32,
shadowColor: "0px 4px 10px 0px rgba(0, 0, 0, 0.2)",
shadowOffset: {
width: 0,
height: 3,
},
shadowOpacity: 0.32,
shadowRadius: 5.46,
elevation: 9,
// marginLeft:55
marginTop:15
},
none:{
},
buttonText:{
fontWeight: "900",
fontSize: 18,
color: "#FFFFFF",
width: "auto", /* 50px */
height: "auto", /* 19px */
overflow: "visible",
fontFamily: "JosefinSans-Regular",
justifyContent: 'center',
alignItems: 'center',
textAlign: 'center',
marginTop:1
},
buttonColorAccept:{
backgroundColor:"#ffad2f",
marginLeft: 70,
borderRadius: 20,
// backgroundColor: "#ffad2f",
width: 105,
height: 32,
shadowColor: "0px 4px 10px 0px rgba(0, 0, 0, 0.2)",
shadowOffset: {
width: 0,
height: 3,
},
shadowOpacity: 0.32,
shadowRadius: 5.46,
elevation: 9,
// marginLeft:55
marginTop:15
},
buttonColorDecline:
{
backgroundColor: "#e71d36",
marginLeft: 15,
borderRadius: 20,
// backgroundColor: "#ffad2f",
width: 105,
height: 32,
shadowColor: "0px 4px 10px 0px rgba(0, 0, 0, 0.2)",
shadowOffset: {
width: 0,
height: 3,
},
shadowOpacity: 0.32,
shadowRadius: 5.46,
elevation: 9,
// marginLeft:55
marginTop:15
},
bigButton:{
width:300,
height:30,
backgroundColor:"#ffad2f",
borderRadius:25,
marginLeft:50,
shadowColor: "0px 4px 10px 0px rgba(0, 0, 0, 0.2)",
shadowOffset: {
width: 0,
height: 3,
},
shadowOpacity: 0.32,
shadowRadius: 5.46,
marginLeft:19,
elevation: 9,
marginTop: 15,
textAlign: 'center',
// justifyContent: 'center'
},
message:
{
fontWeight: '900',
fontFamily:'JosefinSans-Regular',
fontSize: 16,
marginLeft: -5,
width: 300,
marginLeft:10,
marginTop: 7,
lineHeight:21.5,
// lineHeight:25,
textAlign:"left",
fontStyle:"normal",
},
declinemessage:{
fontWeight: '900',
fontFamily:'JosefinSans-Regular',
fontSize: 15,
fontWeight:"900",
marginLeft: 5,
marginTop: 7,
lineHeight:20,
textAlign:"left",
fontStyle:"normal",
letterSpacing: .05
},
whiteFlatlist:{
backgroundColor:"#ffffff",
padding: 25,
marginBottom: 7,
borderRadius: 10,
shadowColor:"0px 4px 10px 0px rgba(0, 0, 0, 0.25)",
shadowOffset:{
width: 0,
height: 10
},
shadowOpacity: .3,
shadowRadius: 20,
elevation:9
}
});