react-native-boxes 1.4.73 → 1.4.74
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/package.json +1 -1
- package/sample-app/App.tsx +34 -34
- package/sample-app/app.json +30 -30
- package/sample-app/package.json +30 -30
- package/sample-app/tsconfig.json +6 -6
- package/src/List.tsx +12 -4
package/package.json
CHANGED
package/sample-app/App.tsx
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { StatusBar } from 'expo-status-bar';
|
|
2
|
-
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
-
import { DemoScreen, Theme, ThemeContext } from 'react-native-boxes'
|
|
4
|
-
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
|
-
|
|
6
|
-
export default function App() {
|
|
7
|
-
const theme = new Theme()
|
|
8
|
-
|
|
9
|
-
loadAsync({
|
|
10
|
-
'Regular': require('./assets/fonts/Regular.ttf'),
|
|
11
|
-
'Bold': require('./assets/fonts/Bold.ttf'),
|
|
12
|
-
'Styled': require('./assets/fonts/Styled.ttf'),
|
|
13
|
-
})
|
|
14
|
-
return (
|
|
15
|
-
<ThemeContext.Provider value={theme}>
|
|
16
|
-
<SafeAreaProvider>
|
|
17
|
-
<DemoScreen />
|
|
18
|
-
</SafeAreaProvider>
|
|
19
|
-
</ThemeContext.Provider>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const styles = StyleSheet.create({
|
|
24
|
-
container: {
|
|
25
|
-
flex: 1,
|
|
26
|
-
backgroundColor: '#fff',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
justifyContent: 'center',
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
function loadAsync(arg0: { Regular: any; Bold: any; Styled: any; }) {
|
|
32
|
-
throw new Error('Function not implemented.');
|
|
33
|
-
}
|
|
34
|
-
|
|
1
|
+
import { StatusBar } from 'expo-status-bar';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import { DemoScreen, Theme, ThemeContext } from 'react-native-boxes'
|
|
4
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
|
+
|
|
6
|
+
export default function App() {
|
|
7
|
+
const theme = new Theme()
|
|
8
|
+
|
|
9
|
+
loadAsync({
|
|
10
|
+
'Regular': require('./assets/fonts/Regular.ttf'),
|
|
11
|
+
'Bold': require('./assets/fonts/Bold.ttf'),
|
|
12
|
+
'Styled': require('./assets/fonts/Styled.ttf'),
|
|
13
|
+
})
|
|
14
|
+
return (
|
|
15
|
+
<ThemeContext.Provider value={theme}>
|
|
16
|
+
<SafeAreaProvider>
|
|
17
|
+
<DemoScreen />
|
|
18
|
+
</SafeAreaProvider>
|
|
19
|
+
</ThemeContext.Provider>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
container: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
backgroundColor: '#fff',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
function loadAsync(arg0: { Regular: any; Bold: any; Styled: any; }) {
|
|
32
|
+
throw new Error('Function not implemented.');
|
|
33
|
+
}
|
|
34
|
+
|
package/sample-app/app.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"expo": {
|
|
3
|
-
"name": "sample-app",
|
|
4
|
-
"slug": "sample-app",
|
|
5
|
-
"version": "1.0.0",
|
|
6
|
-
"orientation": "portrait",
|
|
7
|
-
"icon": "./assets/icon.png",
|
|
8
|
-
"userInterfaceStyle": "light",
|
|
9
|
-
"splash": {
|
|
10
|
-
"image": "./assets/splash.png",
|
|
11
|
-
"resizeMode": "contain",
|
|
12
|
-
"backgroundColor": "#ffffff"
|
|
13
|
-
},
|
|
14
|
-
"assetBundlePatterns": [
|
|
15
|
-
"**/*"
|
|
16
|
-
],
|
|
17
|
-
"ios": {
|
|
18
|
-
"supportsTablet": true
|
|
19
|
-
},
|
|
20
|
-
"android": {
|
|
21
|
-
"adaptiveIcon": {
|
|
22
|
-
"foregroundImage": "./assets/adaptive-icon.png",
|
|
23
|
-
"backgroundColor": "#ffffff"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"web": {
|
|
27
|
-
"favicon": "./assets/favicon.png"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"expo": {
|
|
3
|
+
"name": "sample-app",
|
|
4
|
+
"slug": "sample-app",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"orientation": "portrait",
|
|
7
|
+
"icon": "./assets/icon.png",
|
|
8
|
+
"userInterfaceStyle": "light",
|
|
9
|
+
"splash": {
|
|
10
|
+
"image": "./assets/splash.png",
|
|
11
|
+
"resizeMode": "contain",
|
|
12
|
+
"backgroundColor": "#ffffff"
|
|
13
|
+
},
|
|
14
|
+
"assetBundlePatterns": [
|
|
15
|
+
"**/*"
|
|
16
|
+
],
|
|
17
|
+
"ios": {
|
|
18
|
+
"supportsTablet": true
|
|
19
|
+
},
|
|
20
|
+
"android": {
|
|
21
|
+
"adaptiveIcon": {
|
|
22
|
+
"foregroundImage": "./assets/adaptive-icon.png",
|
|
23
|
+
"backgroundColor": "#ffffff"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"web": {
|
|
27
|
+
"favicon": "./assets/favicon.png"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/sample-app/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "sample-app",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"main": "node_modules/expo/AppEntry.js",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"start": "expo start",
|
|
7
|
-
"android": "expo start --android",
|
|
8
|
-
"ios": "expo start --ios",
|
|
9
|
-
"web": "expo start --web"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@expo/metro-runtime": "~3.1.3",
|
|
13
|
-
"@expo/vector-icons": "^13.0.0",
|
|
14
|
-
"expo": "~50.0.14",
|
|
15
|
-
"expo-status-bar": "~1.11.1",
|
|
16
|
-
"react": "18.2.0",
|
|
17
|
-
"react-dom": "18.2.0",
|
|
18
|
-
"react-native": "0.73.6",
|
|
19
|
-
"react-native-boxes": "^1.4.61",
|
|
20
|
-
"react-native-gesture-handler": "^2.22.1",
|
|
21
|
-
"react-native-safe-area-context": "^4.9.0",
|
|
22
|
-
"react-native-web": "~0.19.6"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@babel/core": "^7.20.0",
|
|
26
|
-
"@types/react": "~18.2.45",
|
|
27
|
-
"typescript": "^5.1.3"
|
|
28
|
-
},
|
|
29
|
-
"private": true
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "sample-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "node_modules/expo/AppEntry.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "expo start",
|
|
7
|
+
"android": "expo start --android",
|
|
8
|
+
"ios": "expo start --ios",
|
|
9
|
+
"web": "expo start --web"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@expo/metro-runtime": "~3.1.3",
|
|
13
|
+
"@expo/vector-icons": "^13.0.0",
|
|
14
|
+
"expo": "~50.0.14",
|
|
15
|
+
"expo-status-bar": "~1.11.1",
|
|
16
|
+
"react": "18.2.0",
|
|
17
|
+
"react-dom": "18.2.0",
|
|
18
|
+
"react-native": "0.73.6",
|
|
19
|
+
"react-native-boxes": "^1.4.61",
|
|
20
|
+
"react-native-gesture-handler": "^2.22.1",
|
|
21
|
+
"react-native-safe-area-context": "^4.9.0",
|
|
22
|
+
"react-native-web": "~0.19.6"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@babel/core": "^7.20.0",
|
|
26
|
+
"@types/react": "~18.2.45",
|
|
27
|
+
"typescript": "^5.1.3"
|
|
28
|
+
},
|
|
29
|
+
"private": true
|
|
30
|
+
}
|
package/sample-app/tsconfig.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "expo/tsconfig.base",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"strict": true
|
|
5
|
-
}
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "expo/tsconfig.base",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": true
|
|
5
|
+
}
|
|
6
|
+
}
|
package/src/List.tsx
CHANGED
|
@@ -5,16 +5,20 @@ import { Caption, Subtitle, TextView, TitleText } from "./Text"
|
|
|
5
5
|
import { useContext } from "react"
|
|
6
6
|
import { ThemeContext } from "./ThemeContext"
|
|
7
7
|
import { PressableView } from "./Button"
|
|
8
|
-
|
|
8
|
+
import React from 'react'
|
|
9
9
|
|
|
10
10
|
export type DatatableViewProps = {
|
|
11
11
|
items: any[],
|
|
12
|
-
itemAdapter
|
|
12
|
+
itemAdapter?: (item: any, idx: number, list: any) => SimpleDatatableViewItemProps,
|
|
13
13
|
loading?: boolean,
|
|
14
|
+
onRender?: (item: any, idx: number, list: any) => React.Component | React.JSX.Element | Element | any
|
|
14
15
|
} & ViewProps
|
|
15
16
|
export function SimpleDatalistView(props: DatatableViewProps) {
|
|
16
17
|
const theme = useContext(ThemeContext)
|
|
17
|
-
|
|
18
|
+
if (!props.itemAdapter && !props.onRender) {
|
|
19
|
+
console.warn('SimpleDatalistView: must provide either itemAdapter or onRender')
|
|
20
|
+
return null
|
|
21
|
+
}
|
|
18
22
|
return props.loading ?
|
|
19
23
|
<Center style={{
|
|
20
24
|
padding: theme.dimens.space.xl * 2
|
|
@@ -26,7 +30,10 @@ export function SimpleDatalistView(props: DatatableViewProps) {
|
|
|
26
30
|
<VBox style={[props.style]}>
|
|
27
31
|
{
|
|
28
32
|
props.items.map((item, idx) => {
|
|
29
|
-
|
|
33
|
+
if (props.onRender) {
|
|
34
|
+
return props.onRender?.(item, idx, props.items)
|
|
35
|
+
}
|
|
36
|
+
let data = props.itemAdapter?.(item, idx, props.items)
|
|
30
37
|
return (
|
|
31
38
|
<SimpleDatatlistViewItem
|
|
32
39
|
key={idx}
|
|
@@ -39,6 +46,7 @@ export function SimpleDatalistView(props: DatatableViewProps) {
|
|
|
39
46
|
|
|
40
47
|
}
|
|
41
48
|
|
|
49
|
+
|
|
42
50
|
export type SimpleDatatableViewItemProps = {
|
|
43
51
|
title?: string,
|
|
44
52
|
icon?: string | any,
|