Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rewrite bottom sheet from scratch 🎉 #2

Merged
merged 30 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dbe35e8
chore: added utilities functionalities
gorhom Aug 3, 2020
2b949a9
chore: added default handle
gorhom Aug 3, 2020
3dd304e
chore: rewrite the whole bottom sheet into a functional component
gorhom Aug 3, 2020
52a3a73
chore: added basic example WIP
gorhom Aug 3, 2020
0e956fd
chore: extract content pan gesture
gorhom Aug 4, 2020
0f4a0ff
chore: updated flatlist implementation
gorhom Aug 4, 2020
cef6138
chore: updated scrollview implementation
gorhom Aug 4, 2020
8bcf258
chore: updated sectionview implementation
gorhom Aug 4, 2020
6a5b249
chore: improve snapping by clamping velocity
gorhom Aug 4, 2020
5101fdd
chore: extract scrollable functioanlites and introduce removeScrollab…
gorhom Aug 4, 2020
85fddb5
chore: added snapTo and close public methods
gorhom Aug 5, 2020
e03f3be
chore: updated basic examples
gorhom Aug 5, 2020
3f1a767
chore: added draggable view
gorhom Aug 6, 2020
03a4e5f
chore: revert clampedVelocity
gorhom Aug 6, 2020
7a9a6fc
chore: fixed issue with manual animation
gorhom Aug 6, 2020
94b4e65
fix: fixed android issue with scrollables
gorhom Aug 6, 2020
c463c78
chore: updated dependencies
gorhom Aug 10, 2020
a6a1203
chore: extract handle pan gesture from content
gorhom Aug 10, 2020
d3c1d7f
chore: updated examples
gorhom Aug 10, 2020
80c078e
chore: persist scrollable content offset per view
gorhom Aug 10, 2020
06adf54
chore: rename scrollable components
gorhom Aug 10, 2020
d6e70f1
chore: revert initial screen
gorhom Aug 10, 2020
739374d
chore: added touchables
gorhom Aug 10, 2020
8db9ddb
chore: updated examples
gorhom Aug 10, 2020
556cc58
chore: added animatedPosition & animatedPositionIndex callback nodes
gorhom Aug 11, 2020
4cd7d32
chore: added custom handle & shadow overlay examples
gorhom Aug 11, 2020
79c4e46
chore: support initial closed state
gorhom Aug 11, 2020
ddd6d6e
chore: allow user to modify animation configs
gorhom Aug 11, 2020
af1d86d
chore: updated navigator example
gorhom Aug 11, 2020
5cc3afa
chore: added loadash.isequal
gorhom Aug 11, 2020
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
16 changes: 0 additions & 16 deletions example/babel.config.js

This file was deleted.

