@momo-kits/foundation 0.92.26-beta.21 → 0.92.26-beta.23

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.
@@ -1,4 +1,5 @@
1
1
  import React, {
2
+ Ref,
2
3
  useCallback,
3
4
  useContext,
4
5
  useEffect,
@@ -32,7 +33,7 @@ import {PopupNotify} from '../Popup';
32
33
  import {Badge, BadgeDot} from '../Badge';
33
34
  import {HeaderType} from '../Layout/types';
34
35
  import Navigation from './Navigation';
35
- import {InputSearch, InputSearchProps} from '../Input';
36
+ import {InputRef, InputSearch, InputSearchProps} from '../Input';
36
37
 
37
38
  const SCREEN_PADDING = 12;
38
39
  const BACK_WIDTH = 28;
@@ -515,12 +516,14 @@ const HeaderExtendHeader: React.FC<{
515
516
  animatedValue: Animated.Value;
516
517
  heightHeader: number;
517
518
  inputSearchProps?: InputSearchProps;
519
+ inputSearchRef?: Ref<InputRef>;
518
520
  navigation?: Navigation;
519
521
  }> = ({
520
522
  headerType = 'default',
521
523
  animatedValue,
522
524
  heightHeader,
523
525
  inputSearchProps,
526
+ inputSearchRef,
524
527
  navigation,
525
528
  }) => {
526
529
  const {theme} = useContext(ApplicationContext);
@@ -548,9 +551,11 @@ const HeaderExtendHeader: React.FC<{
548
551
  extrapolate: 'clamp',
549
552
  });
550
553
 
551
- navigation!.onHeaderRightChange = (width: number) => {
552
- setRightSpace(width);
553
- };
554
+ if (navigation) {
555
+ navigation.onHeaderRightChange = (width: number) => {
556
+ setRightSpace(width);
557
+ };
558
+ }
554
559
 
555
560
  const renderInputView = (hasColorBG: boolean = false) => {
556
561
  return (
@@ -574,6 +579,7 @@ const HeaderExtendHeader: React.FC<{
574
579
  }}>
575
580
  <InputSearch
576
581
  {...inputSearchProps}
582
+ ref={inputSearchRef}
577
583
  hasColorBG={hasColorBG}
578
584
  showButtonText={false}
579
585
  />
@@ -74,6 +74,7 @@ const InputOTP = forwardRef(
74
74
  placeholder,
75
75
  onChangeText,
76
76
  onBlur,
77
+ onFocus,
77
78
  dataType = 'number',
78
79
  params,
79
80
  style,
@@ -215,7 +216,7 @@ const InputOTP = forwardRef(
215
216
  value={value}
216
217
  onChangeText={_onChangeText}
217
218
  keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
218
- onFocus={onFocusInput}
219
+ onFocus={onFocus}
219
220
  onBlur={onBlurInput}
220
221
  style={{opacity: 0}}
221
222
  selectionColor={theme.colors.primary}
package/Layout/Screen.tsx CHANGED
@@ -3,6 +3,7 @@ import React, {
3
3
  forwardRef,
4
4
  Fragment,
5
5
  ReactNode,
6
+ Ref,
6
7
  useContext,
7
8
  useEffect,
8
9
  useRef,
@@ -30,7 +31,7 @@ import {FloatingButton, FloatingButtonProps} from './FloatingButton';
30
31
  import {Card, Section, validateChildren} from './index';
31
32
  import styles from './styles';
32
33
  import {HeaderType} from './types';
33
- import {InputSearchProps} from '../Input';
34
+ import {InputRef, InputSearchProps} from '../Input';
34
35
  import {HeaderExtendHeader} from '../Application/Components';
35
36
 
36
37
  export interface ScreenProps extends ViewProps {
@@ -107,6 +108,8 @@ export interface ScreenProps extends ViewProps {
107
108
  * Optional. specs for input search.
108
109
  */
109
110
  inputSearchProps?: InputSearchProps;
111
+
112
+ inputSearchRef?: Ref<InputRef>;
110
113
  }
111
114
 
112
115
  const Screen = forwardRef(
@@ -127,6 +130,7 @@ const Screen = forwardRef(
127
130
  useGridLayout = true,
128
131
  keyboardVerticalOffset,
129
132
  inputSearchProps,
133
+ inputSearchRef,
130
134
  }: ScreenProps,
131
135
  ref
132
136
  ) => {
@@ -289,7 +293,7 @@ const Screen = forwardRef(
289
293
  }
290
294
 
291
295
  navigation?.setOptions(options);
292
- }, [headerType, animatedHeader]);
296
+ }, [headerType, animatedHeader, inputSearchProps]);
293
297
 
294
298
  /**
295
299
  * animated when use scroll && animated value
@@ -414,6 +418,7 @@ const Screen = forwardRef(
414
418
  animatedValue={animatedValue.current}
415
419
  inputSearchProps={inputSearchProps}
416
420
  navigation={navigation}
421
+ inputSearchRef={inputSearchRef}
417
422
  />
418
423
 
419
424
  <KeyboardAvoidingView
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.26-beta.21",
3
+ "version": "0.92.26-beta.23",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},