Activity View

Often called a share sheet, an activity view presents a range of tasks that people can perform in the current context.

Usage

index.tsx
import { Alert, Button, Share, View } from 'react-native';

function ActivityViewExample() {
  const { colors } = useColorScheme();

  return (
    <View className="items-center">
      <Button
        color={colors.primary}
        onPress={async () => {
          try {
            const result = await Share.share({
              message: 'NativeWindUI | Familiar interface, native feel.',
            });
            if (result.action === Share.sharedAction) {
              if (result.activityType) {
                // shared with activity type of result.activityType
              } else {
                // shared
              }
            } else if (result.action === Share.dismissedAction) {
              // dismissed
            }
          } catch (error: any) {
            Alert.alert(error.message);
          }
        }}
        title="Share a message"
      />
    </View>
  );
}
© Ronin Technologies LLC 2024