Skip to content

Commit b19d89b

Browse files
committed
run prettier
1 parent 23ff4ab commit b19d89b

10 files changed

+127
-86
lines changed

src/useAccessibilityInfo.ts

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
11
import React, { useEffect, useState } from 'react'
2-
import { AccessibilityInfo, AccessibilityChangeEvent, AccessibilityEvent } from 'react-native'
3-
2+
import {
3+
AccessibilityInfo,
4+
AccessibilityChangeEvent,
5+
AccessibilityEvent,
6+
} from 'react-native'
47

58
export default function useAccessibilityInfo() {
69
const [reduceMotionEnabled, setReduceMotionEnabled] = useState(false)
710
const [screenReaderEnabled, setScreenReaderEnabled] = useState(false)
811

9-
const handleReduceMotionChanged = (enabled: AccessibilityChangeEvent) => setReduceMotionEnabled(enabled)
10-
const handleScreenReaderChanged = (enabled: AccessibilityChangeEvent) => setScreenReaderEnabled(enabled)
12+
const handleReduceMotionChanged = (enabled: AccessibilityChangeEvent) =>
13+
setReduceMotionEnabled(enabled)
14+
const handleScreenReaderChanged = (enabled: AccessibilityChangeEvent) =>
15+
setScreenReaderEnabled(enabled)
1116

12-
useEffect(() => {
13-
AccessibilityInfo.isReduceMotionEnabled().then(handleReduceMotionChanged)
14-
AccessibilityInfo.isScreenReaderEnabled().then(handleScreenReaderChanged)
17+
useEffect(() => {
18+
AccessibilityInfo.isReduceMotionEnabled().then(handleReduceMotionChanged)
19+
AccessibilityInfo.isScreenReaderEnabled().then(handleScreenReaderChanged)
1520

16-
AccessibilityInfo.addEventListener('reduceMotionChanged', handleReduceMotionChanged as (event: AccessibilityEvent) => void)
17-
AccessibilityInfo.addEventListener('screenReaderChanged', handleScreenReaderChanged as (event: AccessibilityEvent) => void)
21+
AccessibilityInfo.addEventListener(
22+
'reduceMotionChanged',
23+
handleReduceMotionChanged as (event: AccessibilityEvent) => void,
24+
)
25+
AccessibilityInfo.addEventListener(
26+
'screenReaderChanged',
27+
handleScreenReaderChanged as (event: AccessibilityEvent) => void,
28+
)
1829

19-
return () => {
20-
AccessibilityInfo.removeEventListener('reduceMotionChanged', handleReduceMotionChanged as (event: AccessibilityEvent) => void)
21-
AccessibilityInfo.removeEventListener('screenReaderChanged', handleScreenReaderChanged as (event: AccessibilityEvent) => void)
22-
}
23-
}, [])
30+
return () => {
31+
AccessibilityInfo.removeEventListener(
32+
'reduceMotionChanged',
33+
handleReduceMotionChanged as (event: AccessibilityEvent) => void,
34+
)
35+
AccessibilityInfo.removeEventListener(
36+
'screenReaderChanged',
37+
handleScreenReaderChanged as (event: AccessibilityEvent) => void,
38+
)
39+
}
40+
}, [])
2441

2542
return { reduceMotionEnabled, screenReaderEnabled }
2643
}

src/useAppState.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect, useState } from 'react'
22
import { AppState, AppStateStatus } from 'react-native'
33

4-
54
export default function useAppState() {
65
const currentState = AppState.currentState
76
const [appState, setAppState] = useState(currentState)

src/useBackHandler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect } from 'react'
22
import { BackHandler } from 'react-native'
33

