Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 43 additions & 24 deletions Example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
FlatList,
StyleSheet,
TouchableOpacity,
SafeAreaView,
} from 'react-native'
import { createAppContainer } from 'react-navigation'
import { createStackNavigator } from 'react-navigation-stack'
import { createStackNavigator } from '@react-navigation/stack'
import { NavigationContainer } from '@react-navigation/native'

import AppleMusic from './src/screen/AppleMusic'
import Map from './Map'
Expand Down Expand Up @@ -55,17 +56,19 @@ class MainScreen extends React.Component {
render() {
const data = Object.keys(SCREENS).map(key => ({ key }))
return (
<FlatList
style={styles.list}
data={data}
ItemSeparatorComponent={ItemSeparator}
renderItem={props => (
<MainScreenItem
{...props}
onPressItem={({ key }) => this.props.navigation.navigate(key)}
/>
)}
/>
<SafeAreaView>
<FlatList
style={styles.list}
data={data}
ItemSeparatorComponent={ItemSeparator}
renderItem={props => (
<MainScreenItem
{...props}
onPressItem={({ key }) => this.props.navigation.navigate(key)}
/>
)}
/>
</SafeAreaView>
)
}
}
Expand All @@ -84,18 +87,36 @@ class MainScreenItem extends React.Component {
}
}

const ExampleApp = createAppContainer(
createStackNavigator(
{
Main: { screen: MainScreen },
...SCREENS,
},
{
initialRouteName: 'Main',
}
const ExampleAppStack = createStackNavigator()

const ExampleStackScreen = () => {
return (
<ExampleAppStack.Navigator
screenOptions={{
headerShown: false,
}}
initialRouteName={'Main'}
>
<ExampleAppStack.Screen name={'Main'} component={MainScreen} />
{Object.keys(SCREENS).map((screenName, idx) => (
<ExampleAppStack.Screen
key={idx}
name={screenName}
component={SCREENS[screenName].screen}
/>
))}
</ExampleAppStack.Navigator>
)
}

const App = () => (
<NavigationContainer>
<ExampleStackScreen />
</NavigationContainer>
)

export default App

const styles = StyleSheet.create({
list: {
backgroundColor: '#EFEFF4',
Expand All @@ -116,5 +137,3 @@ const styles = StyleSheet.create({
backgroundColor: '#fff',
},
})

export default ExampleApp
32 changes: 17 additions & 15 deletions Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,30 @@
"eject": "expo eject"
},
"dependencies": {
"expo": "~37.0.3",
"expo-blur": "~8.1.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-gesture-handler": "~1.6.1",
"react-native-reanimated": "~1.7.0",
"react-native-screens": "~2.2.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.3.8",
"react-navigation-stack": "^1.10.3",
"@react-navigation/bottom-tabs": "^5.11.11",
"@react-navigation/drawer": "^5.12.5",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5",
"expo": "^42.0.0",
"expo-blur": "~9.0.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
"react-native-gesture-handler": "~1.10.2",
"react-native-reanimated": "~2.2.0",
"react-native-screens": "~3.4.0",
"react-native-web": "~0.13.12",
"scheduler": "^0.18.0"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"@babel/core": "~7.9.0",
"@babel/runtime": "^7.9.2",
"@types/expo": "~33.0.1",
"@types/expo__vector-icons": "^9.0.1",
"babel-preset-expo": "~8.1.0",
"babel-plugin-module-resolver": "4.0.0",
"babel-preset-expo": "8.3.0",
"escape-string-regexp": "^2.0.0",
"expo-cli": "^3.8.0",
"babel-plugin-module-resolver": "4.0.0"
"expo-cli": "^3.8.0"
},
"private": true
}
16 changes: 8 additions & 8 deletions Example/src/screen/AppleMusic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ const AppleMusic = () => {
let bottomSheetRef = React.createRef<BottomSheet>()
let fall = new Animated.Value(1)

const animatedSongCoverTopPosition = Animated.interpolate(fall, {
const animatedSongCoverTopPosition = fall.interpolate({
inputRange: [0, 1],
outputRange: songCoverTopPositions.slice().reverse(),
extrapolate: Animated.Extrapolate.CLAMP,
})

const animatedSongCoverSize = Animated.interpolate(fall, {
const animatedSongCoverSize = fall.interpolate({
inputRange: [0, 1],
outputRange: [songCoverSizes[0], songCoverSizes[1]].slice().reverse(),
extrapolate: Animated.Extrapolate.CLAMP,
})

const animatedHeaderContentOpacity = Animated.interpolate(fall, {
const animatedHeaderContentOpacity = fall.interpolate({
inputRange: [0.75, 1],
outputRange: [0, 1],
extrapolate: Animated.Extrapolate.CLAMP,
Expand All @@ -81,7 +81,7 @@ const AppleMusic = () => {
1,
animatedHeaderContentOpacity
)
const animatedContentOpacity = Animated.interpolate(fall, {
const animatedContentOpacity = fall.interpolate({
inputRange: [0, 1],
outputRange: [1, 0],
extrapolate: Animated.Extrapolate.CLAMP,
Expand Down Expand Up @@ -125,7 +125,7 @@ const AppleMusic = () => {
}

const renderSongCover = () => {
const animatedSongCoverLeftPosition = Animated.interpolate(fall, {
const animatedSongCoverLeftPosition = fall.interpolate({
inputRange: [0, 1],
outputRange: songCoverLeftPositions.slice().reverse(),
extrapolate: Animated.Extrapolate.CLAMP,
Expand Down Expand Up @@ -190,7 +190,7 @@ const AppleMusic = () => {
<Ionicons name="ios-play" size={32} />
</TouchableOpacity>
<TouchableOpacity style={styles.headerActionButton}>
<Ionicons name="ios-fastforward" size={32} />
<Ionicons name="ios-play-forward" size={32} />
</TouchableOpacity>
</AnimatedBlurView>
</AnimatedView>
Expand All @@ -200,7 +200,7 @@ const AppleMusic = () => {
}

const renderShadow = () => {
const animatedShadowOpacity = Animated.interpolate(fall, {
const animatedShadowOpacity = fall.interpolate({
inputRange: [0, 1],
outputRange: [0.5, 0],
})
Expand All @@ -220,7 +220,7 @@ const AppleMusic = () => {

const renderHandler = () => {
const animatedBar1Rotation = (outputRange: number[]) =>
Animated.interpolate(fall, {
fall.interpolate({
inputRange: [0, 1],
outputRange: outputRange,
extrapolate: Animated.Extrapolate.CLAMP,
Expand Down
13 changes: 10 additions & 3 deletions Example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
"lib": [
"esnext"
],
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
Expand All @@ -20,8 +22,13 @@
"strict": true,
"target": "esnext",
"paths": {
"reanimated-bottom-sheet": ["../src/index"]
"reanimated-bottom-sheet": [
"../src/index"
]
}
},
"include": ["src"]
"include": [
"src"
],
"extends": "expo/tsconfig.base"
}
Loading