Skip to content

Commit

Permalink
Deprecate hooks that use old API (fix: react-native-community#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
retyui committed Nov 15, 2022
1 parent 34548fb commit 420edf3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ yarn add @react-native-community/hooks
- [useAccessibilityInfo](https://github.com/react-native-community/hooks#useaccessibilityinfo)
- [useAppState](https://github.com/react-native-community/hooks#useappstate)
- [useBackHandler](https://github.com/react-native-community/hooks#usebackhandler)
- [useCameraRoll](https://github.com/react-native-community/hooks#usecameraroll)
- [useClipboard](https://github.com/react-native-community/hooks#useclipboard)
- ~~[useCameraRoll](https://github.com/react-native-community/hooks#usecameraroll)~~
- ~~[useClipboard](https://github.com/react-native-community/hooks#useclipboard)~~
- [useDimensions](https://github.com/react-native-community/hooks#usedimensions)
- [useImageDimensions](https://github.com/react-native-community/hooks#useImageDimensions)
- [useKeyboard](https://github.com/react-native-community/hooks#usekeyboard)
Expand Down Expand Up @@ -74,6 +74,8 @@ useBackHandler(() => {

### `useCameraRoll`

**Deprecated**. Please use `useCameraRoll()` from [`@react-native-camera-roll/camera-roll`](https://github.com/react-native-cameraroll/react-native-cameraroll#usecameraroll)

```js
import { useCameraRoll } from '@react-native-community/hooks'

Expand All @@ -88,6 +90,8 @@ const [photos, getPhotos, saveToCameraRoll] = useCameraRoll()

### `useClipboard`

**Deprecated**. Please use `useClipboard()` from [`@react-native-clipboard/clipboard`](https://github.com/react-native-clipboard/clipboard#useclipboard)

```js
import { useClipboard } from '@react-native-community/hooks'

Expand Down
4 changes: 4 additions & 0 deletions src/useCameraRoll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const defaultConfig: GetPhotosParamType = {
groupTypes: 'All',
}

/**
* @deprecated Please use "useCameraRoll" from "@react-native-camera-roll/camera-roll" instead
* More: https://github.com/react-native-cameraroll/react-native-cameraroll#usecameraroll
*/
export function useCameraRoll() {
const [photos, setPhotos] = useState(initialState)

Expand Down
4 changes: 4 additions & 0 deletions src/useClipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ function setString(content: string) {
listeners.forEach((listener) => listener(content))
}

/**
* @deprecated Please use "useClipboard" from "@react-native-clipboard/clipboard" instead
* More: https://github.com/react-native-clipboard/clipboard#useclipboard
*/
export function useClipboard(): [string, (content: string) => void] {
const [data, updateClipboardData] = useState('')

Expand Down

0 comments on commit 420edf3

Please sign in to comment.