@codeleap/mobile 1.2.1 → 1.3.0

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.
Files changed (57) hide show
  1. package/dist/components/Animated.d.ts +103 -0
  2. package/dist/components/Animated.js +55 -0
  3. package/dist/components/Animated.js.map +1 -0
  4. package/dist/components/Button.d.ts +2 -8
  5. package/dist/components/Button.js +2 -1
  6. package/dist/components/Button.js.map +1 -1
  7. package/dist/components/FileInput.d.ts +19 -2
  8. package/dist/components/FileInput.js +89 -4
  9. package/dist/components/FileInput.js.map +1 -1
  10. package/dist/components/Image.d.ts +2 -2
  11. package/dist/components/Image.js.map +1 -1
  12. package/dist/components/Modal/index.d.ts +24 -0
  13. package/dist/components/Modal/index.js +116 -0
  14. package/dist/components/Modal/index.js.map +1 -0
  15. package/dist/components/Modal/styles.d.ts +62 -0
  16. package/dist/components/Modal/styles.js +62 -0
  17. package/dist/components/Modal/styles.js.map +1 -0
  18. package/dist/components/Overlay.d.ts +16 -0
  19. package/dist/components/Overlay.js +68 -0
  20. package/dist/components/Overlay.js.map +1 -0
  21. package/dist/components/Scroll.d.ts +1 -95
  22. package/dist/components/TextInput.js +22 -18
  23. package/dist/components/TextInput.js.map +1 -1
  24. package/dist/components/Touchable.d.ts +8 -14
  25. package/dist/components/Touchable.js +10 -12
  26. package/dist/components/Touchable.js.map +1 -1
  27. package/dist/components/View.d.ts +12 -10
  28. package/dist/components/View.js +2 -4
  29. package/dist/components/View.js.map +1 -1
  30. package/dist/components/index.d.ts +3 -0
  31. package/dist/components/index.js +3 -0
  32. package/dist/components/index.js.map +1 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.js +3 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/modules/cropPicker.d.ts +1 -0
  37. package/dist/modules/cropPicker.js +10 -0
  38. package/dist/modules/cropPicker.js.map +1 -0
  39. package/dist/modules/documentPicker.d.ts +1 -0
  40. package/dist/modules/documentPicker.js +10 -0
  41. package/dist/modules/documentPicker.js.map +1 -0
  42. package/dist/utils/styles.js.map +1 -1
  43. package/package.json +6 -3
  44. package/src/components/Animated.tsx +31 -0
  45. package/src/components/Button.tsx +2 -1
  46. package/src/components/FileInput.tsx +67 -4
  47. package/src/components/Image.tsx +3 -3
  48. package/src/components/Modal/index.tsx +143 -0
  49. package/src/components/Modal/styles.ts +122 -0
  50. package/src/components/Overlay.tsx +72 -0
  51. package/src/components/TextInput.tsx +28 -22
  52. package/src/components/Touchable.tsx +20 -23
  53. package/src/components/View.tsx +5 -15
  54. package/src/components/index.ts +4 -0
  55. package/src/index.ts +2 -1
  56. package/src/modules/documentPicker.ts +2 -0
  57. package/src/utils/styles.ts +2 -2
@@ -1,54 +1,51 @@
1
1
  import * as React from 'react'
2
2
  import { ComponentPropsWithoutRef, forwardRef } from 'react'
3
- import { ComponentVariants, useComponentStyle, BaseViewProps, ViewStyles, useStyle } from '@codeleap/common'
3
+ import { ComponentVariants, useComponentStyle, BaseViewProps, ViewStyles, useStyle, AnyFunction } from '@codeleap/common'
4
4
  import { View } from './View'
5
- import { Animated, TouchableOpacity as NativeTouchable } from 'react-native'
5
+ import { TouchableOpacity as NativeTouchable} from 'react-native'
6
6
 
7
+ import { createAnimatableComponent } from 'react-native-animatable'
7
8
  export type TouchableProps =
8
- ComponentPropsWithoutRef<typeof NativeTouchable> &
9
+ Omit<ComponentPropsWithoutRef<typeof NativeTouchable>, 'onPress'> &
9
10
  {
10
11
  variants?: ComponentVariants <typeof ViewStyles>['variants'],
11
12
  component?: any
13
+ ref?: React.Ref<NativeTouchable>
14
+ debugName?:string
15
+ onPress?: AnyFunction
12
16
  } & BaseViewProps
13
17
 
