Skip to content

Is this project still maintained? #49

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

Closed
kscc25 opened this issue Jan 1, 2020 · 6 comments
Closed

Is this project still maintained? #49

kscc25 opened this issue Jan 1, 2020 · 6 comments

Comments

@kscc25
Copy link

kscc25 commented Jan 1, 2020

Excuse me for the words but I just looked around the hooks and saw so many bad practices in your project (mostly about performance) so I wonder whether you still maintain this project or not.

For example, this hook does resubscribe event every time the component renders. There is a fix here but for maybe some reasons it is merged yet: #38

src/useAppState.ts

import React, { useEffect, useState } from 'react'
import { AppState, AppStateStatus } from 'react-native'

export default function useAppState() {
  const currentState = AppState.currentState
  const [appState, setAppState] = useState(currentState)

  function onChange(newState: AppStateStatus) {
    setAppState(newState)
  }

  useEffect(() => {
    AppState.addEventListener('change', onChange)

    return () => {
      AppState.removeEventListener('change', onChange)
    }
  })

  return appState
}

This hook creates new getPhotos and saveToCameraRoll functions every time the hook is called. It would cause the hook consumer component to rerender unexpectedly.

src/useCameraRoll.ts

export default function useCameraRoll() {
  const [photos, setPhotos] = useState(initialState)

  async function getPhotos(config = defaultConfig) {
    try {
      const photos = await CameraRoll.getPhotos(config)
      setPhotos(photos)
    } catch (err) {
      console.log('error: ', err)
    }
  }

  async function saveToCameraRoll(tag: string, type?: 'photo' | 'video') {
    try {
      await CameraRoll.saveToCameraRoll(tag, type)
    } catch (err) {
      console.log('error saving to camera roll: ', err)
    }
  }

  return [photos, getPhotos, saveToCameraRoll]
}
@LinusU
Copy link
Member

LinusU commented Feb 5, 2020

@pvinis It seems like version 1.0.0 isn't published to npm, and there are also more commits since 1.0.0 that would be great if we could get released!

There is also a lot of open issues that seems like we could close after cutting a new release, and still a few pull requests that could either be closed, or updated and merged.

If you want someone to help maintain this library I would be happy to step up! As it stands right now we are a bit hesitant to depend on this library 😅

Thanks!

@pvinis
Copy link
Member

pvinis commented Feb 5, 2020

Right, I'm with you! I don't actually have permission to publish. Let's ping @kelset about how to handle this.

@kelset
Copy link
Member

kelset commented Feb 5, 2020

Hey folks 👋 sorry, I've forgot to update here. I've raised this in the Discord and AFAIK we are reaching out to the original developer to get some auths. This should unlock this lib and we'll get a couple maintainers (if I understood the conversation 😅)

@pvinis
Copy link
Member

pvinis commented Feb 12, 2020

Ongoing :)

@marcesengel
Copy link

+1

@pvinis
Copy link
Member

pvinis commented Feb 15, 2020

It's out people! https://www.npmjs.com/package/@react-native-community/hooks

Install with yarn add @react-native-community/hooks!

@pvinis pvinis closed this as completed Feb 15, 2020
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

No branches or pull requests

5 participants