ui-rn 1.0.18 → 2.0.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/ZoomImg.tsx DELETED
@@ -1,206 +0,0 @@
1
- import { Animated, Modal, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
2
- import React, { useEffect } from 'react'
3
- import { Image, ImageProps } from 'react-native'
4
- import { ImageZoom, ZoomableRef } from '@likashefqet/react-native-image-zoom';
5
- import { GestureHandlerRootView } from 'react-native-gesture-handler';
6
- import { Dimensions } from 'react-native';
7
- import { isNumber } from 'underscore';
8
- import { Platform } from 'react-native';
9
- import { StatusBar } from 'react-native';
10
- import SafeAreaView from 'react-native-safe-area-view'
11
-
12
-
13
- const { width, height } = Dimensions.get('screen')
14
- const HIT_SLOP = { top: 16, left: 16, bottom: 16, right: 16 };
15
- const TIME = 50
16
- interface ZoomImageProps extends ImageProps {
17
- uri: string
18
- }
19
- interface ZoomImageState {
20
- visible: boolean
21
- disableZoonOut: boolean
22
- }
23
- export default class ZoomImg extends React.Component<ZoomImageProps, ZoomImageState> {
24
- ref = React.createRef<ZoomableRef>()
25
- scale: number = 1
26
- scale_v = 0.3
27
- _startZoomIn: any
28
- _startZoomOut: any
29
- constructor(props: ZoomImageProps) {
30
- super(props)
31
- this.state = {
32
- visible: false,
33
- disableZoonOut: true
34
- }
35
- this.zoomIn = this.zoomIn.bind(this)
36
- this.zoomOut = this.zoomOut.bind(this)
37
- this.startZoomIn = this.startZoomIn.bind(this)
38
- this.stopZoomIn = this.stopZoomIn.bind(this)
39
- this.startZoomOut = this.startZoomOut.bind(this)
40
- this.stopZoomOut = this.stopZoomOut.bind(this)
41
-
42
- }
43
- onZoom(e?: any) { }
44
- zoomIn() {
45
- const { disableZoonOut } = this.state
46
- if (disableZoonOut) { this.setState({ disableZoonOut: false }) }
47
- this.scale = this.scale + this.scale_v
48
- this.ref.current?.zoom({ scale: this.scale, x: width / 2, y: height / 2 })
49
- }
50
- zoomOut() {
51
- if (this.scale - this.scale_v <= 1) {
52
- this.ref.current?.zoom({ scale: 1, x: 0, y: 0 })
53
- this.setState({ disableZoonOut: true })
54
- return
55
- }
56
- this.scale = this.scale - this.scale_v
57
- this.ref.current?.zoom({ scale: this.scale, x: width / 2, y: height / 2 })
58
- }
59
- startZoomIn() { this._startZoomIn = setInterval(() => { this.zoomIn() }, TIME); }
60
- stopZoomIn() { if (this._startZoomIn) clearInterval(this._startZoomIn) }
61
- startZoomOut() { this._startZoomOut = setInterval(() => { this.zoomOut() }, TIME); }
62
- stopZoomOut() { if (this._startZoomOut) clearInterval(this._startZoomOut) }
63
-
64
- open() { this.setState({ visible: true }) }
65
- close() { this.setState({ visible: false }) }
66
- render(): React.ReactNode {
67
- const { uri, style, source } = this.props
68
- const { visible, disableZoonOut, } = this.state
69
- const styleButton = { hitSlop: HIT_SLOP }
70
- if (isNumber(source)) return <Image source={source} style={style} />
71
- //@ts-ignore
72
- const value = uri ?? source.uri
73
- return (
74
- <>
75
- <TouchableOpacity onPress={() => this.open()}>
76
- <Image source={{ uri: value }} style={style} />
77
- </TouchableOpacity>
78
- <Modal visible={visible} presentationStyle='fullScreen'>
79
- <StatusBarManager presentationStyle='overFullScreen' />
80
- <SafeAreaView forceInset={{ top: 'always', }} style={{ flex: 1, backgroundColor: '#000' }}>
81
- <GestureHandlerRootView style={styles.container}>
82
- <View style={[styles.header]}>
83
- <SafeAreaView style={styles.root}>
84
- <TouchableOpacity style={styles.closeButton} onPress={() => this.close()} hitSlop={HIT_SLOP}>
85
- <Text style={styles.closeText}>✕</Text>
86
- </TouchableOpacity>
87
- <TouchableOpacity style={styles.closeButton} onPress={this.zoomIn} onLongPress={this.startZoomIn} onPressOut={this.stopZoomIn} {...styleButton}>
88
- <Text style={[styles.closeText, styles.actionText]}>+</Text>
89
- </TouchableOpacity>
90
- <TouchableOpacity style={[styles.closeButton, { backgroundColor: disableZoonOut ? "#0000001F" : "#00000077" }]} disabled={disableZoonOut} onPress={this.zoomOut} onLongPress={this.startZoomOut} onPressOut={this.stopZoomOut} {...styleButton}>
91
- <Text style={[styles.closeText, styles.actionText]}>-</Text>
92
- </TouchableOpacity>
93
- </SafeAreaView>
94
- </View>
95
- <ImageZoom
96
- ref={this.ref}
97
- uri={value}
98
- minScale={1}
99
- maxScale={3}
100
- // scale={4}
101
- doubleTapScale={3}
102
- isSingleTapEnabled
103
- isDoubleTapEnabled
104
- onInteractionStart={() => {
105
- console.log('onInteractionStart');
106
- this.onZoom();
107
- }}
108
- onInteractionEnd={() => console.log('onInteractionEnd')}
109
- onPanStart={() => console.log('onPanStart')}
110
- onPanEnd={() => console.log('onPanEnd')}
111
- onPinchStart={() => console.log('onPinchStart')}
112
- onPinchEnd={() => console.log('onPinchEnd')}
113
- onSingleTap={() => console.log('onSingleTap')}
114
- onDoubleTap={(zoomType) => {
115
- console.log('onDoubleTap', zoomType);
116
- this.onZoom(zoomType);
117
- }}
118
- onProgrammaticZoom={(zoomType) => {
119
- console.log('onZoom', zoomType);
120
- this.onZoom(zoomType);
121
- }}
122
- style={styles.image}
123
- onResetAnimationEnd={(finished, values) => {
124
- console.log('onResetAnimationEnd', finished);
125
- console.log('lastScaleValue:', values?.SCALE.lastValue);
126
- // onAnimationEnd(finished);
127
- }}
128
- resizeMode="contain"
129
- />
130
- </GestureHandlerRootView >
131
- </SafeAreaView>
132
- </Modal>
133
- </>
134
- )
135
- }
136
-
137
- }
138
-
139
- const styles = StyleSheet.create({
140
- container: {
141
- flex: 1,
142
- backgroundColor: "#000",
143
- },
144
- image: {
145
- width: width,
146
- height: height,
147
- resizeMode: 'contain'
148
- },
149
- header: {
150
- position: "absolute",
151
- width: "100%",
152
- zIndex: 1,
153
- top: 0,
154
- },
155
- action: {
156
- position: "absolute",
157
- width: "100%",
158
- zIndex: 1,
159
- top: 100,
160
- },
161
- root: {
162
- alignItems: "flex-end",
163
- },
164
- closeButton: {
165
- marginRight: 8,
166
- marginTop: 8,
167
- width: 44,
168
- height: 44,
169
- alignItems: "center",
170
- justifyContent: "center",
171
- borderRadius: 22,
172
- backgroundColor: "#00000077",
173
- },
174
- closeText: {
175
- lineHeight: 22,
176
- fontSize: 19,
177
- textAlign: "center",
178
- color: "#FFF",
179
- includeFontPadding: false,
180
- },
181
- actionButton: {
182
- marginRight: 5,
183
- marginTop: 8,
184
- width: 40,
185
- height: 40,
186
- alignItems: "center",
187
- justifyContent: "center",
188
- borderRadius: 22,
189
- backgroundColor: "#00000077",
190
- },
191
- actionText: {
192
- fontSize: 24
193
- }
194
- })
195
- const StatusBarManager = ({ presentationStyle, }: { presentationStyle?: "fullScreen" | "pageSheet" | "formSheet" | "overFullScreen" | undefined; }) => {
196
- if (Platform.OS === "ios" || presentationStyle !== "overFullScreen") {
197
- return null;
198
- }
199
- //Can't get an actual state of app status bar with default RN. Gonna rely on "presentationStyle === overFullScreen" prop and guess application status bar state to be visible in this case.
200
- StatusBar.setHidden(true);
201
- useEffect(() => {
202
- StatusBar.setHidden(true);
203
- return () => StatusBar.setHidden(false);
204
- }, []);
205
- return null;
206
- };
package/globals.config.js DELETED
@@ -1,33 +0,0 @@
1
- const { isObject } = require("lodash");
2
- const log = console.debug
3
-
4
- class Log {
5
- static e = (...a) => log(Color.red, ...a)
6
- static e1 = (...a) => Log.format(Color.red, ...a)
7
- static d = (...a) => log(Color.cyan, ...a)
8
- static d1 = (...a) => Log.format(Color.cyan, ...a)
9
- static g = (...a) => log(Color.green, ...a)
10
- static g1 = (...a) => Log.format(Color.green, ...a)
11
- static y = (...a) => log(Color.yellow, ...a)
12
- static y1 = (...a) => Log.format(Color.yellow, ...a)
13
- static format(color = Color.yellow, ...a) {
14
- {
15
- if (a.length == 1) {
16
- log(color, JSON.stringify(a[0], null, ' '));
17
- }
18
- else if (a.length >= 2) {
19
- const end = a.slice(2)
20
- if (isObject(a[0])) log(JSON.stringify(a[0], null, ' '), JSON.stringify(a[1], null, ' '), ...end);
21
- else log(color, a[0], JSON.stringify(a[1], null, ' '), ...end);
22
- }
23
-
24
- }
25
- }
26
- }
27
- const Color = {
28
- red: '\x1b[31m',
29
- green: '\x1b[32m',
30
- yellow: '\x1b[33m',
31
- cyan: '\x1b[36m',
32
- }
33
- window.Log = Log
package/globals.d.ts DELETED
@@ -1,16 +0,0 @@
1
- declare module '*.svg' {
2
- const content: string;
3
- export default content;
4
- }
5
-
6
- export class Log {
7
- static e: (...message: any[]) => void;
8
- static e1: (...message: any[]) => void;
9
- static d: (...message: any[]) => void;
10
- static d1: (...message: any[]) => void;
11
- static g: (...message: any[]) => void;
12
- static g1: (...message: any[]) => void;
13
- static y: (...message: any[]) => void;
14
- static y1: (...message: any[]) => void;
15
- static format: (...message: any[]) => void;
16
- }
package/src/Dropdown.tsx DELETED
@@ -1,41 +0,0 @@
1
- import React from "react";
2
- import { Platform, StatusBar } from "react-native";
3
- import DropdownAlert from "react-native-dropdownalert";
4
- const ref = React.createRef<DropdownAlert>()
5
-
6
- export default function AlertApp() {
7
- return (
8
- <DropdownAlert
9
- ref={ref}
10
- inactiveStatusBarBackgroundColor={'green'}
11
- updateStatusBar={false}
12
- errorColor={'#9A9891FFFF'}
13
- successColor={'#238209'}
14
- // errorImageSrc={Images('logo')}
15
- // successImageSrc={Images('logo')}
16
- imageStyle={{
17
- padding: 8,
18
- width: 36,
19
- height: 36,
20
- alignSelf: 'center',
21
- borderRadius: 23,
22
- }}
23
- elevation={40}
24
- containerStyle={{ backgroundColor: 'pink' }}
25
- closeInterval={1300}
26
- showCancel={false}
27
- wrapperStyle={{ marginTop: Platform.OS == "ios" ? 0 : StatusBar.currentHeight }}
28
- />
29
- )
30
- }
31
- export class AlertPush {
32
- static warn(title: string = 'title', message: string = '') {
33
- ref.current?.alertWithType('warn', title, message)
34
- }
35
- static error(title: string = 'title', message: string = '') {
36
- ref.current?.alertWithType('error', title, message)
37
- }
38
- static success(title: string = 'title', message: string = '') {
39
- ref.current?.alertWithType('success', title, message)
40
- }
41
- }
@@ -1,172 +0,0 @@
1
- import React, { PureComponent } from 'react'
2
- import {
3
- Dimensions,
4
- Modal,
5
- StyleSheet,
6
- TouchableOpacity,
7
- View,
8
- ViewProps,
9
- Text
10
- } from 'react-native'
11
- import LoadingType, { LoadingTypeI } from './LoadingType'
12
-
13
- /**
14
- * Props for the Loading component
15
- * @interface Props
16
- */
17
- export type Props = {
18
- /** Custom style for the loading box container */
19
- boxStyle?: ViewProps['style']
20
- /** Custom style for the main container */
21
- containerStyle?: ViewProps['style']
22
- }
23
-
24
- /**
25
- * Internal state of the Loading component
26
- * @interface State
27
- */
28
- type State = {
29
- /** Controls the visibility of the loading modal */
30
- visible: boolean,
31
- /** Determines if the loading can be dismissed by touch */
32
- touch: boolean,
33
- /** Current progress value (0-100) */
34
- progress: number,
35
- /** Controls whether to show progress indicator */
36
- progressShow: boolean,
37
- /** Type of loading indicator to display */
38
- type: LoadingTypeI
39
- }
40
-
41
- /**
42
- * Loading component that displays a modal with customizable loading indicators
43
- * and optional progress tracking.
44
- *
45
- * @example
46
- * ```tsx
47
- * const loading = useRef<Loading>(null);
48
- *
49
- * // Show loading
50
- * loading.current?.show();
51
- *
52
- * // Show loading with progress
53
- * loading.current?.openProgress({ progress: 50, progressShow: true });
54
- *
55
- * // Hide loading
56
- * loading.current?.hide();
57
- * ```
58
- */
59
- export default class Loading extends PureComponent<Props, State> {
60
- state: State
61
- constructor(props: any) {
62
- super(props)
63
- this.state = {
64
- visible: false,
65
- touch: false,
66
- progress: 0,
67
- progressShow: false,
68
- type: 'BallIndicator'
69
- }
70
- }
71
-
72
- /**
73
- * Shows the loading modal
74
- * @param touch - Whether the loading can be dismissed by touch (default: true)
75
- */
76
- show(touch = true) {
77
- this.setState({ visible: true, touch })
78
- }
79
-
80
- /**
81
- * Hides the loading modal and resets progress
82
- */
83
- hide() {
84
- this.setState({ visible: false, progress: 0, progressShow: false })
85
- }
86
-
87
- /**
88
- * Updates the progress state
89
- * @param e - Object containing progress updates
90
- */
91
- openProgress(e: any) { this.setState(prev => ({ ...prev, ...e })) }
92
-
93
- /**
94
- * Handles touch events to dismiss the loading modal
95
- */
96
- onPressOut() {
97
- if (this.state.touch) {
98
- this.hide()
99
- }
100
- }
101
-
102
- componentDidMount(): void {
103
- }
104
- componentWillUnmount(): void {
105
- }
106
-
107
- /**
108
- * Renders the loading indicator based on the selected type
109
- * @returns React element for the loading indicator
110
- */
111
- renderIcon() {
112
- if (this.state.type) return React.createElement(LoadingType[this.state.type], { color: '#4481EB' })
113
- return null
114
- }
115
-
116
- /**
117
- * Renders the progress text if progressShow is true
118
- * @returns React element for the progress text
119
- */
120
- renderProgress() {
121
- if (this.state.progressShow) {
122
- return (<Text style={styles.text}>{this.state.progress}{'%'}</Text>)
123
- }
124
- return null
125
- }
126
-
127
- render() {
128
- return (
129
- <Modal
130
- visible={this.state.visible}
131
- transparent
132
- style={{ zIndex: 999999 }}
133
- >
134
- <TouchableOpacity onPress={() => this.onPressOut()}
135
- activeOpacity={1} style={[styles.container, this.props.containerStyle]}>
136
- <View style={[styles.box, this.props.boxStyle]}>
137
- {this.renderProgress()}
138
- {this.renderIcon()}
139
- </View>
140
- </TouchableOpacity>
141
- </Modal>
142
- )
143
- }
144
- }
145
- const styles = StyleSheet.create({
146
- container: {
147
- flex: 1,
148
- justifyContent: 'center',
149
- alignItems: 'center',
150
- backgroundColor: '#06060660',
151
- },
152
- box: {
153
- width: Dimensions.get('screen').width * 0.25,
154
- height: Dimensions.get('screen').width * 0.25,
155
- backgroundColor: '#fff',
156
- justifyContent: 'center',
157
- alignItems: 'center',
158
- borderRadius: 16,
159
- shadowColor: '#000',
160
- elevation: 3,
161
- shadowOffset: {
162
- width: 3,
163
- height: 5,
164
- },
165
- shadowOpacity: 0.1,
166
- },
167
- text: {
168
- position: 'absolute',
169
- fontSize: 10,
170
- color: '#4481EB'
171
- },
172
- })
@@ -1,46 +0,0 @@
1
- import {
2
- BallIndicator,
3
- BarIndicator,
4
- DotIndicator,
5
- MaterialIndicator,
6
- PacmanIndicator,
7
- PulseIndicator,
8
- SkypeIndicator,
9
- UIActivityIndicator,
10
- WaveIndicator,
11
- } from 'react-native-indicators';
12
-
13
- /**
14
- * Collection of loading indicator components from react-native-indicators
15
- * Each indicator provides a different visual style for loading states
16
- *
17
- * Available indicators:
18
- * - BallIndicator: Animated bouncing balls
19
- * - BarIndicator: Animated bars
20
- * - DotIndicator: Animated dots
21
- * - MaterialIndicator: Material design style loading indicator
22
- * - PacmanIndicator: Pacman-style loading animation
23
- * - PulseIndicator: Pulsing animation
24
- * - SkypeIndicator: Skype-style loading indicator
25
- * - UIActivityIndicator: Native iOS-style activity indicator
26
- * - WaveIndicator: Wave-like animation
27
- */
28
- const LoadingType = {
29
- BallIndicator,
30
- BarIndicator,
31
- DotIndicator,
32
- MaterialIndicator,
33
- PacmanIndicator,
34
- PulseIndicator,
35
- SkypeIndicator,
36
- UIActivityIndicator,
37
- WaveIndicator,
38
- }
39
-
40
- /**
41
- * Type definition for loading indicator names
42
- * Represents the keys of the LoadingType object
43
- */
44
- export type LoadingTypeI = keyof typeof LoadingType
45
-
46
- export default LoadingType
@@ -1,55 +0,0 @@
1
- import React, { PureComponent, ReactNode } from "react"
2
- import RNLoading, { Props } from "./Loading"
3
-
4
- /**
5
- * Reference to the Loading component instance
6
- */
7
- const loadingRef = React.createRef<RNLoading>()
8
-
9
- /**
10
- * Static Loading class that provides global access to loading functionality
11
- * This class allows showing and hiding the loading indicator from anywhere in the app
12
- *
13
- * @example
14
- * ```tsx
15
- * // Show loading
16
- * Loading.show();
17
- *
18
- * // Hide loading
19
- * Loading.hide();
20
- * ```
21
- */
22
- export class Loading {
23
- /**
24
- * Shows the loading indicator
25
- */
26
- static show() {
27
- loadingRef.current?.show()
28
- }
29
-
30
- /**
31
- * Hides the loading indicator
32
- */
33
- static hide() {
34
- loadingRef.current?.hide()
35
- }
36
- }
37
-
38
- /**
39
- * LoadingView component that renders the Loading component
40
- * This component should be mounted at the root level of your app
41
- * to enable global loading functionality
42
- *
43
- * @example
44
- * ```tsx
45
- * // In your App.tsx or root component
46
- * <LoadingView />
47
- * ```
48
- */
49
- export default class LoadingView extends PureComponent<Props> {
50
- render(): ReactNode {
51
- return (
52
- <RNLoading ref={loadingRef} {...this.props} />
53
- )
54
- }
55
- }
package/src/config.ts DELETED
@@ -1,36 +0,0 @@
1
- export const Colors = (e: any) => {
2
- return e
3
- }
4
- export const Language = (e: any) => {
5
- return e
6
- }
7
- export type IColor = keyof typeof COLOR
8
- export type ILanguage = keyof typeof LANG
9
- export const COLOR = {
10
-
11
- }
12
- export const LANG = {
13
-
14
- }
15
- export const Icons = {
16
- menu: "menu",
17
- home: 'home',
18
- person: 'person-outline',
19
- camera: 'camera-outline',
20
- pass: 'lock-closed-outline',
21
- pass1: "key-outline",
22
- image: 'image-outline',
23
- image1: 'images-outline',
24
- mail: 'mail-outline',
25
- settings: 'settings-outline',
26
- logout: 'log-out-outline',
27
- filter: 'funnel-outline',
28
- search: 'search-outline',
29
- back: 'arrow-back-outline',
30
- back1: 'chevron-back-outline',
31
- down: "chevron-down-outline",
32
- down1: "caret-down-outline",
33
- up: 'chevron-up-outline',
34
- up1: 'caret-up-outline',
35
- header: 'heart-outline'
36
- }
package/test.tsx DELETED
@@ -1,25 +0,0 @@
1
- import { Block, Text, Icon, Touch, Layout, LoadingView } from 'ui-rn';
2
- import React from 'react'
3
- export default function test() {
4
- return (
5
- <Layout>
6
- <Block
7
- mar-5
8
- pad-5
9
- red
10
- background={['red', 'blue']}
11
- positionOption={{ top: 10, left: 5 }}
12
- alignCenter
13
- borderCircle
14
- mid
15
- row
16
- width-150
17
- height-300>
18
- <Text size-14 red toUpperCase italic bold>
19
- Hello
20
- </Text>
21
- <Icon name="home" size-45 type="MaterialIcons" />
22
- </Block>
23
- </Layout>
24
- )
25
- }
package/tsconfig.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "compilerOptions": {},
3
- "files": ["./global.d.ts"],
4
- "include": ["./App.tsx"],
5
- "extends": "@react-native/typescript-config/tsconfig.json"
6
- }