使MyModal组件可自定义按钮文案;修改获取权限提示文案;简单修复修改头像时关闭权限弹窗会导致无法第二次请求权限的bug

This commit is contained in:
yezian 2024-03-25 14:21:16 +08:00
parent 7cd51c23ed
commit 65d6cc9db0
6 changed files with 22 additions and 7 deletions

View File

@ -46,14 +46,14 @@
[ [
"expo-camera", "expo-camera",
{ {
"cameraPermission": "允许铁粉空间使用您的相机" "cameraPermission": "允许铁粉空间使用您的相机,以便拍摄或录制您需要的内容"
} }
], ],
[ [
"expo-media-library", "expo-media-library",
{ {
"photosPermission": "允许铁粉空间访问您的相册", "photosPermission": "允许铁粉空间访问您的相册,以便您选择合适的图片进行上传",
"savePhotosPermission": "允许铁粉空间保存图片到相册", "savePhotosPermission": "允许铁粉空间保存图片到相册,以便您稍后在相册中继续查看",
"isAccessMediaLocationEnabled": true "isAccessMediaLocationEnabled": true
} }
], ],

View File

@ -299,6 +299,7 @@ export default function MediaPickerModal({
setVisible={setRequestModalVisible} setVisible={setRequestModalVisible}
title="权限申请" title="权限申请"
content="该功能需要开启存储权限,用于选择上传媒体文件" content="该功能需要开启存储权限,用于选择上传媒体文件"
confirmText="继续"
cancel={() => { cancel={() => {
setRequestModalVisible(false); setRequestModalVisible(false);
}} }}
@ -312,6 +313,7 @@ export default function MediaPickerModal({
setVisible={setOverlayVisible} setVisible={setOverlayVisible}
title="您还未打开媒体权限" title="您还未打开媒体权限"
content="是否前往设置开启权限?" content="是否前往设置开启权限?"
confirmText="继续"
cancel={() => { cancel={() => {
setOverlayVisible(false); setOverlayVisible(false);
}} }}

View File

@ -8,6 +8,8 @@ export default function MyModal({
title, title,
content, content,
confirm, confirm,
confirmText,
cancelText,
}) { }) {
const tailwind = useTailwind(); const tailwind = useTailwind();
return ( return (
@ -24,7 +26,7 @@ export default function MyModal({
}} }}
> >
<View <View
style={tailwind("p-2 rounded-2xl bg-[#1E1C29] items-center w-3/4")} style={tailwind("p-2 rounded-2xl bg-[#17161A] items-center w-3/4")}
> >
<Text <Text
style={tailwind( style={tailwind(
@ -50,7 +52,7 @@ export default function MyModal({
"text-[#FFFFFF80] text-base font-medium text-center" "text-[#FFFFFF80] text-base font-medium text-center"
)} )}
> >
取消 {cancelText ? cancelText : "取消"}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
@ -62,7 +64,7 @@ export default function MyModal({
<Text <Text
style={tailwind("text-white text-base font-medium text-center")} style={tailwind("text-white text-base font-medium text-center")}
> >
确认 {confirmText ? confirmText : "确认"}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>

View File

@ -135,7 +135,7 @@ export default function SelectUserProfileItem({ navigation, route }) {
<View style={tailwind("flex-row justify-between items-center mt-2")}> <View style={tailwind("flex-row justify-between items-center mt-2")}>
<Text style={tailwind("text-base text-white font-medium")}>头像</Text> <Text style={tailwind("text-base text-white font-medium")}>头像</Text>
<TouchableOpacity <TouchableOpacity
onPress={() => setMediaPickerModalVisible(true)} onPress={() => setMediaPickerModalVisible(!mediaPickerModalVisible)}
style={tailwind("flex-row items-center")} style={tailwind("flex-row items-center")}
> >
<Image <Image

View File

@ -542,6 +542,11 @@
background-color: rgb(19 18 31 / var(--tw-bg-opacity)) background-color: rgb(19 18 31 / var(--tw-bg-opacity))
} }
.bg-\[\#17161A\] {
--tw-bg-opacity: 1;
background-color: rgb(23 22 26 / var(--tw-bg-opacity))
}
.bg-\[\#1E1C29\] { .bg-\[\#1E1C29\] {
--tw-bg-opacity: 1; --tw-bg-opacity: 1;
background-color: rgb(30 28 41 / var(--tw-bg-opacity)) background-color: rgb(30 28 41 / var(--tw-bg-opacity))

View File

@ -724,6 +724,12 @@
"backgroundColor": "rgb(19 18 31 / var(--tw-bg-opacity))" "backgroundColor": "rgb(19 18 31 / var(--tw-bg-opacity))"
} }
}, },
"bg-[#17161A]": {
"style": {
"--tw-bg-opacity": 1,
"backgroundColor": "rgb(23 22 26 / var(--tw-bg-opacity))"
}
},
"bg-[#1E1C29]": { "bg-[#1E1C29]": {
"style": { "style": {
"--tw-bg-opacity": 1, "--tw-bg-opacity": 1,