@momo-kits/foundation 0.92.6-rc.26 → 0.92.6-rc.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -193,7 +193,7 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
193
193
  headerImage = undefined;
194
194
  }
195
195
  if (useSurface) {
196
- backgroundColor = theme.colors.background.default;
196
+ backgroundColor = theme.colors.background.surface;
197
197
  }
198
198
  const opacity = animatedValue?.interpolate({
199
199
  inputRange: [0, 114],
@@ -85,11 +85,13 @@ const Modal: React.FC<ModalParams> = props => {
85
85
 
86
86
  const BottomSheet: React.FC<BottomSheetParams> = props => {
87
87
  const {theme, navigator} = useContext(ApplicationContext);
88
+ const insets = useSafeAreaInsets();
89
+
88
90
  const {
89
91
  screen: Screen,
90
92
  options,
91
93
  footerComponent,
92
- flatListProps,
94
+ scrollViewProps,
93
95
  backgroundColor,
94
96
  }: BottomSheetParams = props.route.params;
95
97
 
@@ -101,14 +103,59 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
101
103
  };
102
104
 
103
105
  delete params.screen;
104
- const modalizeRef = useRef<Modalize>(null);
106
+ const modalRef = useRef<Modalize>(null);
105
107
 
106
108
  useEffect(() => {
107
- modalizeRef.current?.open();
109
+ modalRef.current?.open();
108
110
  }, []);
109
111
 
110
112
  const handleClose = () => {
111
- modalizeRef?.current?.close();
113
+ modalRef?.current?.close();
114
+ };
115
+
116
+ /**
117
+ * build header
118
+ * @param title
119
+ * @param onClose
120
+ */
121
+ const headerDefault = (title: string, onClose: () => void) => {
122
+ return (
123
+ <View
124
+ style={[
125
+ styles.header,
126
+ {borderBottomColor: theme.colors.border.default},
127
+ ]}>
128
+ <View style={styles.iconButton} />
129
+ <Text
130
+ style={styles.textOption}
131
+ numberOfLines={1}
132
+ typography="header_default_bold">
133
+ {title ?? ''}
134
+ </Text>
135
+ <TouchableOpacity style={styles.iconButton} onPress={onClose}>
136
+ <Icon source="navigation_close" />
137
+ </TouchableOpacity>
138
+ </View>
139
+ );
140
+ };
141
+
142
+ /**
143
+ * build footer
144
+ * @param footerComponent
145
+ */
146
+ const footerDefault = (footerComponent: React.ReactNode) => {
147
+ if (footerComponent) {
148
+ return (
149
+ <View
150
+ style={{
151
+ marginBottom: Math.min(insets.bottom, 21),
152
+ paddingHorizontal: Spacing.M,
153
+ paddingVertical: Spacing.S,
154
+ }}>
155
+ {footerComponent}
156
+ </View>
157
+ );
158
+ }
112
159
  };
113
160
 
114
161
  return (
@@ -121,9 +168,12 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
121
168
  onClosed={() => {
122
169
  navigator?.pop();
123
170
  }}
124
- ref={modalizeRef}
125
- withHandle={false}
126
- flatListProps={flatListProps}
171
+ handlePosition="inside"
172
+ withHandle={true}
173
+ disableScrollIfPossible={true}
174
+ modalTopOffset={insets.top}
175
+ ref={modalRef}
176
+ scrollViewProps={scrollViewProps}
127
177
  HeaderComponent={headerDefault(
128
178
  options?.title ?? options?.customTitle?.title ?? '',
129
179
  handleClose,
@@ -140,40 +190,6 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
140
190
  );
141
191
  };
142
192
 
143
- const headerDefault = (title: string, onClose: () => void) => {
144
- return (
145
- <View style={styles.header}>
146
- <Text
147
- style={styles.textOption}
148
- numberOfLines={1}
149
- typography="header_default_bold">
150
- {title ?? ''}
151
- </Text>
152
- <TouchableOpacity style={styles.buttonClose} onPress={onClose}>
153
- <Icon source="navigation_close" />
154
- </TouchableOpacity>
155
- </View>
156
- );
157
- };
158
-
159
- const footerDefault = (footerComponent: React.ReactNode) => {
160
- const insets = useSafeAreaInsets();
161
- return (
162
- <View
163
- style={{
164
- marginBottom: Math.min(insets.bottom, 21),
165
- paddingHorizontal: 12,
166
- }}>
167
- {footerComponent && (
168
- <>
169
- {footerComponent}
170
- <View style={{height: Spacing.S}} />
171
- </>
172
- )}
173
- </View>
174
- );
175
- };
176
-
177
193
  const styles = StyleSheet.create({
178
194
  container: {flex: 1, flexDirection: 'row'},
179
195
  modalContent: {
@@ -214,10 +230,12 @@ const styles = StyleSheet.create({
214
230
  width: '100%',
215
231
  },
216
232
  header: {
217
- height: 50,
233
+ marginTop: 10,
234
+ height: 56,
218
235
  width: '100%',
219
236
  alignItems: 'center',
220
- justifyContent: 'center',
237
+ flexDirection: 'row',
238
+ borderBottomWidth: 1,
221
239
  },
222
240
  textOption: {
223
241
  fontSize: 16,
@@ -225,12 +243,14 @@ const styles = StyleSheet.create({
225
243
  textAlign: 'center',
226
244
  fontWeight: 'bold',
227
245
  paddingHorizontal: Spacing.L,
246
+ flex: 1,
228
247
  },
229
-
230
- buttonClose: {
231
- padding: 12,
232
- position: 'absolute',
233
- right: 0,
248
+ iconButton: {
249
+ width: 24,
250
+ height: 24,
251
+ alignItems: 'center',
252
+ justifyContent: 'center',
253
+ marginHorizontal: Spacing.M,
234
254
  },
235
255
  icon: {
236
256
  width: 24,
@@ -1,6 +1,6 @@
1
1
  import {StackNavigationOptions} from '@react-navigation/stack';
2
2
  import React from 'react';
3
- import {Animated, FlatListProps, ViewProps} from 'react-native';
3
+ import {Animated, ScrollViewProps, ViewProps} from 'react-native';
4
4
  import {PopupNotifyProps} from '../Popup/types';
5
5
  import Navigation from './Navigation';
6
6
  import Navigator from './Navigator';
@@ -121,7 +121,7 @@ export interface BottomSheetParams extends ScreenParams {
121
121
  onDismiss?: () => void;
122
122
  backgroundColor?: string;
123
123
  footerComponent?: React.ReactNode;
124
- flatListProps?: FlatListProps<any>;
124
+ scrollViewProps?: ScrollViewProps;
125
125
  }
126
126
 
127
127
  export type NavigationButtonProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.6-rc.26",
3
+ "version": "0.92.6-rc.28",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},