Skip to content

Commit 420edf3

Browse files
committed
Deprecate hooks that use old API (fix: react-native-community#267)
1 parent 34548fb commit 420edf3

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

README.md

+6-2
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

+4
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

+4
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)