9 changes: 7 additions & 2 deletions example/ios/BottomSheetExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
ORGANIZATIONNAME = Facebook;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = 4P8A237MEX;
LastSwiftMigration = 1110;
};
};
Expand Down Expand Up @@ -269,6 +270,7 @@
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 4P8A237MEX;
INFOPLIST_FILE = BottomSheetExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_CFLAGS = (
Expand All @@ -280,7 +282,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.BottomSheetExample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = "dev.gorhom.bottom-sheet";
PRODUCT_NAME = BottomSheetExample;
SWIFT_OBJC_BRIDGING_HEADER = "BottomSheetExample-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -296,6 +298,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4P8A237MEX;
INFOPLIST_FILE = BottomSheetExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_CFLAGS = (
Expand All @@ -307,7 +310,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.BottomSheetExample.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = "dev.gorhom.bottom-sheet";
PRODUCT_NAME = BottomSheetExample;
SWIFT_OBJC_BRIDGING_HEADER = "BottomSheetExample-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -344,6 +347,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down Expand Up @@ -397,6 +401,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
Expand Down
12 changes: 6 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,13 @@ PODS:
- React-cxxreact (= 0.62.2)
- React-jsi (= 0.62.2)
- ReactCommon/callinvoker (= 0.62.2)
- RNCMaskedView (0.1.6):
- RNCMaskedView (0.1.10):
- React
- RNGestureHandler (1.7.0):
- React
- RNReanimated (1.10.1):
- RNReanimated (1.11.0):
- React
- RNScreens (2.9.0):
- RNScreens (2.10.1):
- React
- Yoga (1.14.0)
- YogaKit (1.18.1):
Expand Down Expand Up @@ -466,10 +466,10 @@ SPEC CHECKSUMS:
React-RCTText: fae545b10cfdb3d247c36c56f61a94cfd6dba41d
React-RCTVibration: 4356114dbcba4ce66991096e51a66e61eda51256
ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
RNCMaskedView: a88953beefbd347a29072d9eba90e42945fe291e
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNGestureHandler: b6b359bb800ae399a9c8b27032bdbf7c18f08a08
RNReanimated: c2bb7438b57a3d987bb2e4e6e4bca94787e30b02
RNScreens: c526239bbe0e957b988dacc8d75ac94ec9cb19da
RNReanimated: f05ea1c5ee07891aaefee662f073f4944c87ac4d
RNScreens: b748efec66e095134c7166ca333b628cd7e6f3e2
Yoga: 3ebccbdd559724312790e7742142d062476b698e
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

Expand Down
25 changes: 14 additions & 11 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
const path = require('path');
const fs = require('fs');
const blacklist = require('metro-config/src/defaults/blacklist');
const escape = require('escape-string-regexp');
const pak = require('../package.json');

const root = path.resolve(__dirname, '..');
const pak = JSON.parse(
fs.readFileSync(path.join(root, 'package.json'), 'utf8')
);

const modules = Object.keys({
...pak.peerDependencies,
});
const modules = [
'@babel/runtime',
...Object.keys({
...pak.dependencies,
...pak.peerDependencies,
}),
];

module.exports = {
projectRoot: __dirname,
watchFolders: [root],

// We need to make sure that only one version is loaded for peerDependencies
// So we blacklist them at the root, and alias them to the versions in example's node_modules
resolver: {
blacklistRE: blacklist(
modules.map(
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
)
),
blacklistRE: blacklist([
new RegExp(`^${escape(path.join(root, 'node_modules'))}\\/.*$`),
]),

extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
Expand Down
15 changes: 8 additions & 7 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@
},
"dependencies": {
"@gorhom/showcase-template": "^0.3.1",
"@react-native-community/masked-view": "0.1.6",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/native": "^5.3.2",
"@react-navigation/stack": "^5.3.5",
"date-fns": "^2.15.0",
"faker": "^4.1.0",
"lodash.isequal": "^4.5.0",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-gesture-handler": "^1.7.0",
"react-native-maps": "^0.27.1",
"react-native-reanimated": "^1.7.0",
"react-native-reanimated": "^1.11.0",
"react-native-redash": "^14.2.3",
"react-native-safe-area-context": "0.7.3",
"react-native-screens": "^2.9.0"
},
"devDependencies": {
"@babel/core": "^7.9.6",
"@babel/runtime": "^7.9.6",
"@types/faker": "^4.1.12",
"@types/react": "~16.9.23",
"@types/react-native": "~0.61.17",
"babel-plugin-module-resolver": "^4.0.0",
"@types/react": "^16.9.23",
"@types/react-native": "^0.61.17",
"metro-react-native-babel-preset": "^0.59.0",
"typescript": "^3.8.3"
"typescript": "^3.9.7"
}
}
30 changes: 23 additions & 7 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import RootScreen from './screens/Root';
import NavigatorExampleScreen from './screens/NavigatorExample';
import FlatListExampleScreen from './screens/FlatListExample';
import SectionListExampleScreen from './screens/SectionListExample';
import ScrollViewExampleScreen from './screens/ScrollViewExample';
import {
FlatListExampleScreen,
SectionListExampleScreen,
ScrollViewExampleScreen,
ViewExampleScreen,
} from './screens/BasicExamples';
import CustomHandleExampleScreen from './screens/CustomHandleExample';
import ShadowOverlayExampleScreen from './screens/ShadowOverlayExample';
import { AppStackParamsList } from './types';

const Stack = createStackNavigator<AppStackParamsList>();
Expand All @@ -18,10 +23,7 @@ function App() {
component={RootScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="NavigatorExample"
component={NavigatorExampleScreen}
/>
{/* basic examples */}
<Stack.Screen
name="FlatListExample"
component={FlatListExampleScreen}
Expand All @@ -34,6 +36,20 @@ function App() {
name="ScrollViewExample"
component={ScrollViewExampleScreen}
/>
<Stack.Screen name="ViewExample" component={ViewExampleScreen} />
{/* advanced examples */}
<Stack.Screen
name="NavigatorExample"
component={NavigatorExampleScreen}
/>
<Stack.Screen
name="CustomHandleExample"
component={CustomHandleExampleScreen}
/>
<Stack.Screen
name="ShadowOverlayExample"
component={ShadowOverlayExampleScreen}
/>
</Stack.Navigator>
</NavigationContainer>
);
Expand Down
43 changes: 0 additions & 43 deletions example/src/components/Handle.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions example/src/components/Transaction.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions example/src/components/button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useMemo } from 'react';
import { Text, TouchableOpacity, StyleSheet, ViewStyle } from 'react-native';
import { Text, StyleSheet, ViewStyle } from 'react-native';
import { TouchableOpacity } from '@gorhom/bottom-sheet';

interface ButtonProps {
label: string;
Expand Down Expand Up @@ -27,7 +28,6 @@ const styles = StyleSheet.create({
},
label: {
color: 'white',
textTransform: 'capitalize',
},
});

Expand Down
Loading