@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.
- package/dist/components/Animated.d.ts +103 -0
- package/dist/components/Animated.js +55 -0
- package/dist/components/Animated.js.map +1 -0
- package/dist/components/Button.d.ts +2 -8
- package/dist/components/Button.js +2 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/FileInput.d.ts +19 -2
- package/dist/components/FileInput.js +89 -4
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Image.d.ts +2 -2
- package/dist/components/Image.js.map +1 -1
- package/dist/components/Modal/index.d.ts +24 -0
- package/dist/components/Modal/index.js +116 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/styles.d.ts +62 -0
- package/dist/components/Modal/styles.js +62 -0
- package/dist/components/Modal/styles.js.map +1 -0
- package/dist/components/Overlay.d.ts +16 -0
- package/dist/components/Overlay.js +68 -0
- package/dist/components/Overlay.js.map +1 -0
- package/dist/components/Scroll.d.ts +1 -95
- package/dist/components/TextInput.js +22 -18
- package/dist/components/TextInput.js.map +1 -1
- package/dist/components/Touchable.d.ts +8 -14
- package/dist/components/Touchable.js +10 -12
- package/dist/components/Touchable.js.map +1 -1
- package/dist/components/View.d.ts +12 -10
- package/dist/components/View.js +2 -4
- package/dist/components/View.js.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/cropPicker.d.ts +1 -0
- package/dist/modules/cropPicker.js +10 -0
- package/dist/modules/cropPicker.js.map +1 -0
- package/dist/modules/documentPicker.d.ts +1 -0
- package/dist/modules/documentPicker.js +10 -0
- package/dist/modules/documentPicker.js.map +1 -0
- package/dist/utils/styles.js.map +1 -1
- package/package.json +6 -3
- package/src/components/Animated.tsx +31 -0
- package/src/components/Button.tsx +2 -1
- package/src/components/FileInput.tsx +67 -4
- package/src/components/Image.tsx +3 -3
- package/src/components/Modal/index.tsx +143 -0
- package/src/components/Modal/styles.ts +122 -0
- package/src/components/Overlay.tsx +72 -0
- package/src/components/TextInput.tsx +28 -22
- package/src/components/Touchable.tsx +20 -23
- package/src/components/View.tsx +5 -15
- package/src/components/index.ts +4 -0
- package/src/index.ts +2 -1
- package/src/modules/documentPicker.ts +2 -0
- 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 {
|
|
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/>
|
|
30
|
-
onPress(
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
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)
|
package/src/components/View.tsx
CHANGED
|
@@ -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 {
|
|
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
|
|
42
|
-
|
|
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>
|
package/src/components/index.ts
CHANGED
|
@@ -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
package/src/utils/styles.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
+
}
|