14
- export const Touchable = forwardRef<NativeTouchable, TouchableProps>((touchableProps, ref) => {
18
+ export const Touchable:React.FC<TouchableProps> = forwardRef<NativeTouchable, TouchableProps>((touchableProps, ref) => {
15
19
  const {
16
20
  variants = [],
17
21
  children,
18
22
  onPress,
19
23
  style,
24
+ debugName,
25
+
20
26
  ...props
21
27
  } = touchableProps
22
28
 
23
29
  const variantStyles = useComponentStyle('View', {
24
30
  variants,
25
31
  })
32
+
26
33
  const {logger} = useStyle()
27
34
  const press = () => {
28
35
  if(!onPress) throw {message: 'No onPress passed to touchable', touchableProps}
29
- logger.log('<Touchable/> pressed', { style, variants }, 'Component')
30
- onPress(null)
36
+ logger.log(`${debugName || '<Touchable/>'} pressed`, { style, variants }, 'Component')
37
+ onPress && onPress()
31
38
  }
32
39
 
33
40
  const styles = [variantStyles.wrapper, style]
34
41
 
35
- return <NativeTouchable onPress={press} {...props} ref={ref}>
36
- <View style={styles}>
37
- {children}
38
- </View>
42
+
43
+ return <NativeTouchable onPress={press} style={styles} {...props} ref={ref}>
44
+
45
+
46
+ {children}
47
+
39
48
  </NativeTouchable>
40
49
  })
41
50
 
42
- export type AnimatedTouchableProps =
43
- ComponentPropsWithoutRef<typeof Animated.View> &
44
- TouchableProps
45
-
46
- export const AnimatedTouchable = forwardRef<typeof Animated.View, AnimatedTouchableProps>((viewProps, ref) => {
47
- // @ts-ignore
48
- return <Touchable
49
- component={Animated.View}
50
-
51
- {...viewProps}
52
- />
53
-
54
- })
51
+ export const AnimatedTouchable = createAnimatableComponent(Touchable)
@@ -1,12 +1,13 @@
1
1
  import * as React from 'react';
2
+ import * as Animatable from 'react-native-animatable'
2
3
  import { ComponentPropsWithoutRef, forwardRef } from 'react'
3
4
  import { ComponentVariants, useComponentStyle, ViewStyles, BaseViewProps } from '@codeleap/common'
4
- import { Animated, View as NativeView } from 'react-native'
5
+ import { View as NativeView, ViewStyle } from 'react-native'
5
6
 
6
7
  export type ViewProps =
7
8
  ComponentPropsWithoutRef<typeof NativeView> &
8
9
  ComponentVariants<typeof ViewStyles> & {
9
-
10
+ ref?:any
10
11
  component?: any
11
12
  } & BaseViewProps
12
13
 
@@ -38,16 +39,5 @@ export const View = forwardRef<NativeView, ViewProps>((viewProps, ref) => {
38
39
  </Component>
39
40
  })
40
41
 
41
- export type AnimatedViewProps =
42
- ComponentPropsWithoutRef<typeof Animated.View> &
43
- ComponentVariants<typeof ViewStyles> & BaseViewProps
44
-
45
- export const AnimatedView = forwardRef<typeof Animated.View, AnimatedViewProps>((viewProps, ref) => {
46
- // @ts-ignore
47
- return <View
48
- component={Animated.View}
49
-
50
- {...viewProps}
51
- />
52
-
53
- })
42
+ export const AnimatedView =
43
+ Animatable.createAnimatableComponent(View) as unknown as React.ForwardRefExoticComponent<{transition?: any,animation?: any} & ViewProps>
@@ -7,6 +7,8 @@ export * from './Checkbox'
7
7
  export * from './TextInput'
8
8
  export * from './RadioInput'
9
9
  export * from './Switch'
10
+ export * from './ContentView'
11
+
10
12
  export * from './Select'
11
13
  export * from './FileInput'
12
14
  export * from './Slider'
@@ -15,5 +17,7 @@ export * from './Scroll'
15
17
  export * from './ActivityIndicator'
16
18
  export * from './Button'
17
19
  export * from './ContentView'
20
+ export * from './Overlay'
21
+ export * from './Modal'
18
22
 
19
23
  export * from './Navigation'
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './components'
2
- export {default as OSAlert } from './utils/OSAlert'
2
+ export {default as OSAlert } from './utils/OSAlert'
3
+ export {default as posed} from 'react-native-pose'
@@ -0,0 +1,2 @@
1
+ // @ts-ignore
2
+ export {default as DocumentPicker} from 'react-native-document-picker'
@@ -1,4 +1,4 @@
1
- import { useComponentStyle, useStyle } from "@codeleap/common";
1
+ import { useStyle } from "@codeleap/common";
2
2
  import { StyleSheet } from "react-native";
3
3
 
4
4
  export function useLogStyles(){
@@ -14,4 +14,4 @@ export function useLogStyles(){
14
14
  )
15
15
  }
16
16
 
17
- }
17
+ }