Skip to content

Commit 2d3b769

Browse files
committed
Deprecate hooks that use old API (fix: #267)
1 parent 34548fb commit 2d3b769

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ yarn add @react-native-community/hooks
2323
- [useAccessibilityInfo](https://github.com/react-native-community/hooks#useaccessibilityinfo)
2424
- [useAppState](https://github.com/react-native-community/hooks#useappstate)
2525
- [useBackHandler](https://github.com/react-native-community/hooks#usebackhandler)
26-
- [useCameraRoll](https://github.com/react-native-community/hooks#usecameraroll)
27-
- [useClipboard](https://github.com/react-native-community/hooks#useclipboard)
26+
- ~~[useCameraRoll](https://github.com/react-native-community/hooks#usecameraroll)~~
27+
- ~~[useClipboard](https://github.com/react-native-community/hooks#useclipboard)~~
2828
- [useDimensions](https://github.com/react-native-community/hooks#usedimensions)
2929
- [useImageDimensions](https://github.com/react-native-community/hooks#useImageDimensions)
3030
- [useKeyboard](https://github.com/react-native-community/hooks#usekeyboard)
@@ -74,6 +74,8 @@ useBackHandler(() => {
7474

7575
### `useCameraRoll`
7676

77+
⚠️ **Deprecated**. Please use `useCameraRoll()` from [`@react-native-camera-roll/camera-roll`](https://github.com/react-native-cameraroll/react-native-cameraroll#usecameraroll)
78+
7779
```js
7880
import { useCameraRoll } from '@react-native-community/hooks'
7981

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

8991
### `useClipboard`
9092

93+
⚠️ **Deprecated**. Please use `useClipboard()` from [`@react-native-clipboard/clipboard`](https://github.com/react-native-clipboard/clipboard#useclipboard)
94+
9195
```js
9296
import { useClipboard } from '@react-native-community/hooks'
9397

src/useCameraRoll.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ const defaultConfig: GetPhotosParamType = {
1515
groupTypes: 'All',
1616
}
1717

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

src/useClipboard.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ function setString(content: string) {
99
listeners.forEach((listener) => listener(content))
1010
}
1111

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

0 commit comments

Comments
 (0)