Skip to content

Commit 00e6ac1

Browse files
authored
Merge pull request #401 from vip-git/mui5
feat: Material UI 5 Integration and bug fixes
2 parents 3ff59c7 + 959438e commit 00e6ac1

File tree

301 files changed

+37075
-5882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+37075
-5882
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ node_modules
44
mochawesome-report-unit
55
todo
66
generated
7-
src/demo/**/__e2e__
7+
demo/**/__e2e__
88
_results_
99
.DS_Store
1010
generator/package-lock.json

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ node_modules
44
mocheawesome-report-unit
55
docs/
66
src/
7+
demo/
78
.gitbook/
89
.idea/
910
.github/
11+
coverage/
1012
todo
1113
jsdom-setup.js
1214
mocha.setup.js
1315
postcss.config.js
16+
rollup.config.js
1417
webpack.config.demo.js
1518
webpack.config.js
1619
.prettier.json
@@ -28,6 +31,7 @@ generator/
2831
wdio-ci.conf.js
2932
wdio.conf.js
3033
.dockerignore
34+
.gitignore
3135
changelog.md
3236
contributing.md
3337
Dockerfile
@@ -39,4 +43,5 @@ tsconfig.json
3943
scripts/
4044
.vscode/
4145
changelog.md
46+
universal-json-schema.md
4247
.husky

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ A [**Material UI**](http://www.material-ui.com/) port of [**jsonschema-form.**](
99

1010
A [**live playground**](https://react-jsonschema-form-material-ui.github56.now.sh/) and [**Detailed Docs**](https://react-json-schema.app/docs)
1111

12-
## Install instructions via npm
12+
## Install instructions via npm (MUI 5+)
1313

1414
```text
1515
npm install --save react-jsonschema-form-material-ui
1616
```
1717
>Follow [Releases page](https://github.com/vip-git/react-jsonschema-form-material-ui/releases) to use latest or preleased tags.
1818
19+
#### For legacy version of < MUI 4
20+
```text
21+
npm install --save react-jsonschema-form-material-ui@3.0.0-mui-4
22+
```
23+
1924
## Basic Example Usage
2025
```jsx
2126
// Library

demo/mobile/nativescript/.gitkeep

Whitespace-only changes.

demo/mobile/reactnative/.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

demo/mobile/reactnative/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Windows files
2+
[*.bat]
3+
end_of_line = crlf

demo/mobile/reactnative/.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Windows files should use crlf line endings
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
*.bat text eol=crlf

demo/mobile/reactnative/.gitignore

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
24+
# Android/IntelliJ
25+
#
26+
build/
27+
.idea
28+
.gradle
29+
local.properties
30+
*.iml
31+
32+
# node.js
33+
#
34+
node_modules/
35+
npm-debug.log
36+
yarn-error.log
37+
38+
# BUCK
39+
buck-out/
40+
\.buckd/
41+
*.keystore
42+
!debug.keystore
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
*/fastlane/report.xml
52+
*/fastlane/Preview.html
53+
*/fastlane/screenshots
54+
55+
# Bundle artifact
56+
*.jsbundle
57+
58+
# CocoaPods
59+
/ios/Pods/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
arrowParens: 'avoid',
7+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

demo/mobile/reactnative/App.tsx

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Library
2+
import React from 'react';
3+
import {
4+
DefaultTheme,
5+
Provider as PaperProvider,
6+
Avatar,
7+
Button,
8+
Card,
9+
Title,
10+
Paragraph
11+
} from 'react-native-paper';
12+
import {
13+
SafeAreaView,
14+
StatusBar,
15+
StyleSheet,
16+
useColorScheme,
17+
} from 'react-native';
18+
19+
// Internal
20+
import ReactNativeForm from '../../../src/Form';
21+
22+
const LeftContent = (props: any) => <Avatar.Icon {...props} icon="folder" />
23+
24+
const App = () => {
25+
const isDarkMode = useColorScheme() === 'dark';
26+
27+
const theme = {
28+
...DefaultTheme,
29+
colors: {
30+
...DefaultTheme.colors,
31+
primary: 'tomato',
32+
accent: 'gray',
33+
},
34+
};
35+
36+
37+
const backgroundStyle = {
38+
backgroundColor: isDarkMode ? theme.colors.primary : theme.colors.accent,
39+
};
40+
41+
return (
42+
<PaperProvider theme={theme}>
43+
<SafeAreaView style={backgroundStyle}>
44+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
45+
<Card>
46+
<Card.Title title="Card Title" subtitle="Card Subtitle" left={LeftContent} />
47+
<Card.Content>
48+
<Title>Card title</Title>
49+
<Paragraph>Card content</Paragraph>
50+
</Card.Content>
51+
<Card.Cover source={{ uri: 'https://picsum.photos/700' }} />
52+
<Card.Actions>
53+
<Button>Cancel</Button>
54+
<Button>Ok</Button>
55+
</Card.Actions>
56+
</Card>
57+
<ReactNativeForm />
58+
</SafeAreaView>
59+
</PaperProvider>
60+
);
61+
};
62+
63+
const styles = StyleSheet.create({
64+
sectionContainer: {
65+
marginTop: 32,
66+
paddingHorizontal: 24,
67+
},
68+
sectionTitle: {
69+
fontSize: 24,
70+
fontWeight: '600',
71+
},
72+
sectionDescription: {
73+
marginTop: 8,
74+
fontSize: 18,
75+
fontWeight: '400',
76+
},
77+
highlight: {
78+
fontWeight: '700',
79+
},
80+
});
81+
82+
export default App;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
13+
lib_deps = []
14+
15+
create_aar_targets(glob(["libs/*.aar"]))
16+
17+
create_jar_targets(glob(["libs/*.jar"]))
18+
19+
android_library(
20+
name = "all-libs",
21+
exported_deps = lib_deps,
22+
)
23+
24+
android_library(
25+
name = "app-code",
26+
srcs = glob([
27+
"src/main/java/**/*.java",
28+
]),
29+
deps = [
30+
":all-libs",
31+
":build_config",
32+
":res",
33+
],
34+
)
35+
36+
android_build_config(
37+
name = "build_config",
38+
package = "com.reactnative",
39+
)
40+
41+
android_resource(
42+
name = "res",
43+
package = "com.reactnative",
44+
res = "src/main/res",
45+
)
46+
47+
android_binary(
48+
name = "app",
49+
keystore = "//android/keystores:debug",
50+
manifest = "src/main/AndroidManifest.xml",
51+
package_type = "debug",
52+
deps = [
53+
":app-code",
54+
],
55+
)

0 commit comments

Comments
 (0)