我正在尝试使用提供的钩子 useActionSheet() 在功能组件中使用https://github.com/expo/react-native-action-sheet。我已经在使用类组件版本没有任何问题,但我想切换到功能。
React 版本是 16.9.0
这是我的组件
connectActionSheet,
useActionSheet,
} from "@expo/react-native-action-sheet";
import React, { Component } from "react";
import { View, Text, SafeAreaView } from "react-native";
import TaButton from "../components/TaButton";
import { typography, styles, buttons } from "../components/Styles";
const UploadUI: React.FC<{
description: string;
label: string;
}> = (props) => {
const { showActionSheetWithOptions } = useActionSheet();
const openActionSheet = () => {
console.log("TEST - Choosing action now");
const options = [
"Scegli dalla libreria",
"Scatta una foto", …Run Code Online (Sandbox Code Playgroud)