pfcodes Github contribution chart
pfcodes Github Stats
pfcodes Most Used Languages

Activity

05 Oct 2022

Pfcodes

GraphQL alias support

Are aliases supported?

For example:

 query GetTopBarData {
    iosUsers: platformUsers(platform: "ios") {
      users
      percentageFull
    }
    androidUsers: platformUsers(platform: "android") {
      users
      percentageFull
    }
    webUsers: platformUsers(platform: "web") {
      users
      percentageFull
    }
  } 

But the generated types file only includes:

export type Query = {
  platformUsers?: Maybe<PlatformData>
} 

I'd like to access data.androidUsers, but only data.platformUsers is a known type.

I am not making use of .graphql files. Just graphql-tag within a TS file. Not sure if that effects how the types are generated.

Forked On 04 Oct 2022 at 11:06:03

Pfcodes

Any update on this?

Commented On 04 Oct 2022 at 11:06:03

Pfcodes

started

Started On 04 Oct 2022 at 06:30:23

Pfcodes

Amplitude.getInstance() generates warnings new NativeEventEmitter()

Just create new instance:

import { Amplitude } from '@amplitude/react-native';

const instance = Amplitude.getInstance(); 

LogBox and console warnings:

 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.
 WARN  `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method. 

Forked On 04 Oct 2022 at 04:24:52

Pfcodes

This started happening for me too after upgrading to 2.13.0.

Commented On 04 Oct 2022 at 04:24:52
Issue Comment

Pfcodes

«OSError: cannot write mode RGBA as JPEG» when get_thumbnail for PNG in mode=P

What did I do?

Tried to get thumbnail (JPEG without transparency) for PNG image in mode=P (indexed colours?). (It works good for PNG with mode=RGBA but not mode=P)

What did I expect to happen?

Saving thumbnail without any exceptions, flattened alpha-channel into solid background of some colour (eg THUMBNAIL_PADDING_COLOR, some specific colour from settings or 'white').

Test image

5847e9aacef1014c0b5e4828 https://user-images.githubusercontent.com/244666/45594613-a5aba780-b9a6-11e8-9321-da6710f9fb4f.png

What actually happened?

>>> i = Image.open('forbes.png')
>>> i
<PIL.PngImagePlugin.PngImageFile image mode=P size=400x400 at 0x7FE650252CC0>

>>> get_thumbnail(i, '100x106', crop='center', quality=99, format='PNG')
<sorl.thumbnail.images.ImageFile at 0x7fe6501d6390>

>>> get_thumbnail(i, '100x100', crop='center', quality=99, format='JPEG')
OSError: cannot write mode RGBA as JPEG 

Versions

Python == 3.6.5 Pillow == 5.2.0 (or any versions >= 4.2.0) sorl-thumbnail == 12.4.1

Related issue

https://github.com/python-pillow/Pillow/issues/2609

How to fix it?

You need to make a background image with certain colour and merge source image into background:

 def _colorspace(self, image, colorspace, format):
        if colorspace == 'RGB':
            # Pillow JPEG doesn't allow RGBA anymore. It was converted to RGB before.
            if image.mode == 'RGBA' and format != 'JPEG':
                return image  # RGBA is just RGB + Alpha
            if image.mode == 'LA' or (image.mode == 'P' and 'transparency' in image.info):
                if format == 'JPEG':
                    newimage = Image.new('RGB', image.size, '#eebbaa')
                    mask = image.convert('RGBA').split()[-1]
                    newimage.paste(image.convert('RGBA'), (0, 0), mask)
                else:
                    newimage = image.convert('RGBA')
                    transparency = image.info.get('transparency')
                    if transparency is not None:
                        mask = image.convert('RGBA').split()[-1]
                        newimage.putalpha(mask)
                return newimage
            return image.convert('RGB')
        if colorspace == 'GRAY':
            return image.convert('L')
        return image 

Correct result

cor

Forked On 04 Oct 2022 at 12:51:55

Pfcodes

Bump

Commented On 04 Oct 2022 at 12:51:55

Pfcodes

Update README.md

Created On 03 Oct 2022 at 11:11:54

Pfcodes

Update README.md

Update example to initialize settingsStorage variable with MMKVLoader in place of the deprecated MMKVStorage.Loader()

Pushed On 03 Oct 2022 at 11:11:43

Pfcodes

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI

Forked On 03 Oct 2022 at 11:09:45
Issue Comment

Pfcodes

Serious performance issues in 12.2 (AWS S3)

Hello,

There is a serious performance issue in current 12.2 branch. Problem is that we have ~2M thumbnails, so if execution goes here (marked line):

# /sorl/thumbnail/base.py:101 (get_thumbnail)
        # We have to check exists() because the Storage backend does not
        # overwrite in some implementations.
        if not thumbnail.exists(): # <---- This is the root of the problem!
            try:
                source_image = default.engine.get_image(source)
            except IOError:
                if settings.THUMBNAIL_DUMMY:
                    return DummyImageFile(geometry_string)
                else:
                    # if S3Storage says file doesn't exist remotely, don't try to
                    # create it and exit early.
                    # Will return working empty image type; 404'd image
                    logger.warn(text_type('Remote file [%s] at [%s] does not exist'),
                                file_, geometry_string)

                    return thumbnail

            # We might as well set the size since we have the image in memory
            image_info = default.engine.get_image_info(source_image)
            options['image_info'] = image_info
            size = default.engine.get_image_size(source_image)
            source.set_size(size)

            try:
                self._create_thumbnail(source_image, geometry_string, options,
                                       thumbnail)
                self._create_alternative_resolutions(source_image, geometry_string,
                                                     options, thumbnail.name)
            finally:
                default.engine.cleanup(source_image) 

it is actually asks boto to return LIST of all stored thumbnails (without even using prefix), so appliction hangs with 100% CPU and high memory usage (well, not a surprise actually).

Wouldn't it be better to provide a prefix for lookup (constructed with the same function as used to store thumbnail) ?

In a mean time we've had to revert to 11.12.1b which works better.

This is related to a fix introduced in #92

Forked On 03 Oct 2022 at 02:22:14

Pfcodes

I see that THUMBNAIL_FORCE_OVERWRITE is supposed to be the solution to this. But what is the negative and/or side-effect of setting this variable to true?

Commented On 03 Oct 2022 at 02:22:14

Pfcodes

started

Started On 02 Oct 2022 at 10:51:07

Pfcodes

started

Started On 02 Oct 2022 at 08:55:55

Pfcodes

An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.

Forked On 01 Oct 2022 at 08:17:44

Pfcodes

[Docs] Add graphql-anywhere to peerDependency list

Created On 30 Sep 2022 at 07:11:21
Issue Comment

Pfcodes

[Docs] Add graphql-anywhere to peerDependency list

Added graphql-anywhere to peerDependency list.

An error occurs if this library isn't installed.

Forked On 30 Sep 2022 at 07:11:20

Pfcodes

Hi @pfcodes, thanks for submitting this PR! Can you help us understand the difference between this branch and #10138 ?

This is a duplicate. Sorry.

Commented On 30 Sep 2022 at 07:11:20

Pfcodes

Update README.md

Pushed On 29 Sep 2022 at 12:37:08

Pfcodes

Update apollo-link-rest.md - Add graphql-anywhere to install list

Created On 28 Sep 2022 at 07:14:53

Pfcodes

Update apollo-link-rest.md

Pushed On 28 Sep 2022 at 07:12:55

Pfcodes

[Docs] Add graphql-anywhere to peerDependency list

Created On 28 Sep 2022 at 07:11:34

Pfcodes

Update apollo-link-rest.md

Add graphql-anywhere to peerDependency list

Pushed On 28 Sep 2022 at 07:10:27

Pfcodes

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.

Forked On 28 Sep 2022 at 07:04:40

Pfcodes

Update computed_fields.md

Created On 26 Sep 2022 at 10:35:14

Pfcodes

Update computed_fields.md

fix spelling

Pushed On 26 Sep 2022 at 10:34:26

Pfcodes

GraphQL support for PostgreSQL

Forked On 26 Sep 2022 at 10:34:00

Pfcodes

started

Started On 26 Sep 2022 at 05:47:32

Pfcodes

BottomSheetBackdrop component doesn't show up at all when setting the `appearsOnIndex` prop

Bug

The BottomSheetBackdrop component wont show up when setting the appearsOnIndex={0} for example. As I understand the prop is to tell the backdrop to show up when the snap point in on the index provided. If thats not the case then can someone provide a way of doing that. In my case the backdrop doesn't show when the index is at 0 only when dragging the component up to the other snap points does it show, however like mentioned above, if I set the property of the backdrop appearsOnIndex={0} it doesn't show at all.

Environment info

| Library | Version | | ------------------------------- | ------- | | @gorhom/bottom-sheet | 4.0.0-alpha.19 | | react-native | ^0.64.1 | | react-native-reanimated | ^2.1.0 | | react-native-gesture-handler | ^1.10.3 |

Steps To Reproduce

  1. Set the BottomSheetBackdrop prop appearsOnIndex={0}
  2. Open the bottom sheet modal and the backdrop doesn't show

Describe what you expected to happen:

  1. Set the BottomSheetBackdrop prop appearsOnIndex={0}
  2. Backdrop should show up as soon as the modal opens to the first snap point

Reproducible sample code

Forked On 24 Sep 2022 at 07:20:16

Pfcodes

@ramirezabel you need to provide disappearsOnIndex with -1 , the default value is 0

https://github.com/gorhom/react-native-bottom-sheet/blob/73decd3f13f17f585796556fc2bd43f408be8603/src/components/bottomSheetBackdrop/types.d.ts#L24-L29

Feel like this should be the default behavior. Thanks though

Commented On 24 Sep 2022 at 07:20:16

Pfcodes

[v4] | [v2] [iOS] Modal does not close when navigating away and keyboardBlurBehavior is "restore"

Bug

Right now we have a Modal that appears and allows the user to enter text in a BottomSheetTextInput there is a Submit button that pushes a new Native Stack Screen presentation: modal.

When navigating away from a Bottom Sheet Modal to the new screen, we make use of the useIsFocused effect from React Navigation as recommended in this issue on this library.

The problem we encountered is that this fixed worked on Simulator for us however once we went to real devices it didn't work and the modal did not close. After digging further, I realized that it was because the keyboard on the simulator wasn't active, once enabling this I could reproduce the bug.

It wasn't until I changed keyboardBlurBehavior from "restore" to "none" on the bottom sheet modal that this problem went away. I could very well be misunderstanding the expected functionality of "restore" but to me it felt weird that the modal's visibility could be overridden by the keyboard.

Environment info

| Library | Version | | ------------------------------- | ------- | | @gorhom/bottom-sheet | 4.1.5 | | react-native | 0.66.3 | | react-native-reanimated | 2.4.1 and 2.3.0+ | | react-native-gesture-handler | 1.10.3 |

Steps To Reproduce

  1. Render a Bottom Sheet Modal with a BottomSheetTextInput and a Button
  2. With the keyboard enabled, type in the TextInput
  3. Tap the button which closes the modal and navigates to a new screen
  4. Go back from the modal via gesture/button press
  5. Modal reappears focused on text input

Reproducible sample code

https://snack.expo.dev/@michaelcavallaro03/bottom-sheet-v4-reproducible-issue-template

Forked On 22 Sep 2022 at 12:42:51

Pfcodes

Ended up just setting a timeout to close the modal 20ms the keyboard was marked for dismissal. Not ideal due to race conditions but it's a hack that works for now.

Commented On 22 Sep 2022 at 12:42:51

Pfcodes

[v4] | [v2] [iOS] Modal does not close when navigating away and keyboardBlurBehavior is "restore"

Bug

Right now we have a Modal that appears and allows the user to enter text in a BottomSheetTextInput there is a Submit button that pushes a new Native Stack Screen presentation: modal.

When navigating away from a Bottom Sheet Modal to the new screen, we make use of the useIsFocused effect from React Navigation as recommended in this issue on this library.

The problem we encountered is that this fixed worked on Simulator for us however once we went to real devices it didn't work and the modal did not close. After digging further, I realized that it was because the keyboard on the simulator wasn't active, once enabling this I could reproduce the bug.

It wasn't until I changed keyboardBlurBehavior from "restore" to "none" on the bottom sheet modal that this problem went away. I could very well be misunderstanding the expected functionality of "restore" but to me it felt weird that the modal's visibility could be overridden by the keyboard.

Environment info

| Library | Version | | ------------------------------- | ------- | | @gorhom/bottom-sheet | 4.1.5 | | react-native | 0.66.3 | | react-native-reanimated | 2.4.1 and 2.3.0+ | | react-native-gesture-handler | 1.10.3 |

Steps To Reproduce

  1. Render a Bottom Sheet Modal with a BottomSheetTextInput and a Button
  2. With the keyboard enabled, type in the TextInput
  3. Tap the button which closes the modal and navigates to a new screen
  4. Go back from the modal via gesture/button press
  5. Modal reappears focused on text input

Reproducible sample code

https://snack.expo.dev/@michaelcavallaro03/bottom-sheet-v4-reproducible-issue-template

Forked On 22 Sep 2022 at 12:36:54

Pfcodes

Bump, any idea how to fix this?

Commented On 22 Sep 2022 at 12:36:54

Pfcodes

Closing Bottom Sheet when Keyboard is Shown

Bug

Hello, I got this weird behavior whenever I tried to close the bottom sheet on Android while my keyboard is shown. I did try using the latest version (v 4.0.8 alpha), and it's still there. However it works fine in ios.

This project is on Expo (v 41.0.0)

android

  • Closing the bottom sheet doesn't seems to close it completely, you can see it still being displayed behind the keyboard. This existing bottom sheet however doesn't seem to close even thought I called close method by pressing Close button.
  • I close the keyboard manually on onChange callback, when the index is smaller or equal to 0. However when clicking on the backdrop, the keyboard isn't dismissed.
  • Also tried to expand the bottom sheet to fullScreen when keyboard is displayed, but the bottom sheet size keeps changing.

Environment info

| Library | Version | | ------------------------------- | ------- | | @gorhom/bottom-sheet | 3.6.5 | | react-native | 0.3.6 | | react-native-reanimated | 2.1.0 | | react-native-gesture-handler | 1.10.2 |

Steps To Reproduce

  1. Run the snack in Android
  2. Press 'Open'
  3. Focus on the text input 'email', located under the close text on the bottom sheet
  • Here you can see the bottom sheet doesn't expand to fullscreen.
  1. Press 'Close', located inside the bottom sheet
  • You can see the bottom sheet still exists shortly after the keyboard is dismissed.
  1. Repeat step 2 and 3
  2. Press the backdrop (anywhere outside the bottom sheet)
  • The keyboard is not dismissed
  1. Press back to close the keyboard
  2. Try pressing the backdrop or 'Close' to close the bottom sheet

Describe what you expected to happen:

ios

  1. Focusing on the text input will expand the bottom sheet to fullscreen.
  2. Calling bottomsheet.close() or pressing on the backdrop will close the bottom sheet completely.

Reproducible sample code

See it here https://snack.expo.io/@carissa_cks/bottom-sheet

Related issue: #453

And thank you for this awesome package!!

Forked On 22 Sep 2022 at 12:25:32

Pfcodes

Having this problem on iOS, anybody know how to fix it there?

Commented On 22 Sep 2022 at 12:25:32

Pfcodes

started

Started On 02 Sep 2022 at 04:10:09