4-
54
export default function useBackHandler(handler: () => void) {
65
useEffect(() => {
76
BackHandler.addEventListener('hardwareBackPress', handler)

src/useCameraRoll.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import React, { useState } from 'react'
22
import {
3-
CameraRoll, GetPhotosParamType, GetPhotosReturnType
3+
CameraRoll,
4+
GetPhotosParamType,
5+
GetPhotosReturnType,
46
} from 'react-native'
57

6-
78
const initialState: GetPhotosReturnType = {
89
edges: [],
910
page_info: {
1011
end_cursor: '',
1112
has_next_page: false,
12-
start_cursor: ''
13-
}
13+
start_cursor: '',
14+
},
1415
}
1516

1617
const defaultConfig: GetPhotosParamType = {
1718
first: 20,
18-
groupTypes: 'All'
19+
groupTypes: 'All',
1920
}
2021

2122
export default function useCameraRoll() {

src/useClipboard.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { useEffect, useState } from 'react'
22
import { Clipboard } from 'react-native'
33

4-
54
export default function useClipBoard() {
65
const [data, updateClipboardData] = useState('')
76

87
async function updateClipboard() {
98
const content = await Clipboard.getString()
10-
updateClipboardData(content);
9+
updateClipboardData(content)
1110
}
1211

1312
useEffect(() => {

src/useDeviceOrientation.ts

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1-
import React, { useEffect, useState } from 'react';
2-
import { Dimensions, ScaledSize } from 'react-native';
1+
import React, { useEffect, useState } from 'react'
2+
import { Dimensions, ScaledSize } from 'react-native'
33

4-
5-
const screen = Dimensions.get('screen');
4+
const screen = Dimensions.get('screen')
65

76
export default function() {
8-
const isOrientationPortrait = ({ width, height }: { width: number, height: number }) => height >= width;
9-
const isOrientationLandscape = ({ width, height }: { width: number, height: number }) => width >= height;
7+
const isOrientationPortrait = ({
8+
width,
9+
height,
10+
}: {
11+
width: number
12+
height: number
13+
}) => height >= width
14+
const isOrientationLandscape = ({
15+
width,
16+
height,
17+
}: {
18+
width: number
19+
height: number
20+
}) => width >= height
1021

1122
const [orientation, setOrientation] = useState({
1223
portrait: isOrientationPortrait(screen),
13-
landscape: isOrientationLandscape(screen)
14-
});
24+
landscape: isOrientationLandscape(screen),
25+
})
1526

1627
const onChange = ({ screen }: { screen: ScaledSize }) => {
1728
setOrientation({
1829
portrait: isOrientationPortrait(screen),
19-
landscape: isOrientationLandscape(screen)
20-
});
21-
};
30+
landscape: isOrientationLandscape(screen),
31+
})
32+
}
2233

23-
useEffect(
24-
() => {
25-
Dimensions.addEventListener('change', onChange);
34+
useEffect(() => {
35+
Dimensions.addEventListener('change', onChange)
2636

27-
return () => {
28-
Dimensions.removeEventListener('change', onChange);
29-
};
30-
},
31-
[orientation.portrait, orientation.landscape]
32-
);
37+
return () => {
38+
Dimensions.removeEventListener('change', onChange)
39+
}
40+
}, [orientation.portrait, orientation.landscape])
3341

34-
return orientation;
35-
};
42+
return orientation
43+
}

src/useDimensions.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
import React, { useEffect, useState } from 'react'
22
import { Dimensions, ScaledSize } from 'react-native'
33

4-
54
const window = Dimensions.get('window')
65
const screen = Dimensions.get('screen')
76

