react95-native-rabbl 0.1.1
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/LICENSE +21 -0
- package/README.md +24 -0
- package/package.json +154 -0
- package/src/assets/fonts/src/ms-sans-serif/MS Sans Serif.ttf +0 -0
- package/src/assets/fonts/src/ms-sans-serif/license.txt +4 -0
- package/src/assets/fonts/src/ms-sans-serif/readme.txt +26 -0
- package/src/assets/fonts/src/ms-sans-serif-bold/MS Sans Serif Bold.ttf +0 -0
- package/src/assets/fonts/src/ms-sans-serif-bold/license.txt +4 -0
- package/src/assets/fonts/src/ms-sans-serif-bold/readme.txt +26 -0
- package/src/components/AppBar/AppBar.spec.tsx +140 -0
- package/src/components/AppBar/AppBar.tsx +43 -0
- package/src/components/AppBar/AppBarBackAction.tsx +20 -0
- package/src/components/AppBar/AppBarContent.tsx +84 -0
- package/src/components/AppBar/index.ts +1 -0
- package/src/components/Button/Button.spec.tsx +59 -0
- package/src/components/Button/Button.tsx +236 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/Card.spec.tsx +54 -0
- package/src/components/Card/Card.tsx +88 -0
- package/src/components/Card/CardContent.tsx +23 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.tsx +10 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/ColorButton/ColorButton.tsx +69 -0
- package/src/components/ColorButton/index.ts +1 -0
- package/src/components/ColorPicker/ColorPicker.tsx +109 -0
- package/src/components/ColorPicker/index.ts +1 -0
- package/src/components/Desktop/Desktop.spec.tsx +32 -0
- package/src/components/Desktop/Desktop.tsx +132 -0
- package/src/components/Desktop/index.tsx +1 -0
- package/src/components/Divider/Divider.spec.tsx +47 -0
- package/src/components/Divider/Divider.tsx +52 -0
- package/src/components/Divider/index.tsx +1 -0
- package/src/components/FAB/FAB.tsx +288 -0
- package/src/components/FAB/FABGroup.tsx +385 -0
- package/src/components/FAB/index.ts +1 -0
- package/src/components/Fieldset/Fieldset.spec.tsx +48 -0
- package/src/components/Fieldset/Fieldset.tsx +107 -0
- package/src/components/Fieldset/index.ts +1 -0
- package/src/components/Hourglass/Hourglass.spec.tsx +24 -0
- package/src/components/Hourglass/Hourglass.tsx +43 -0
- package/src/components/Hourglass/base64hourglass.ts +3 -0
- package/src/components/Hourglass/index.ts +1 -0
- package/src/components/Icons/ArrowIcon.tsx +85 -0
- package/src/components/Icons/CheckmarkIcon.tsx +55 -0
- package/src/components/Icons/ChevronIcon.tsx +93 -0
- package/src/components/Icons/CloseIcon.tsx +48 -0
- package/src/components/Icons/index.ts +4 -0
- package/src/components/Label/Label.tsx +77 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/List/List.tsx +3 -0
- package/src/components/List/ListAccordion.tsx +154 -0
- package/src/components/List/ListItem.tsx +74 -0
- package/src/components/List/ListSection.tsx +51 -0
- package/src/components/List/index.ts +3 -0
- package/src/components/Menu/Menu.tsx +100 -0
- package/src/components/Menu/MenuItem.tsx +100 -0
- package/src/components/Menu/index.ts +1 -0
- package/src/components/NumberInput/NumberInput.spec.tsx +119 -0
- package/src/components/NumberInput/NumberInput.tsx +144 -0
- package/src/components/NumberInput/index.ts +1 -0
- package/src/components/Panel/Panel.spec.tsx +29 -0
- package/src/components/Panel/Panel.tsx +75 -0
- package/src/components/Panel/index.ts +1 -0
- package/src/components/Portal/Portal.tsx +52 -0
- package/src/components/Portal/PortalConsumer.tsx +48 -0
- package/src/components/Portal/PortalHost.tsx +150 -0
- package/src/components/Portal/PortalManager.tsx +57 -0
- package/src/components/Portal/index.ts +1 -0
- package/src/components/Progress/Progress.tsx +125 -0
- package/src/components/Progress/index.ts +1 -0
- package/src/components/Radio/Radio.tsx +14 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/ScrollPanel/ScrollPanel.tsx +72 -0
- package/src/components/ScrollPanel/index.ts +1 -0
- package/src/components/ScrollView/ScrollView.tsx +284 -0
- package/src/components/ScrollView/index.ts +1 -0
- package/src/components/Select/Select.tsx +229 -0
- package/src/components/Select/SelectBase.tsx +119 -0
- package/src/components/Select/SelectBox.tsx +66 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Slider/Slider.tsx +301 -0
- package/src/components/Slider/index.ts +1 -0
- package/src/components/Snackbar/Snackbar.tsx +260 -0
- package/src/components/Snackbar/SnackbarContent.tsx +23 -0
- package/src/components/Snackbar/index.ts +1 -0
- package/src/components/SwitchBase/SwitchBase.tsx +193 -0
- package/src/components/SwitchBase/index.ts +1 -0
- package/src/components/Tabs/Tabs.tsx +208 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/TextInput/TextInput.tsx +82 -0
- package/src/components/TextInput/index.ts +1 -0
- package/src/components/Toolbar/Toolbar.tsx +113 -0
- package/src/components/Toolbar/index.ts +1 -0
- package/src/components/Typography/Anchor.tsx +38 -0
- package/src/components/Typography/Text.spec.tsx +30 -0
- package/src/components/Typography/Text.tsx +55 -0
- package/src/components/Typography/Title.tsx +58 -0
- package/src/components/Typography/index.ts +3 -0
- package/src/components/Window/Window.tsx +132 -0
- package/src/components/Window/index.ts +1 -0
- package/src/core/Provider.tsx +52 -0
- package/src/core/theming.tsx +8 -0
- package/src/hooks/useAsyncReference.ts +22 -0
- package/src/hooks/useControlledOrUncontrolled.ts +23 -0
- package/src/index.ts +38 -0
- package/src/styles/shadow.tsx +36 -0
- package/src/styles/styleElements.tsx +105 -0
- package/src/styles/styles.ts +129 -0
- package/src/styles/themes/aiee.ts +36 -0
- package/src/styles/themes/ash.ts +35 -0
- package/src/styles/themes/azureOrange.ts +33 -0
- package/src/styles/themes/bee.ts +33 -0
- package/src/styles/themes/blackAndWhite.ts +33 -0
- package/src/styles/themes/blue.ts +36 -0
- package/src/styles/themes/brick.ts +33 -0
- package/src/styles/themes/candy.ts +33 -0
- package/src/styles/themes/cherry.ts +36 -0
- package/src/styles/themes/coldGray.ts +34 -0
- package/src/styles/themes/counterStrike.ts +33 -0
- package/src/styles/themes/darkTeal.ts +36 -0
- package/src/styles/themes/eggplant.ts +33 -0
- package/src/styles/themes/fxDev.ts +36 -0
- package/src/styles/themes/highContrast.ts +33 -0
- package/src/styles/themes/hotChocolate.ts +36 -0
- package/src/styles/themes/index.ts +103 -0
- package/src/styles/themes/lilac.ts +33 -0
- package/src/styles/themes/lilacRoseDark.ts +34 -0
- package/src/styles/themes/maple.ts +33 -0
- package/src/styles/themes/marine.ts +33 -0
- package/src/styles/themes/matrix.ts +33 -0
- package/src/styles/themes/millenium.ts +33 -0
- package/src/styles/themes/modernDark.ts +33 -0
- package/src/styles/themes/molecule.ts +33 -0
- package/src/styles/themes/monochrome.ts +0 -0
- package/src/styles/themes/ninjaTurtles.ts +33 -0
- package/src/styles/themes/olive.ts +33 -0
- package/src/styles/themes/original.ts +33 -0
- package/src/styles/themes/pamelaAnderson.ts +33 -0
- package/src/styles/themes/plum.ts +33 -0
- package/src/styles/themes/polarized.ts +36 -0
- package/src/styles/themes/powerShell.ts +36 -0
- package/src/styles/themes/rainyDay.ts +33 -0
- package/src/styles/themes/raspberry.ts +36 -0
- package/src/styles/themes/redWine.ts +36 -0
- package/src/styles/themes/rose.ts +33 -0
- package/src/styles/themes/seawater.ts +36 -0
- package/src/styles/themes/slate.ts +33 -0
- package/src/styles/themes/solarizedDark.ts +36 -0
- package/src/styles/themes/solarizedLight.ts +36 -0
- package/src/styles/themes/spruce.ts +33 -0
- package/src/styles/themes/stormClouds.ts +36 -0
- package/src/styles/themes/theSixtiesUSA.ts +33 -0
- package/src/styles/themes/tokyoDark.ts +33 -0
- package/src/styles/themes/tooSexy.ts +33 -0
- package/src/styles/themes/travel.ts +33 -0
- package/src/styles/themes/vaporTeal.ts +33 -0
- package/src/styles/themes/vermillion.ts +33 -0
- package/src/styles/themes/violetDark.ts +33 -0
- package/src/styles/themes/water.ts +33 -0
- package/src/styles/themes/wmii.ts +36 -0
- package/src/types.tsx +55 -0
- package/src/utils/index.ts +57 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/* eslint-disable react/destructuring-assignment */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { View, StyleSheet } from 'react-native';
|
|
4
|
+
import PortalManager from './PortalManager';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type Operation =
|
|
11
|
+
| { type: 'mount'; key: number; children: React.ReactNode }
|
|
12
|
+
| { type: 'update'; key: number; children: React.ReactNode }
|
|
13
|
+
| { type: 'unmount'; key: number };
|
|
14
|
+
|
|
15
|
+
export type PortalMethods = {
|
|
16
|
+
mount: (children: React.ReactNode) => number;
|
|
17
|
+
update: (key: number, children: React.ReactNode) => void;
|
|
18
|
+
unmount: (key: number) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
export const PortalContext = React.createContext<PortalMethods>(null as any);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Portal host renders all of its children `Portal` elements.
|
|
26
|
+
* For example, you can wrap a screen in `Portal.Host` to render items above the screen.
|
|
27
|
+
* If you're using the `Provider` component, it already includes `Portal.Host`.
|
|
28
|
+
*
|
|
29
|
+
* ## Usage
|
|
30
|
+
* ```js
|
|
31
|
+
* import * as React from 'react';
|
|
32
|
+
* import { Text } from 'react-native';
|
|
33
|
+
* import { Portal } from 'react-native-paper';
|
|
34
|
+
*
|
|
35
|
+
* const MyComponent = () => (
|
|
36
|
+
* <Portal.Host>
|
|
37
|
+
* <Text>Content of the app</Text>
|
|
38
|
+
* </Portal.Host>
|
|
39
|
+
* );
|
|
40
|
+
*
|
|
41
|
+
* export default MyComponent;
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* Here any `Portal` elements under `<App />` are rendered alongside `<App />` and will appear above `<App />` like a `Modal`.
|
|
45
|
+
*/
|
|
46
|
+
export default class PortalHost extends React.Component<Props> {
|
|
47
|
+
// eslint-disable-next-line react/static-property-placement
|
|
48
|
+
static displayName = 'Portal.Host';
|
|
49
|
+
|
|
50
|
+
componentDidMount() {
|
|
51
|
+
const { manager } = this;
|
|
52
|
+
const { queue } = this;
|
|
53
|
+
|
|
54
|
+
while (queue.length && manager) {
|
|
55
|
+
const action = queue.pop();
|
|
56
|
+
if (action) {
|
|
57
|
+
// eslint-disable-next-line default-case
|
|
58
|
+
switch (action.type) {
|
|
59
|
+
case 'mount':
|
|
60
|
+
manager.mount(action.key, action.children);
|
|
61
|
+
break;
|
|
62
|
+
case 'update':
|
|
63
|
+
manager.update(action.key, action.children);
|
|
64
|
+
break;
|
|
65
|
+
case 'unmount':
|
|
66
|
+
manager.unmount(action.key);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private setManager = (manager: PortalManager | undefined | null) => {
|
|
74
|
+
this.manager = manager;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
private mount = (children: React.ReactNode) => {
|
|
78
|
+
// eslint-disable-next-line no-plusplus
|
|
79
|
+
const key = this.nextKey++;
|
|
80
|
+
|
|
81
|
+
if (this.manager) {
|
|
82
|
+
this.manager.mount(key, children);
|
|
83
|
+
} else {
|
|
84
|
+
this.queue.push({ type: 'mount', key, children });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return key;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
private update = (key: number, children: React.ReactNode) => {
|
|
91
|
+
if (this.manager) {
|
|
92
|
+
this.manager.update(key, children);
|
|
93
|
+
} else {
|
|
94
|
+
const op = { type: 'mount', key, children };
|
|
95
|
+
const index = this.queue.findIndex(
|
|
96
|
+
o => o.type === 'mount' || (o.type === 'update' && o.key === key),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
if (index > -1) {
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
this.queue[index] = op;
|
|
102
|
+
} else {
|
|
103
|
+
this.queue.push(op as Operation);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
private unmount = (key: number) => {
|
|
109
|
+
if (this.manager) {
|
|
110
|
+
this.manager.unmount(key);
|
|
111
|
+
} else {
|
|
112
|
+
this.queue.push({ type: 'unmount', key });
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// eslint-disable-next-line react/sort-comp
|
|
117
|
+
private nextKey = 0;
|
|
118
|
+
|
|
119
|
+
private queue: Operation[] = [];
|
|
120
|
+
|
|
121
|
+
private manager: PortalManager | null | undefined;
|
|
122
|
+
|
|
123
|
+
render() {
|
|
124
|
+
return (
|
|
125
|
+
<PortalContext.Provider
|
|
126
|
+
value={{
|
|
127
|
+
mount: this.mount,
|
|
128
|
+
update: this.update,
|
|
129
|
+
unmount: this.unmount,
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
{/* Need collapsable=false here to clip the elevations, otherwise they appear above Portal components */}
|
|
133
|
+
<View
|
|
134
|
+
style={styles.container}
|
|
135
|
+
collapsable={false}
|
|
136
|
+
pointerEvents='box-none'
|
|
137
|
+
>
|
|
138
|
+
{this.props.children}
|
|
139
|
+
</View>
|
|
140
|
+
<PortalManager ref={this.setManager} />
|
|
141
|
+
</PortalContext.Provider>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const styles = StyleSheet.create({
|
|
147
|
+
container: {
|
|
148
|
+
flex: 1,
|
|
149
|
+
},
|
|
150
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* eslint-disable react/destructuring-assignment */
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
3
|
+
/* eslint-disable react/state-in-constructor */
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { View, StyleSheet } from 'react-native';
|
|
6
|
+
|
|
7
|
+
type State = {
|
|
8
|
+
portals: Array<{
|
|
9
|
+
key: number;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Portal host is the component which actually renders all Portals.
|
|
16
|
+
*/
|
|
17
|
+
export default class PortalManager extends React.PureComponent<{}, State> {
|
|
18
|
+
state: State = {
|
|
19
|
+
portals: [],
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
mount = (key: number, children: React.ReactNode) => {
|
|
23
|
+
this.setState(state => ({
|
|
24
|
+
portals: [...state.portals, { key, children }],
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
update = (key: number, children: React.ReactNode) =>
|
|
29
|
+
this.setState(state => ({
|
|
30
|
+
portals: state.portals.map(item => {
|
|
31
|
+
if (item.key === key) {
|
|
32
|
+
return { ...item, children };
|
|
33
|
+
}
|
|
34
|
+
return item;
|
|
35
|
+
}),
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
unmount = (key: number) =>
|
|
39
|
+
this.setState(state => ({
|
|
40
|
+
portals: state.portals.filter(item => item.key !== key),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
return this.state.portals.map(({ key, children }) => (
|
|
45
|
+
<View
|
|
46
|
+
key={key}
|
|
47
|
+
collapsable={
|
|
48
|
+
false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */
|
|
49
|
+
}
|
|
50
|
+
pointerEvents='box-none'
|
|
51
|
+
style={StyleSheet.absoluteFill}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
</View>
|
|
55
|
+
));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Portal';
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
StyleProp,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
View,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
LayoutChangeEvent,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
|
|
10
|
+
import type { Theme } from '../../types';
|
|
11
|
+
import { withTheme } from '../../core/theming';
|
|
12
|
+
|
|
13
|
+
import { blockSizes } from '../../styles/styles';
|
|
14
|
+
import { Panel } from '../..';
|
|
15
|
+
|
|
16
|
+
type Props = React.ComponentPropsWithRef<typeof View> & {
|
|
17
|
+
background?: 'canvas' | 'material';
|
|
18
|
+
percent: number;
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
theme: Theme;
|
|
21
|
+
variant?: 'default' | 'tile' | 'indeterminate';
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const tileWidth = 17;
|
|
25
|
+
|
|
26
|
+
const Progress = ({
|
|
27
|
+
background = 'material',
|
|
28
|
+
percent = 0,
|
|
29
|
+
style = {},
|
|
30
|
+
theme,
|
|
31
|
+
variant = 'default',
|
|
32
|
+
...rest
|
|
33
|
+
}: Props) => {
|
|
34
|
+
const [tilesNumber, setTilesNumber] = useState(0);
|
|
35
|
+
const [progressWidth, setProgressWidth] = useState(0);
|
|
36
|
+
|
|
37
|
+
function onProgressWidthChange(e: LayoutChangeEvent) {
|
|
38
|
+
const { width } = e.nativeEvent.layout;
|
|
39
|
+
setProgressWidth(width);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setTilesNumber(Math.round((percent / 100) * (progressWidth / tileWidth)));
|
|
44
|
+
}, [percent]);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Panel
|
|
48
|
+
theme={theme}
|
|
49
|
+
variant='cutout'
|
|
50
|
+
background={background}
|
|
51
|
+
{...rest}
|
|
52
|
+
style={[
|
|
53
|
+
styles.wrapper,
|
|
54
|
+
{
|
|
55
|
+
height: blockSizes.md,
|
|
56
|
+
},
|
|
57
|
+
style,
|
|
58
|
+
]}
|
|
59
|
+
accessible
|
|
60
|
+
accessibilityRole='progressbar'
|
|
61
|
+
accessibilityValue={{
|
|
62
|
+
min: 0,
|
|
63
|
+
max: 100,
|
|
64
|
+
now: percent,
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<View style={[styles.progressWrapper]}>
|
|
68
|
+
{variant === 'tile' ? (
|
|
69
|
+
<View
|
|
70
|
+
style={[styles.tilesWrapper, { borderColor: theme.material }]}
|
|
71
|
+
onLayout={onProgressWidthChange}
|
|
72
|
+
>
|
|
73
|
+
{Array(tilesNumber)
|
|
74
|
+
.fill(null)
|
|
75
|
+
.map((_, index) => (
|
|
76
|
+
<View
|
|
77
|
+
style={[
|
|
78
|
+
styles.tile,
|
|
79
|
+
styles.progress,
|
|
80
|
+
{
|
|
81
|
+
backgroundColor: theme.progress,
|
|
82
|
+
borderColor: theme.material,
|
|
83
|
+
},
|
|
84
|
+
]}
|
|
85
|
+
key={index}
|
|
86
|
+
/>
|
|
87
|
+
))}
|
|
88
|
+
</View>
|
|
89
|
+
) : (
|
|
90
|
+
<View
|
|
91
|
+
style={[
|
|
92
|
+
styles.progress,
|
|
93
|
+
{ width: `${percent}%`, backgroundColor: theme.progress },
|
|
94
|
+
]}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
</View>
|
|
98
|
+
</Panel>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const styles = StyleSheet.create({
|
|
103
|
+
wrapper: {
|
|
104
|
+
position: 'relative',
|
|
105
|
+
padding: 4,
|
|
106
|
+
},
|
|
107
|
+
progressWrapper: {
|
|
108
|
+
width: '100%',
|
|
109
|
+
height: '100%',
|
|
110
|
+
},
|
|
111
|
+
progress: {
|
|
112
|
+
height: '100%',
|
|
113
|
+
},
|
|
114
|
+
tilesWrapper: {
|
|
115
|
+
flexDirection: 'row',
|
|
116
|
+
flex: 1,
|
|
117
|
+
borderWidth: 1,
|
|
118
|
+
},
|
|
119
|
+
tile: {
|
|
120
|
+
width: tileWidth,
|
|
121
|
+
borderWidth: 1,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
export default withTheme(Progress);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Progress';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SwitchBase, SwitchProps } from '../SwitchBase';
|
|
3
|
+
|
|
4
|
+
import { withTheme } from '../../core/theming';
|
|
5
|
+
|
|
6
|
+
type Props = SwitchProps & {
|
|
7
|
+
status: 'checked' | 'unchecked';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Radio = (props: Props) => {
|
|
11
|
+
return <SwitchBase component='radio' {...props} />;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default withTheme(Radio);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Radio';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet, ScrollView } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { Theme } from '../../types';
|
|
5
|
+
import { withTheme } from '../../core/theming';
|
|
6
|
+
|
|
7
|
+
import { Divider, Panel } from '../..';
|
|
8
|
+
|
|
9
|
+
// TODO: should we pass theme to wrapped components? (Divider, Panel etc);
|
|
10
|
+
|
|
11
|
+
// TODO: add noBottomBorder and noTopBorder prop
|
|
12
|
+
type Props = React.ComponentPropsWithRef<typeof ScrollView> & {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
noBackground?: boolean;
|
|
15
|
+
theme: Theme;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ScrollPanel = ({
|
|
19
|
+
children,
|
|
20
|
+
noBackground,
|
|
21
|
+
style = {},
|
|
22
|
+
theme,
|
|
23
|
+
...rest
|
|
24
|
+
}: Props) => {
|
|
25
|
+
return (
|
|
26
|
+
<ScrollView
|
|
27
|
+
horizontal
|
|
28
|
+
showsHorizontalScrollIndicator={false}
|
|
29
|
+
style={[
|
|
30
|
+
styles.wrapper,
|
|
31
|
+
{
|
|
32
|
+
backgroundColor: noBackground ? 'transparent' : theme.materialDark,
|
|
33
|
+
},
|
|
34
|
+
style,
|
|
35
|
+
]}
|
|
36
|
+
{...rest}
|
|
37
|
+
>
|
|
38
|
+
<Panel theme={theme} variant='raised' style={[styles.borderWrapper]}>
|
|
39
|
+
<View style={[styles.inner, { backgroundColor: theme.material }]}>
|
|
40
|
+
<Divider theme={theme} orientation='vertical' variant='raised' />
|
|
41
|
+
<Divider theme={theme} orientation='vertical' variant='raised' />
|
|
42
|
+
<View style={[styles.content]}>{children}</View>
|
|
43
|
+
</View>
|
|
44
|
+
</Panel>
|
|
45
|
+
</ScrollView>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
wrapper: {
|
|
51
|
+
flexGrow: 0,
|
|
52
|
+
},
|
|
53
|
+
inner: {
|
|
54
|
+
padding: 16,
|
|
55
|
+
display: 'flex',
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
},
|
|
59
|
+
borderWrapper: {
|
|
60
|
+
padding: 4,
|
|
61
|
+
position: 'relative',
|
|
62
|
+
minWidth: '100%',
|
|
63
|
+
},
|
|
64
|
+
content: {
|
|
65
|
+
marginLeft: 8,
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export default withTheme(ScrollPanel);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ScrollPanel';
|