Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🦄 Improve Preview #212

Merged
merged 4 commits into from
Dec 25, 2024
Merged

🦄 Improve Preview #212

merged 4 commits into from
Dec 25, 2024

Conversation

baronha
Copy link
Member

@baronha baronha commented Dec 25, 2024

Preview

✨ feat: enhance openPreview method with long press callback

  • Added an onLongPress parameter to the openPreview method in HybridMultipleImagePicker.
  • Updated the implementation to handle long press events on media items.
  • Improved functionality for better user interaction during media preview.

Example:

https://github.com/baronha/react-native-multiple-image-picker/blob/d00ae15dcc287f9a85410eafe7fba2050d3109c3/example/src/index.tsx#L80C3-L117C4

  const onPressImage = (_: PickerResult, index: number) => {
    openPreview(images, index, {
      onLongPress: () => {
        if (Platform.OS === 'ios') {
          ActionSheetIOS.showActionSheetWithOptions(
            {
              options: ['Download', 'Cancel'],
              cancelButtonIndex: 1,
              userInterfaceStyle: colorScheme ?? 'light',
            },
            (buttonIndex) => {
              if (buttonIndex === 0) {
                // Download
              } else if (buttonIndex === 1) {
                // Cancel
              }
            }
          )
        } else {
          Alert.alert('Options', '', [
            {
              text: 'Cancel',
              style: 'cancel',
              onPress: () => {
                console.log('Cancel')
              },
            },
            {
              text: 'Download',
              onPress: () => {
                console.log('Download')
              },
            },
          ])
        }
      },
    })
  }

- Updated openPreview method in MultipleImagePicker and MultipleImagePickerImp to include an onLongPress callback.
- Modified related documentation to reflect the new parameter.
- Enhanced functionality to handle long press events on media items.
- Updated TypeScript definitions and example usage to demonstrate the new feature.
- Added an onLongPress parameter to the openPreview method in HybridMultipleImagePicker.
- Updated the implementation to handle long press events on media items.
- Improved functionality for better user interaction during media preview.
@baronha baronha merged commit 737ad21 into main Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant