Skip to content

Commit d172a06

Browse files
committed
Fix files with eslint and improve Readme
1 parent c749cec commit d172a06

File tree

8 files changed

+70
-69
lines changed

8 files changed

+70
-69
lines changed

Example/App.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React from 'react';
2-
import { Text, View, FlatList, StyleSheet, TouchableOpacity, YellowBox } from 'react-native';
3-
import { createStackNavigator, createAppContainer } from 'react-navigation';
1+
import React from 'react'
2+
import { Text, View, FlatList, StyleSheet, TouchableOpacity } from 'react-native'
3+
import { createStackNavigator, createAppContainer } from 'react-navigation'
44

5-
import Map from './Map';
6-
import BlurToolbar from './BlurToolbar';
7-
import Imperative from './Imperative';
8-
import Test from './Test';
5+
import Map from './Map'
6+
import BlurToolbar from './BlurToolbar'
7+
import Imperative from './Imperative'
8+
import Test from './Test'
99

1010
const SCREENS = {
1111
map: {
@@ -24,14 +24,14 @@ const SCREENS = {
2424
screen: Test,
2525
title: 'Test',
2626
},
27-
};
27+
}
2828

2929
class MainScreen extends React.Component {
3030
static navigationOptions = {
3131
title: 'Bottom Sheet Examples',
3232
};
3333
render() {
34-
const data = Object.keys(SCREENS).map(key => ({ key }));
34+
const data = Object.keys(SCREENS).map(key => ({ key }))
3535
return (
3636
<FlatList
3737
style={styles.list}
@@ -44,21 +44,21 @@ class MainScreen extends React.Component {
4444
/>
4545
)}
4646
/>
47-
);
47+
)
4848
}
4949
}
5050

51-
const ItemSeparator = () => <View style={styles.separator} />;
51+
const ItemSeparator = () => <View style={styles.separator} />
5252

5353
class MainScreenItem extends React.Component {
5454
_onPress = () => this.props.onPressItem(this.props.item);
5555
render() {
56-
const { key } = this.props.item;
56+
const { key } = this.props.item
5757
return (
5858
<TouchableOpacity style={styles.button} onPress={this._onPress}>
5959
<Text style={styles.buttonText}>{SCREENS[key].title || key}</Text>
6060
</TouchableOpacity>
61-
);
61+
)
6262
}
6363
}
6464

@@ -70,7 +70,7 @@ const ExampleApp = createAppContainer(createStackNavigator(
7070
{
7171
initialRouteName: 'Main',
7272
}
73-
));
73+
))
7474

7575
const styles = StyleSheet.create({
7676
list: {
@@ -91,6 +91,6 @@ const styles = StyleSheet.create({
9191
alignItems: 'center',
9292
backgroundColor: '#fff',
9393
},
94-
});
94+
})
9595

96-
export default ExampleApp;
96+
export default ExampleApp

Example/BlurToolbar.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
2-
import { Image, StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native';
3-
import BottomSheet from 'reanimated-bottom-sheet';
1+
import React from 'react'
2+
import { Image, StyleSheet, Text, View } from 'react-native'
3+
import BottomSheet from 'reanimated-bottom-sheet'
44
import Animated from 'react-native-reanimated'
55

66

@@ -54,7 +54,7 @@ export default class Example extends React.Component {
5454
}
5555
}
5656

57-
const IMAGE_SIZE = 200;
57+
const IMAGE_SIZE = 200
5858

5959
const styles = StyleSheet.create({
6060
container: {
@@ -85,8 +85,8 @@ const styles = StyleSheet.create({
8585
shadowOpacity: 0.4,
8686
},
8787
header: {
88-
width: '100%',
89-
height: 50,
88+
width: '100%',
89+
height: 50,
9090
},
9191
panelHeader: {
9292
alignItems: 'center',
@@ -129,5 +129,5 @@ const styles = StyleSheet.create({
129129
height: '100%',
130130
width: '100%',
131131
},
132-
});
132+
})
133133

Example/Imperative.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
2-
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3-
import BottomSheet from 'reanimated-bottom-sheet';
1+
import React from 'react'
2+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
3+
import BottomSheet from 'reanimated-bottom-sheet'
44

55

66

@@ -60,7 +60,7 @@ export default class Example extends React.Component {
6060
}
6161
}
6262

63-
const IMAGE_SIZE = 200;
63+
const IMAGE_SIZE = 200
6464

6565
const styles = StyleSheet.create({
6666
container: {
@@ -98,8 +98,8 @@ const styles = StyleSheet.create({
9898
shadowOpacity: 0.4,
9999
},
100100
header: {
101-
width: '100%',
102-
height: 50,
101+
width: '100%',
102+
height: 50,
103103
},
104104
panelHeader: {
105105
alignItems: 'center',
@@ -142,5 +142,5 @@ const styles = StyleSheet.create({
142142
height: '100%',
143143
width: '100%',
144144
},
145-
});
145+
})
146146

Example/Map.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
2-
import { Image, StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native';
3-
import BottomSheet from 'reanimated-bottom-sheet';
1+
import React from 'react'
2+
import { Image, StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native'
3+
import BottomSheet from 'reanimated-bottom-sheet'
44

55

66

@@ -53,7 +53,7 @@ export default class Example extends React.Component {
5353
}
5454
}
5555

56-
const IMAGE_SIZE = 200;
56+
const IMAGE_SIZE = 200
5757

5858
const styles = StyleSheet.create({
5959
container: {
@@ -125,5 +125,5 @@ const styles = StyleSheet.create({
125125
height: '100%',
126126
width: '100%',
127127
},
128-
});
128+
})
129129

Example/Test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
2-
import { StyleSheet, Text, Button, View } from 'react-native';
3-
import BottomSheet from 'reanimated-bottom-sheet';
1+
import React from 'react'
2+
import { StyleSheet, Text, Button, View } from 'react-native'
3+
import BottomSheet from 'reanimated-bottom-sheet'
44

55

66
export default class Example extends React.Component {
@@ -63,7 +63,7 @@ export default class Example extends React.Component {
6363
}
6464
}
6565

66-
const IMAGE_SIZE = 200;
66+
const IMAGE_SIZE = 200
6767

6868
const styles = StyleSheet.create({
6969
container: {
@@ -74,4 +74,4 @@ const styles = StyleSheet.create({
7474
width: IMAGE_SIZE,
7575
height: IMAGE_SIZE,
7676
},
77-
});
77+
})

Example/babel.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = function(api) {
2-
api.cache(true);
2+
api.cache(true)
33
return {
44
presets: ['babel-preset-expo'],
5-
};
6-
};
5+
}
6+
}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Reanimated Bottom Sheet
2-
Component imitating native bottom sheet behavior built from scratch with react-native-gesture-handler and react-native-reanimated.
2+
Highly configurable component imitating native bottom sheet behavior built from scratch with react-native-gesture-handler and react-native-reanimated.
3+
No JS animations, 60 FPS!
34

45
Usable with Expo with no extra native dependencies!
56

@@ -70,7 +71,7 @@ this.bottomSheet.current.snaptTo(0)
7071
```
7172

7273
## Example
73-
Few more complicated examples could be found in `Example` folder which is simple Expo app
74+
Few more complicated examples can be found in `Example` folder
7475

7576
```javascript
7677
cd Example

index.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ function runDecay(clock, value, velocity, wasStartedFromBegin) {
6969
}
7070

7171
function withPreservingAdditiveOffset(drag, state) {
72-
const prev = new Animated.Value(0)
73-
const valWithPreservedOffset = new Animated.Value(0)
72+
const prev = new Value(0)
73+
const valWithPreservedOffset = new Value(0)
7474
return block([
7575
cond(eq(state, State.BEGAN), [
7676
set(prev, 0)
@@ -83,10 +83,10 @@ function withPreservingAdditiveOffset(drag, state) {
8383
}
8484

8585
function withDecaying(drag, state, decayClock, velocity, prevent) {
86-
const valDecayed = new Animated.Value(0)
87-
const offset = new Animated.Value(0)
86+
const valDecayed = new Value(0)
87+
const offset = new Value(0)
8888
// since there might be moar than one clock
89-
const wasStartedFromBegin = new Animated.Value(0)
89+
const wasStartedFromBegin = new Value(0)
9090
return block([
9191
cond(eq(state, State.END),
9292
[
@@ -156,10 +156,10 @@ export default class BottomSheetBehavior extends Component {
156156
velocity = new Value(0);
157157
panMasterState = new Value(State.END);
158158
masterVelocity = new Value(0);
159-
isManuallySetValue = new Animated.Value(0);
160-
manuallySetValue = new Animated.Value(0);
159+
isManuallySetValue = new Value(0);
160+
manuallySetValue = new Value(0);
161161
masterClockForOverscroll = new Clock();
162-
preventDecaying = new Animated.Value(0);
162+
preventDecaying = new Value(0);
163163
dragMasterY = new Value(0);
164164
dragY = new Value(0);
165165

@@ -187,8 +187,8 @@ export default class BottomSheetBehavior extends Component {
187187
this.snapPoint = currentSnapPoint()
188188

189189
const masterClock = new Clock()
190-
const prevMasterDrag = new Animated.Value(0)
191-
const wasRun = new Animated.Value(0)
190+
const prevMasterDrag = new Value(0)
191+
const wasRun = new Value(0)
192192
this.translateMaster = block([
193193
cond(eq(this.panMasterState, State.END),
194194
[
@@ -250,18 +250,18 @@ export default class BottomSheetBehavior extends Component {
250250
handleTap = event([{ nativeEvent: { state: this.tapState } }]);
251251

252252
withEnhancedLimits(val, masterOffseted) {
253-
const wasRunMaster = new Animated.Value(0)
253+
const wasRunMaster = new Value(0)
254254
const min = multiply(-1, add(this.state.heightOfContent, this.state.heightOfHeaderAnimated))
255-
const prev = new Animated.Value(0)
256-
const limitedVal = new Animated.Value(0)
257-
const diffPres = new Animated.Value(0)
258-
const flagWasRunSpring = new Animated.Value(0)
259-
const justEndedIfEnded = new Animated.Value(1)
260-
const wasEndedMasterAfterInner = new Animated.Value(1)
261-
const prevMaster = new Animated.Value(1)
262-
const prevState = new Animated.Value(0)
263-
264-
const rev = new Animated.Value(0)
255+
const prev = new Value(0)
256+
const limitedVal = new Value(0)
257+
const diffPres = new Value(0)
258+
const flagWasRunSpring = new Value(0)
259+
const justEndedIfEnded = new Value(1)
260+
const wasEndedMasterAfterInner = new Value(1)
261+
const prevMaster = new Value(1)
262+
const prevState = new Value(0)
263+
264+
const rev = new Value(0)
265265
return block([
266266
set(rev, limitedVal),
267267
cond(or(eq(this.panState, State.BEGAN), and(eq(this.panState, State.ACTIVE), eq(prevState, State.END))), [
@@ -316,7 +316,7 @@ export default class BottomSheetBehavior extends Component {
316316
this.isManuallySetValue.setValue(1)
317317
};
318318

319-
height = new Animated.Value(0)
319+
height = new Value(0)
320320

321321
handleLayoutHeader = ({
322322
nativeEvent: {
@@ -377,8 +377,8 @@ export default class BottomSheetBehavior extends Component {
377377
return {
378378
init: sortedPropsSnapPints[0].val - sortedPropsSnapPints[propsToNewIncides[initialSnap]].val,
379379
propsToNewIncides,
380-
heightOfHeaderAnimated: (state && state.heightOfHeaderAnimated) || new Animated.Value(0),
381-
heightOfContent: (state && state.heightOfContent) || new Animated.Value(0),
380+
heightOfHeaderAnimated: (state && state.heightOfHeaderAnimated) || new Value(0),
381+
heightOfContent: (state && state.heightOfContent) || new Value(0),
382382
initSnap: sortedPropsSnapPints[0].val,
383383
snapPoints
384384
}

0 commit comments

Comments
 (0)