87
export default function useDimensions() {
98
const [dimensions, setDimensions] = useState({
10-
window, screen
9+
window,
10+
screen,
1111
})
1212

13-
const onChange = ({ window, screen }: { window: ScaledSize, screen: ScaledSize }) => {
13+
const onChange = ({
14+
window,
15+
screen,
16+
}: {
17+
window: ScaledSize
18+
screen: ScaledSize
19+
}) => {
1420
setDimensions({ window, screen })
1521
}
1622

src/useInteractionManager.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import React, { useEffect, useState } from 'react';
2-
import { InteractionManager } from 'react-native';
3-
1+
import React, { useEffect, useState } from 'react'
2+
import { InteractionManager } from 'react-native'
43

54
export default function useInteractionManager() {
6-
const [complete, updateInteractionStatus] = useState(false);
5+
const [complete, updateInteractionStatus] = useState(false)
76

87
useEffect(() => {
98
InteractionManager.runAfterInteractions(() => {
109
updateInteractionStatus(true)
1110
})
1211
}, [])
1312
return complete
14-
};
13+
}

src/useKeyboard.ts

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,59 @@
11
import React, { useEffect, useState } from 'react'
22
import { Keyboard, KeyboardEventListener, ScreenRect } from 'react-native'
33

4-
54
export default function useKeyboard() {
6-
const [shown, setShown] = useState(false)
7-
const [coordinates, setCoordinates] = useState<{ start: ScreenRect, end: ScreenRect }>({
8-
start: { screenX:0, screenY: 0, width: 0, height: 0 },
9-
end: { screenX:0, screenY: 0, width: 0, height: 0 },
10-
})
5+
const [shown, setShown] = useState(false)
6+
const [coordinates, setCoordinates] = useState<{
7+
start: ScreenRect
8+
end: ScreenRect
9+
}>({
10+
start: { screenX: 0, screenY: 0, width: 0, height: 0 },
11+
end: { screenX: 0, screenY: 0, width: 0, height: 0 },
12+
})
1113

1214
const handleKeyboardWillShow: KeyboardEventListener = (e) => {
13-
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
15+
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
1416
}
1517
const handleKeyboardDidShow: KeyboardEventListener = (e) => {
16-
setShown(true)
17-
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
18+
setShown(true)
19+
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
1820
}
1921
const handleKeyboardWillHide: KeyboardEventListener = (e) => {
20-
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
22+
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
2123
}
2224
const handleKeyboardDidHide: KeyboardEventListener = (e) => {
23-
setShown(false)
24-
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
25+
setShown(false)
26+
setCoordinates({ start: e.startCoordinates, end: e.endCoordinates })
2527
}
2628

2729
useEffect(() => {
28-
const keyboardWillShowListener = Keyboard.addListener('keyboardWillShow', handleKeyboardWillShow)
29-
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', handleKeyboardDidShow)
30-
const keyboardWillHideListener = Keyboard.addListener('keyboardWillHide', handleKeyboardWillHide)
31-
const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', handleKeyboardDidHide)
30+
const keyboardWillShowListener = Keyboard.addListener(
31+
'keyboardWillShow',
32+
handleKeyboardWillShow,
33+
)
34+
const keyboardDidShowListener = Keyboard.addListener(
35+
'keyboardDidShow',
36+
handleKeyboardDidShow,
37+
)
38+
const keyboardWillHideListener = Keyboard.addListener(
39+
'keyboardWillHide',
40+
handleKeyboardWillHide,
41+
)
42+
const keyboardDidHideListener = Keyboard.addListener(
43+
'keyboardDidHide',
44+
handleKeyboardDidHide,
45+
)
3246

3347
return () => {
34-
keyboardWillShowListener.remove()
35-
keyboardDidShowListener.remove()
36-
keyboardWillHideListener.remove()
48+
keyboardWillShowListener.remove()
49+
keyboardDidShowListener.remove()
50+
keyboardWillHideListener.remove()
3751
keyboardDidHideListener.remove()
3852
}
3953
}, [])
4054

4155
return {
42-
keyboardShown: shown,
43-
coordinates,
56+
keyboardShown: shown,
57+
coordinates,
4458
}
4559
}

src/useLayout.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import React from 'react'
22

3-
43
export default function useLayout() {
5-
const [layout, setLayout] = React.useState({
6-
x: 0,
7-
y: 0,
8-
width: 0,
9-
height: 0,
10-
})
11-
const onLayout = React.useCallback(e => setLayout(e.nativeEvent.layout), [])
4+
const [layout, setLayout] = React.useState({
5+
x: 0,
6+
y: 0,
7+
width: 0,
8+
height: 0,
9+
})
10+
const onLayout = React.useCallback((e) => setLayout(e.nativeEvent.layout), [])
1211

13-
return {
14-
onLayout,
15-
...layout,
16-
}
12+
return {
13+
onLayout,
14+
...layout,
15+
}
1716
}

0 commit comments

Comments
 (0)